Tag: cws_src680_dba25
User: fs      
Date: 05/03/15 09:06:41

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

Log:
 #i45104# properly defer CREATE TABLE statements (in all cases), and again 
allow INSERT and SELECT statements

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.32.1&r2=1.35.32.2
Delta lines:  +56 -58
---------------------
--- FStatement.cxx      2 Mar 2005 12:48:15 -0000       1.35.32.1
+++ FStatement.cxx      15 Mar 2005 17:06:39 -0000      1.35.32.2
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: FStatement.cxx,v $
  *
- *  $Revision: 1.35.32.1 $
+ *  $Revision: 1.35.32.2 $
  *
- *  last change: $Author: oj $ $Date: 2005/03/02 12:48:15 $
+ *  last change: $Author: fs $ $Date: 2005/03/15 17:06:39 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -372,20 +372,6 @@
        ::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();
@@ -534,22 +520,35 @@
                m_aSQLIterator.traverseAll();
                const OSQLTables& xTabs = m_aSQLIterator.getTables();
 
+        // sanity checks
                if ( xTabs.empty() )
+            // no tables -> nothing to operate on -> error
                        throwGenericSQLException(       
::rtl::OUString::createFromAscii("The statement is invalid. It contains no 
valid table."),
                                                                                
static_cast<XWeak*>(this),
                                                                                
makeAny(m_aSQLIterator.getWarning()));
+
                if ( xTabs.size() > 1 || 
m_aSQLIterator.getWarning().Message.getLength() )
+            // more than one table -> can't operate on them -> error
                        throwGenericSQLException(       
::rtl::OUString::createFromAscii("The statement is invalid. It contains more 
than one table."),
                                                                                
static_cast<XWeak*>(this),
                                                                                
makeAny(m_aSQLIterator.getWarning()));
 
                if ( (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT 
|| m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT) && 
m_aSQLIterator.getSelectColumns()->empty() )
+            // SELECT statement without columns -> error
                        throwGenericSQLException(       
::rtl::OUString::createFromAscii("The statement is invalid. It contains no 
valid column names."),
                                                                                
static_cast<XWeak*>(this),
                                                                                
makeAny(m_aSQLIterator.getWarning()));
 
-        if ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT || 
m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT_COUNT )
-        {
+        if ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_CREATE_TABLE )
+            // CREATE TABLE is not supported at all
+            throwGenericSQLException(   ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM("The \"CREATE TABLE\" of statement is not 
supported.")),
+                                        static_cast<XWeak*>(this));
+
+        if ( ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_ODBC_CALL ) 
|| ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_UNKNOWN ) )
+            // ODBC call or unknown statement type -> error
+            throwGenericSQLException(   ::rtl::OUString( 
RTL_CONSTASCII_USTRINGPARAM("This kind of statement is not supported.")),
+                                        static_cast<XWeak*>(this));
+       
                    // 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())
@@ -589,7 +588,6 @@
                            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