Tag: cws_src680_dba25
User: oj      
Date: 05/03/02 04:48:18

Modified:
 /dba/connectivity/source/drivers/file/
  FStatement.cxx

Log:
 #i43858# check for create table

File Changes:

Directory: /dba/connectivity/source/drivers/file/
=================================================

File [changed]: FStatement.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/file/FStatement.cxx?r1=1.35&r2=1.35.32.1
Delta lines:  +63 -44
---------------------
--- FStatement.cxx      5 Jan 2005 11:59:50 -0000       1.35
+++ FStatement.cxx      2 Mar 2005 12:48:15 -0000       1.35.32.1
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: FStatement.cxx,v $
  *
- *  $Revision: 1.35 $
+ *  $Revision: 1.35.32.1 $
  *
- *  last change: $Author: obo $ $Date: 2005/01/05 11:59:50 $
+ *  last change: $Author: oj $ $Date: 2005/03/02 12:48:15 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -372,12 +372,28 @@
        ::osl::MutexGuard aGuard( m_aMutex );
        checkDisposed(OStatement_BASE::rBHelper.bDisposed);
         
+    switch(m_aSQLIterator.getStatementType())
+    {
+        case SQL_STATEMENT_CREATE_TABLE:
+            ::dbtools::throwGenericSQLException(   ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM("The \"CREATE TABLE\" of statement is not 
supported.")),
+                                        static_cast<XWeak*>(this)
+                                    );
+            break;
+        case SQL_STATEMENT_ODBC_CALL:
+        case SQL_STATEMENT_UNKNOWN:
+            ::dbtools::throwGenericSQLException(   ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM("This kind of statement is not supported.")),
+                                        static_cast<XWeak*>(this)
+                                    );
+    }
+       
        construct(sql);
+    Reference< XResultSet > xRS;
        OResultSet* pResult = createResultSet();
-       Reference< XResultSet > xRS = pResult;
+       xRS = pResult;
        initializeResultSet(pResult);
 
        pResult->OpenImpl();
+    
        return xRS;
 }
 // -------------------------------------------------------------------------
@@ -532,6 +548,8 @@
                                                                                
static_cast<XWeak*>(this),
                                                                                
makeAny(m_aSQLIterator.getWarning()));
 
+        if ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || 
m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT )
+        {
                // at this moment we support only one table per select statement
                Reference< ::com::sun::star::lang::XUnoTunnel> 
xTunnel(xTabs.begin()->second,UNO_QUERY);
                if(xTunnel.is())
@@ -543,6 +561,7 @@
                                m_pTable->acquire();
                }
                OSL_ENSURE(m_pTable,"No table!");
+            if ( m_pTable )
                m_xColNames             = m_pTable->getColumns();
                Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
                // set the binding of the resultrow
@@ -565,12 +584,12 @@
 
                m_pSQLAnalyzer  = createAnalyzer();
 
-               OSL_ENSURE(m_pTable,"We need a table object!");
                Reference<XIndexesSupplier> xIndexSup(xTunnel,UNO_QUERY);
                if(xIndexSup.is())
                        m_pSQLAnalyzer->setIndexes(xIndexSup->getIndexes());
 
                anylizeSQL();
+        }
        }
        else
                throw SQLException(aErr,*this,::rtl::OUString(),0,Any());




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to