Tag: cws_src680_sqlite
User: aklitzing
Date: 2006/08/18 11:59:04

Modified:
   dba/connectivity/source/drivers/sqlite3/sqStatement.cxx
   dba/connectivity/source/drivers/sqlite3/sqStatement.hxx

Log:
 * Changed to human-readable code
 * free() changed
 * sqQueryPrepared to sqQueryPreparedCursor
 * Old comments removed

File Changes:

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

File [changed]: sqStatement.cxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/sqlite3/sqStatement.cxx?r1=1.1.2.1&r2=1.1.2.2
Delta lines:  +7 -55
--------------------
--- sqStatement.cxx     16 Aug 2006 14:57:14 -0000      1.1.2.1
+++ sqStatement.cxx     18 Aug 2006 18:59:01 -0000      1.1.2.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: sqStatement.cxx,v $
  *
- *  $Revision: 1.1.2.1 $
+ *  $Revision: 1.1.2.2 $
  *
- *  last change: $Author: aklitzing $ $Date: 2006/08/16 14:57:14 $
+ *  last change: $Author: aklitzing $ $Date: 2006/08/18 18:59:01 $
  *
  *  Original contributor: André Klitzing
  *
@@ -171,7 +171,7 @@
        checkDisposed(OStatement_BASE::rBHelper.bDisposed);
 
        ::rtl::OString stmt = ::rtl::OUStringToOString(sql, 
RTL_TEXTENCODING_UTF8);
-       sqQueryPrepared* query = m_pDB->getQuery(stmt.getStr());
+       sqQueryPreparedCursor* query = m_pDB->getQueryCursor(stmt.getStr());
        checkError(query, ::rtl::OUString::createFromAscii("Query can't be 
executed"));
 
        return query->execute() == SQLITE_OK;
@@ -179,52 +179,6 @@
 // -------------------------------------------------------------------------
 
 
-
-
-/*
-void executeXXX(const OUString &sql, Reference<XResultSet>* result) //, 
sal_Int32 *rowsAffected)
-    throw (SQLException, RuntimeException)
-{
-    OString o = rtl::OUStringToOString(sql, m_pSettings->encoding);
-    char *errMsg = NULL;
-    int ret;
-    if (result) {
-        char **rows;
-       int nrows, ncols;
-
-       ret = sqlite3_get_table(m_pSettings->pConnection, o.getStr(),
-                              &rows, &nrows, &ncols, &errMsg);
-       if (ret == SQLITE_OK) {
-           if (ncols <= 0) {
-               sqlite3_free_table(rows);
-               rows = NULL;
-           }
-           *result = new ResultSet(m_refMutex, *this, &m_pSettings,
-                                   ncols, nrows, rows, m_pSettings->tc);
-       }
-    } else {
-        ret = sqlite3_exec(m_pSettings->pConnection, o.getStr(),
-                         NULL, NULL, &errMsg);
-    }
-    if (ret != SQLITE_OK) {
-        OUString msg(RTL_CONSTASCII_USTRINGPARAM("unkown error"));
-       if (errMsg) {
-           msg = ::rtl::OUString::createFromAscii(errMsg);
-           sqlite3_free(errMsg);
-       }
-       throw SQLException(msg, *this, msg, 1, Any ());
-       return;
-    }
-    if (rowsAffected) {
-        *rowsAffected = sqlite3_changes(m_pSettings->pConnection);
-    }
-    if (errMsg) {
-        sqlite3_free(errMsg);
-    }
-}
-*/
-
-
 Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const 
::rtl::OUString& sql ) throw(SQLException, RuntimeException)
 {
        ::osl::MutexGuard aGuard(m_aMutex);
@@ -232,12 +186,10 @@
        Reference<XResultSet> xRS;
 
        ::rtl::OString stmt = ::rtl::OUStringToOString(sql, 
RTL_TEXTENCODING_UTF8);
-       sqQueryPrepared* query = m_pDB->getQuery(stmt.getStr());
+       sqQueryPreparedCursor* query = m_pDB->getQueryCursor(stmt.getStr());
        checkError(query, ::rtl::OUString::createFromAscii("Query can't be 
executed"));
 
        xRS = new OResultSet(this, query);
-
-       m_xResultSet = xRS;
        return xRS;
 }
 // -------------------------------------------------------------------------
@@ -251,7 +203,7 @@
        return (Reference< XConnection >)m_pConnection;
 }
 // 
-----------------------------------------------------------------------------
-sal_Int32 SAL_CALL OStatement_Base::getUpdateCount(  ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException)
+sal_Int32 SAL_CALL OStatement_Base::getUpdateCount(  ) throw(SQLException, 
RuntimeException)
 {
        return m_pDB->getLastChanges();
 }
@@ -454,7 +406,7 @@
        {
                sqDB* parent = query->getParentDB();
            ::rtl::OUString msg = 
::rtl::OUString::createFromAscii(parent->getLastErrorMsg());
-           query->free();
+           parent->free(query);
        throw SQLException(error, *this, msg, parent->getLastErrorNo(), Any());
        }
 }

File [changed]: sqStatement.hxx
Url: 
http://dba.openoffice.org/source/browse/dba/connectivity/source/drivers/sqlite3/sqStatement.hxx?r1=1.1.2.1&r2=1.1.2.2
Delta lines:  +23 -21
---------------------
--- sqStatement.hxx     16 Aug 2006 14:57:15 -0000      1.1.2.1
+++ sqStatement.hxx     18 Aug 2006 18:59:01 -0000      1.1.2.2
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: sqStatement.hxx,v $
  *
- *  $Revision: 1.1.2.1 $
+ *  $Revision: 1.1.2.2 $
  *
- *  last change: $Author: aklitzing $ $Date: 2006/08/16 14:57:15 $
+ *  last change: $Author: aklitzing $ $Date: 2006/08/18 18:59:01 $
  *
  *  Original contributor: André Klitzing
  *
@@ -89,6 +89,8 @@
 {
        namespace sqlite3
        {
+               using ::com::sun::star::sdbc::SQLException;
+               using ::com::sun::star::uno::RuntimeException;
 
         typedef ::cppu::WeakComponentImplHelper5<      
::com::sun::star::sdbc::XStatement,
                                                     
::com::sun::star::sdbc::XWarningsSupplier,
@@ -158,21 +160,21 @@
                        // XPropertySet
             virtual ::com::sun::star::uno::Reference< 
::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo(  ) 
throw(::com::sun::star::uno::RuntimeException);
                        // XStatement
-            virtual ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const 
::rtl::OUString& sql ) throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException) ;
-            virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& 
sql ) throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException) ;
-            virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException) ;
-            virtual ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XConnection > SAL_CALL getConnection(  ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException) ;
+            virtual ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XResultSet > SAL_CALL executeQuery( const 
::rtl::OUString& sql ) throw(SQLException, RuntimeException) ;
+            virtual sal_Int32 SAL_CALL executeUpdate( const ::rtl::OUString& 
sql ) throw(SQLException, RuntimeException) ;
+            virtual sal_Bool SAL_CALL execute( const ::rtl::OUString& sql ) 
throw(SQLException, RuntimeException) ;
+            virtual ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XConnection > SAL_CALL getConnection(  ) 
throw(SQLException, RuntimeException) ;
                        // XWarningsSupplier
-                       virtual ::com::sun::star::uno::Any SAL_CALL 
getWarnings(  ) throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException);
-                       virtual void SAL_CALL clearWarnings(  ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException);
+                       virtual ::com::sun::star::uno::Any SAL_CALL 
getWarnings(  ) throw(SQLException, RuntimeException);
+                       virtual void SAL_CALL clearWarnings(  ) 
throw(SQLException, RuntimeException);
                        // XCancellable
                        virtual void SAL_CALL cancel(  ) 
throw(::com::sun::star::uno::RuntimeException);
                        // XCloseable
-            virtual void SAL_CALL close(  ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException);
+            virtual void SAL_CALL close(  ) throw(SQLException, 
RuntimeException);
                        // XMultipleResults
-            virtual ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet(  ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException);
-            virtual sal_Int32 SAL_CALL getUpdateCount(  ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException);
-            virtual sal_Bool SAL_CALL getMoreResults(  ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException);
+            virtual ::com::sun::star::uno::Reference< 
::com::sun::star::sdbc::XResultSet > SAL_CALL getResultSet(  ) 
throw(SQLException, RuntimeException);
+            virtual sal_Int32 SAL_CALL getUpdateCount(  ) throw(SQLException, 
RuntimeException);
+            virtual sal_Bool SAL_CALL getMoreResults(  ) throw(SQLException, 
RuntimeException);
 
                        // other methods
                        OConnection* getOwnConnection() const { return 
m_pConnection;}
@@ -210,9 +212,9 @@
                        virtual void SAL_CALL acquire() throw();
             virtual void SAL_CALL release() throw();
                        // XBatchExecution
-            virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException);
-            virtual void SAL_CALL clearBatch(  ) 
throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException);
-            virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL 
executeBatch(  ) throw(::com::sun::star::sdbc::SQLException, 
::com::sun::star::uno::RuntimeException);
+            virtual void SAL_CALL addBatch( const ::rtl::OUString& sql ) 
throw(SQLException, RuntimeException);
+            virtual void SAL_CALL clearBatch(  ) throw(SQLException, 
RuntimeException);
+            virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL 
executeBatch(  ) throw(SQLException, RuntimeException);
                };
        }
 }




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

Reply via email to