[Libreoffice-commits] core.git: 3 commits - connectivity/source

Andrzej J.R. Hunt andrzej at ahunt.org
Tue Sep 3 11:49:38 PDT 2013


 connectivity/source/drivers/firebird/DatabaseMetaData.cxx |    6 
 connectivity/source/drivers/firebird/Driver.cxx           |    9 -
 connectivity/source/drivers/firebird/ResultSet.cxx        |  116 +++++++-------
 3 files changed, 69 insertions(+), 62 deletions(-)

New commits:
commit 76e6c6f3ea2631b70368865b4d38803c9bc47fd6
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Mon Sep 2 17:48:38 2013 +0100

    Add some comments on foreign key retrieval (firebird-sdbc)
    
    These two methods don't seem to be used at all within the LO codebase.
    They are also extremely complicated to implement hence will be left for
    later implementation -- my part implementation will be put on the wiki
    firebird page.
    
    Change-Id: I72922a4f3c4705fdcc3bbca140d6df64a1e16253

diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index ef817b7..2eabddf 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -1463,6 +1463,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
     const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException)
 {
+    // List the columns in a table which are foreign keys. This is actually
+    // never used anywhere in the LO codebase currently. Retrieval from firebird
+    // requires using a 5-table join.
     SAL_WARN("connectivity.firebird", "Not yet implemented");
     (void) catalog;
     (void) schema;
@@ -1473,6 +1476,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
     const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException)
 {
+    // List the columns in a table (which must be primary key, or possibly just
+    // unique) that are referred to in other foreign keys. Will have a similar
+    // 5-table or so join as in getExportedKeys.
     SAL_WARN("connectivity.firebird", "Not yet implemented");
     (void) catalog;
     (void) schema;
commit 868cd2461580d362c847846f6bb52a381b282b6f
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Sun Sep 1 16:05:15 2013 +0100

    Remove outdated/useless comments. (firebird-sdbc)
    
    Change-Id: Iab163debab1513369b75183efdaa3c03f7193a70

diff --git a/connectivity/source/drivers/firebird/Driver.cxx b/connectivity/source/drivers/firebird/Driver.cxx
index 729dc2b..5e9f04b 100644
--- a/connectivity/source/drivers/firebird/Driver.cxx
+++ b/connectivity/source/drivers/firebird/Driver.cxx
@@ -76,7 +76,6 @@ void FirebirdDriver::disposing()
 {
     MutexGuard aGuard(m_aMutex);
 
-    // when driver will be destroied so all our connections have to be destroied as well
     for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
     {
         Reference< XComponent > xComp(i->get(), UNO_QUERY);
@@ -99,7 +98,6 @@ rtl::OUString FirebirdDriver::getImplementationName_Static() throw(RuntimeExcept
 
 Sequence< OUString > FirebirdDriver::getSupportedServiceNames_Static() throw (RuntimeException)
 {
-    // TODO: add com.sun.star.sdbcx.Driver once all sdbc functionality is implemented
     Sequence< OUString > aSNS( 2 );
     aSNS[0] = OUString("com.sun.star.sdbc.Driver");
     aSNS[0] = OUString("com.sun.star.sdbcx.Driver");
@@ -143,12 +141,11 @@ Reference< XConnection > SAL_CALL FirebirdDriver::connect(
        throw DisposedException();
 
     if ( ! acceptsURL(url) )
-        return NULL; // TODO: throw Exception?
+        return NULL;
 
-    // create a new connection with the given properties and append it to our vector
     OConnection* pCon = new OConnection(this);
-    Reference< XConnection > xCon = pCon;   // important here because otherwise the connection could be deleted inside (refcount goes -> 0)
-    pCon->construct(url,info); // late constructor call which can throw exception and allows a correct dtor call when so
+    Reference< XConnection > xCon = pCon;
+    pCon->construct(url, info);
     m_xConnections.push_back(WeakReferenceHelper(*pCon));
 
     return xCon;
commit 3a5fa58344399f9de5d20fe0b1ed82b074fb5eba
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Fri Aug 30 17:12:58 2013 +0100

    ResultSet: add FunctionNotSupportedException, some cleanup. (firebird-sdbc)
    
    Change-Id: Iee897766841af980d93aeb73255c82851172601a

diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx
index aec90bf..6946100 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -136,7 +136,6 @@ sal_Bool SAL_CALL OResultSet::next() throw(SQLException, RuntimeException)
     }
     else if (fetchStat == 100L) // END OF DATASET
     {
-        // TODO: shut the statement
         m_bIsAfterLastRow = true;
         return sal_False;
     }
@@ -151,12 +150,16 @@ sal_Bool SAL_CALL OResultSet::next() throw(SQLException, RuntimeException)
 
 sal_Bool SAL_CALL OResultSet::previous() throw(SQLException, RuntimeException)
 {
-    throw SQLException("Firebird doesn't support previous()", *this, OUString(), 0, Any());
+    ::dbtools::throwFunctionNotSupportedException("previous not supported in firebird",
+                                                  *this);
+    return sal_False;
 }
 
 sal_Bool SAL_CALL OResultSet::isLast() throw(SQLException, RuntimeException)
 {
-    throw SQLException("Firebird doesn't support isLast()", *this, OUString(), 0, Any());
+    ::dbtools::throwFunctionNotSupportedException("isLast not supported in firebird",
+                                                  *this);
+    return sal_False;
 }
 
 sal_Bool SAL_CALL OResultSet::isBeforeFirst() throw(SQLException, RuntimeException)
@@ -183,23 +186,24 @@ sal_Bool SAL_CALL OResultSet::isFirst() throw(SQLException, RuntimeException)
     return m_currentRow == 1 && !m_bIsAfterLastRow;
 }
 
-// Move to front
 void SAL_CALL OResultSet::beforeFirst() throw(SQLException, RuntimeException)
 {
     MutexGuard aGuard(m_pConnection->getMutex());
     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
     if (m_currentRow != 0)
-        throw SQLException("Firebird doesn't support beforeFirst()", *this, OUString(), 0, Any());
+        ::dbtools::throwFunctionNotSupportedException("beforeFirst not supported in firebird",
+                                                      *this);
 }
-// Move to back
+
 void SAL_CALL OResultSet::afterLast() throw(SQLException, RuntimeException)
 {
     MutexGuard aGuard(m_pConnection->getMutex());
     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
     if (!m_bIsAfterLastRow)
-        throw SQLException("Firebird doesn't support afterLast()", *this, OUString(), 0, Any());
+        ::dbtools::throwFunctionNotSupportedException("afterLast not supported in firebird",
+                                                      *this);
 }
 
 sal_Bool SAL_CALL OResultSet::first() throw(SQLException, RuntimeException)
@@ -213,19 +217,23 @@ sal_Bool SAL_CALL OResultSet::first() throw(SQLException, RuntimeException)
     }
     else if (m_currentRow == 1 && !m_bIsAfterLastRow)
     {
-        return true;
+        return sal_True;
     }
     else
     {
-           throw SQLException("Firebird doesn't support first()", *this, OUString(), 0, Any());
+        ::dbtools::throwFunctionNotSupportedException("first not supported in firebird",
+                                                      *this);
+        return sal_False;
     }
 }
 
 sal_Bool SAL_CALL OResultSet::last() throw(SQLException, RuntimeException)
 {
     // We need to iterate past the last row to know when we've passed the last
-    // row, so we can't actually move to last.
-        throw SQLException("Firebird doesn't support last()", *this, OUString(), 0, Any());
+    // row, hence we can't actually move to last.
+    ::dbtools::throwFunctionNotSupportedException("last not supported in firebird",
+                                                  *this);
+    return sal_False;
 }
 
 sal_Bool SAL_CALL OResultSet::absolute(sal_Int32 aRow) throw(SQLException, RuntimeException)
@@ -240,8 +248,9 @@ sal_Bool SAL_CALL OResultSet::absolute(sal_Int32 aRow) throw(SQLException, Runti
     }
     else
     {
-        throw SQLException("Firebird doesn't support retrieval of rows before the current row",
-                            *this, OUString(), 0, Any());
+        ::dbtools::throwFunctionNotSupportedException("absolute not supported in firebird",
+                                                      *this);
+        return sal_False;
     }
 }
 
@@ -261,8 +270,9 @@ sal_Bool SAL_CALL OResultSet::relative(sal_Int32 row) throw(SQLException, Runtim
     }
     else
     {
-        throw SQLException("Firebird doesn't support relative() for a negative offset",
-                           *this, OUString(), 0, Any());
+        ::dbtools::throwFunctionNotSupportedException("relative not supported in firebird",
+                                                      *this);
+        return sal_False;
     }
 }
 
@@ -419,7 +429,17 @@ T OResultSet::safelyRetrieveValue(sal_Int32 columnIndex)
 
     return retrieveValue< T >(columnIndex);
 }
-// ---- Simple Numerical types -----------------------------------------------
+
+// ---- XRow -----------------------------------------------------------------
+sal_Bool SAL_CALL OResultSet::wasNull() throw(SQLException, RuntimeException)
+{
+    MutexGuard aGuard(m_pConnection->getMutex());
+    checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
+
+    return m_bWasNull;
+}
+
+// ---- XRow: Simple Numerical types ------------------------------------------
 sal_Bool SAL_CALL OResultSet::getBoolean(sal_Int32 columnIndex)
     throw(SQLException, RuntimeException)
 {
@@ -475,7 +495,7 @@ double SAL_CALL OResultSet::getDouble(sal_Int32 columnIndex)
 //     return safelyRetrieveValue(columnIndex);
 }
 
-// ---- More complex types ---------------------------------------------------
+// ---- XRow: More complex types ----------------------------------------------
 OUString SAL_CALL OResultSet::getString(sal_Int32 columnIndex)
     throw(SQLException, RuntimeException)
 {
@@ -608,44 +628,31 @@ uno::Reference< XInterface > SAL_CALL OResultSet::getStatement()
 
     return m_xStatement;
 }
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::rowDeleted(  ) throw(SQLException, RuntimeException)
+//----- XResultSet: unsupported change detection methods ---------------------
+sal_Bool SAL_CALL OResultSet::rowDeleted() throw(SQLException, RuntimeException)
 {
-    MutexGuard aGuard(m_pConnection->getMutex());
-    checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
+    ::dbtools::throwFunctionNotSupportedException("rowDeleted not supported in firebird",
+                                                  *this);
     return sal_False;
 }
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowInserted(  ) throw(SQLException, RuntimeException)
+sal_Bool SAL_CALL OResultSet::rowInserted() throw(SQLException, RuntimeException)
 {
-    MutexGuard aGuard(m_pConnection->getMutex());
-    checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
+    ::dbtools::throwFunctionNotSupportedException("rowInserted not supported in firebird",
+                                                  *this);
     return sal_False;
 }
-// -------------------------------------------------------------------------
-sal_Bool SAL_CALL OResultSet::rowUpdated(  ) throw(SQLException, RuntimeException)
-{
-    MutexGuard aGuard(m_pConnection->getMutex());
-    checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
 
+sal_Bool SAL_CALL OResultSet::rowUpdated() throw(SQLException, RuntimeException)
+{
+    ::dbtools::throwFunctionNotSupportedException("rowUpdated not supported in firebird",
+                                                  *this);
     return sal_False;
 }
 
-// -------------------------------------------------------------------------
-
-sal_Bool SAL_CALL OResultSet::wasNull(  ) throw(SQLException, RuntimeException)
+void SAL_CALL OResultSet::refreshRow() throw(SQLException, RuntimeException)
 {
-    MutexGuard aGuard(m_pConnection->getMutex());
-    checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
-
-
-    return m_bWasNull;
+    ::dbtools::throwFunctionNotSupportedException("refreshRow not supported in firebird",
+                                                  *this);
 }
 // -------------------------------------------------------------------------
 
@@ -655,21 +662,19 @@ void SAL_CALL OResultSet::cancel(  ) throw(RuntimeException)
     checkDisposed(OResultSet_BASE::rBHelper.bDisposed);
 
 }
-// -------------------------------------------------------------------------
-void SAL_CALL OResultSet::clearWarnings(  ) throw(SQLException, RuntimeException)
-{
-}
-// -------------------------------------------------------------------------
-Any SAL_CALL OResultSet::getWarnings(  ) throw(SQLException, RuntimeException)
+
+//----- XWarningsSupplier UNSUPPORTED -----------------------------------------
+void SAL_CALL OResultSet::clearWarnings() throw(SQLException, RuntimeException)
 {
-    return Any();
+    ::dbtools::throwFunctionNotSupportedException("clearWarnings not supported in firebird",
+                                                  *this);
 }
 
-void SAL_CALL OResultSet::refreshRow() throw(SQLException, RuntimeException)
+Any SAL_CALL OResultSet::getWarnings() throw(SQLException, RuntimeException)
 {
-    ::dbtools::throwFunctionNotSupportedException("refreshRow not supported in firebird",
-                                                  *this,
-                                                  Any());
+    ::dbtools::throwFunctionNotSupportedException("getWarnings not supported in firebird",
+                                                  *this);
+    return Any();
 }
 
 //----- OIdPropertyArrayUsageHelper ------------------------------------------
@@ -699,7 +704,6 @@ uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OResultSet:
 {
     return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
 }
-// -----------------------------------------------------------------------------
 
 // ---- XServiceInfo -----------------------------------------------------------
 OUString SAL_CALL OResultSet::getImplementationName() throw ( RuntimeException)


More information about the Libreoffice-commits mailing list