[Libreoffice-commits] core.git: 5 commits - connectivity/Library_firebird_sdbc.mk connectivity/source

Andrzej J.R. Hunt andrzej at ahunt.org
Fri Sep 6 13:29:22 PDT 2013


 connectivity/Library_firebird_sdbc.mk                      |    1 
 connectivity/source/drivers/firebird/Connection.cxx        |   16 ++--
 connectivity/source/drivers/firebird/DatabaseMetaData.cxx  |   44 ++++--------
 connectivity/source/drivers/firebird/Indexes.cxx           |   33 +++++++++
 connectivity/source/drivers/firebird/Indexes.hxx           |   45 +++++++++++++
 connectivity/source/drivers/firebird/PreparedStatement.cxx |    7 --
 connectivity/source/drivers/firebird/ResultSet.cxx         |    8 --
 connectivity/source/drivers/firebird/Table.cxx             |    8 +-
 8 files changed, 110 insertions(+), 52 deletions(-)

New commits:
commit 0dbe580f0f4055eaf215e1fa5f1120657738eaad
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Fri Sep 6 21:12:57 2013 +0100

    Some stylistic cleanup in PreparedStatement.
    
    Change-Id: Idaddaeff58fa9433c678e7913435ad81bd615934

diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx
index 9e05311..f23871c 100644
--- a/connectivity/source/drivers/firebird/PreparedStatement.cxx
+++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx
@@ -309,10 +309,9 @@ Reference< XResultSet > SAL_CALL OPreparedStatement::executeQuery()
 }
 
 //----- XParameters -----------------------------------------------------------
-void SAL_CALL OPreparedStatement::setNull(sal_Int32 nIndex, sal_Int32 nSqlType)
+void SAL_CALL OPreparedStatement::setNull(sal_Int32 nIndex, sal_Int32 /*nSqlType*/)
     throw(SQLException, RuntimeException)
 {
-    (void) nSqlType;
     MutexGuard aGuard( m_pConnection->getMutex() );
     checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed);
 
@@ -350,11 +349,9 @@ void OPreparedStatement::setValue(sal_Int32 nIndex, T& nValue, ISC_SHORT nType)
     memcpy(pVar->sqldata, &nValue, sizeof(nValue));
 }
 
-void SAL_CALL OPreparedStatement::setByte(sal_Int32 nIndex, sal_Int8 nValue)
+void SAL_CALL OPreparedStatement::setByte(sal_Int32 /*nIndex*/, sal_Int8 /*nValue*/)
     throw(SQLException, RuntimeException)
 {
-    (void) nIndex;
-    (void) nValue;
     ::dbtools::throwFunctionNotSupportedException("setByte not supported in firebird",
                                                   *this,
                                                   Any());
commit 1e7ce14b7f104459ee06c472fcc6af39fa4a9750
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Fri Sep 6 21:10:05 2013 +0100

    Use throwFunctionNotSupportedException as appropriate. (firebird-sdbc)
    
    Change-Id: Ia2eb42ea2bf0f70a6d1fef29438a43a7a2f69388

diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx
index 9f5b003..b88420f 100644
--- a/connectivity/source/drivers/firebird/Connection.cxx
+++ b/connectivity/source/drivers/firebird/Connection.cxx
@@ -565,16 +565,16 @@ sal_Bool SAL_CALL OConnection::isReadOnly() throw(SQLException, RuntimeException
     return m_bReadOnly;
 }
 
-void SAL_CALL OConnection::setCatalog(const OUString& catalog)
-                                            throw(SQLException, RuntimeException)
+void SAL_CALL OConnection::setCatalog(const OUString& /*catalog*/)
+    throw(SQLException, RuntimeException)
 {
-    ::dbtools::throwFeatureNotImplementedException( "XConnection::setCatalog", *this );
-    (void) catalog;
+    ::dbtools::throwFunctionNotSupportedException("setCatalog", *this);
 }
 
-OUString SAL_CALL OConnection::getCatalog() throw(SQLException, RuntimeException)
+OUString SAL_CALL OConnection::getCatalog()
+    throw(SQLException, RuntimeException)
 {
-    // Unsupported
+    ::dbtools::throwFunctionNotSupportedException("getCatalog", *this);
     return OUString();
 }
 
@@ -667,9 +667,9 @@ void SAL_CALL OConnection::documentEventOccured( const DocumentEvent& _Event )
     }
 }
 // XEventListener
-void SAL_CALL OConnection::disposing( const EventObject& Source ) throw (RuntimeException)
+void SAL_CALL OConnection::disposing(const EventObject& /*rSource*/)
+    throw (RuntimeException)
 {
-    (void) Source;
 }
 //--------------------------------------------------------------------
 void OConnection::buildTypeInfo() throw( SQLException)
commit 79eae295dd40a34e55c4a0a9e870183d78070655
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Fri Sep 6 21:03:10 2013 +0100

    Comment out unused parameters instead of (void) cast. (firebird-sdbc)
    
    Firebird doesn't support catalogs or schemas hence these parameters
    are unused in the various get[...] methods. Previously these were (void)
    casted however commenting out the parameters seems more correct and reduces
    the amount of code.
    
    (This was omitted for as-of-yet unimplemented methods since they will still
     be looked at in detail.)
    
    Change-Id: Ic6566ff0b3e873b802deec79d5497efdd21e577d

diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index 0f86ad5..19f66d5 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -1031,15 +1031,12 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
-        const Any& aCatalog,
-        const OUString& sSchema,
+        const Any& /*aCatalog*/,
+        const OUString& /*sSchema*/,
         const OUString& sTable,
         const OUString& sColumnNamePattern)
     throw(SQLException, RuntimeException)
 {
-    (void) aCatalog;
-    (void) sSchema;
-
     SAL_INFO("connectivity.firebird", "getColumnPrivileges() with "
              "Table: " << sTable
              << " & ColumnNamePattern: " << sColumnNamePattern);
@@ -1109,14 +1106,12 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
-        const Any& catalog,
-        const OUString& schemaPattern,
+        const Any& /*catalog*/,
+        const OUString& /*schemaPattern*/,
         const OUString& tableNamePattern,
         const OUString& columnNamePattern)
     throw(SQLException, RuntimeException)
 {
-    (void) catalog;         // Unsupported in firebird
-    (void) schemaPattern;   // Unsupported in firebird
     SAL_INFO("connectivity.firebird", "getColumns() with "
              "TableNamePattern: " << tableNamePattern <<
              " & ColumnNamePattern: " << columnNamePattern);
@@ -1298,15 +1293,12 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
-        const Any& catalog,
-        const OUString& schemaPattern,
+        const Any& /*catalog*/,
+        const OUString& /*schemaPattern*/,
         const OUString& tableNamePattern,
         const Sequence< OUString >& types)
     throw(SQLException, RuntimeException)
 {
-    (void) catalog;
-    (void) schemaPattern;
-
     SAL_INFO("connectivity.firebird", "getTables() with "
              "TableNamePattern: " << tableNamePattern);
 
@@ -1488,13 +1480,11 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
-        const Any& aCatalog,
-        const OUString& sSchema,
+        const Any& /*aCatalog*/,
+        const OUString& /*sSchema*/,
         const OUString& sTable)
     throw(SQLException, RuntimeException)
 {
-    (void) aCatalog;
-    (void) sSchema;
     SAL_INFO("connectivity.firebird", "getPrimaryKeys() with "
              "Table: " << sTable);
 
@@ -1551,17 +1541,16 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
-        const Any& aCatalog, const OUString& sSchema, const OUString& sTable,
-        sal_Bool bIsUnique, sal_Bool bIsApproximate)
+        const Any& /*aCatalog*/,
+        const OUString& /*sSchema*/,
+        const OUString& sTable,
+        sal_Bool bIsUnique,
+        sal_Bool bIsApproximate)
     throw(SQLException, RuntimeException)
 {
-    (void) aCatalog;
-    (void) sSchema;
-
     // Apparently this method can also return a "tableIndexStatistic"
     // However this is only mentioned in XDatabaseMetaData.idl (whose comments
     // are duplicated in the postgresql driver), and is otherwise undocumented.
-
     SAL_INFO("connectivity.firebird", "getPrimaryKeys() with "
              "Table: " << sTable);
 
@@ -1658,14 +1647,11 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
-        const Any& aCatalog,
-        const OUString& sSchemaPattern,
+        const Any& /*aCatalog*/,
+        const OUString& /*sSchemaPattern*/,
         const OUString& sTableNamePattern)
     throw(SQLException, RuntimeException)
 {
-    (void) aCatalog;
-    (void) sSchemaPattern;
-
     SAL_INFO("connectivity.firebird", "getTablePrivileges() with "
              "TableNamePattern: " << sTableNamePattern);
 
commit cf9a6e84f5ffc4fe4a8273e8fdb6550b64c78732
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Fri Sep 6 20:55:56 2013 +0100

    Implement set[Float|Double]. (firebird-sdbc)
    
    This commit somehow got lost on my old computer, so here it is
    recreated.
    
    Change-Id: Ib4001a21c92976fe0e3dea3778360ff67cbfa3a9

diff --git a/connectivity/source/drivers/firebird/ResultSet.cxx b/connectivity/source/drivers/firebird/ResultSet.cxx
index a342fb1..a33460b 100644
--- a/connectivity/source/drivers/firebird/ResultSet.cxx
+++ b/connectivity/source/drivers/firebird/ResultSet.cxx
@@ -482,17 +482,13 @@ sal_Int64 SAL_CALL OResultSet::getLong(sal_Int32 columnIndex)
 float SAL_CALL OResultSet::getFloat(sal_Int32 columnIndex)
     throw(SQLException, RuntimeException)
 {
-    (void) columnIndex;
-    return 0.0f; // TODO: implement
-//     return safelyRetrieveValue(columnIndex);
+    return safelyRetrieveValue< float >(columnIndex);
 }
 
 double SAL_CALL OResultSet::getDouble(sal_Int32 columnIndex)
     throw(SQLException, RuntimeException)
 {
-    (void) columnIndex;
-    return 0.0; // TODO: implement
-//     return safelyRetrieveValue(columnIndex);
+    return safelyRetrieveValue< double >(columnIndex);
 }
 
 // ---- XRow: More complex types ----------------------------------------------
commit 22576cf6d883f0708560f403c2f05b318c0eab14
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Fri Sep 6 11:34:09 2013 +0100

    Extend OIndexesHelper::dropObject to use correct DROP INDEX. (firebird-sdbc)
    
    Firebird's DROP INDEX statements only need to contain the index name, including
    the table name causes an error.
    
    Change-Id: I5b61d82bda7176148f7849e31bd050e025f84e02

diff --git a/connectivity/Library_firebird_sdbc.mk b/connectivity/Library_firebird_sdbc.mk
index 2391349..b1fbf79 100644
--- a/connectivity/Library_firebird_sdbc.mk
+++ b/connectivity/Library_firebird_sdbc.mk
@@ -43,6 +43,7 @@ $(eval $(call gb_Library_add_exception_objects,firebird_sdbc,\
     connectivity/source/drivers/firebird/Connection \
     connectivity/source/drivers/firebird/DatabaseMetaData \
     connectivity/source/drivers/firebird/Driver \
+    connectivity/source/drivers/firebird/Indexes \
     connectivity/source/drivers/firebird/Keys \
     connectivity/source/drivers/firebird/PreparedStatement \
     connectivity/source/drivers/firebird/ResultSet \
diff --git a/connectivity/source/drivers/firebird/Indexes.cxx b/connectivity/source/drivers/firebird/Indexes.cxx
new file mode 100644
index 0000000..fc03272
--- /dev/null
+++ b/connectivity/source/drivers/firebird/Indexes.cxx
@@ -0,0 +1,33 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include "Indexes.hxx"
+
+using namespace ::connectivity;
+using namespace ::connectivity::firebird;
+
+using namespace ::osl;
+using namespace ::rtl;
+using namespace ::std;
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::sdbc;
+
+Indexes::Indexes(Table* pTable, Mutex& rMutex, const vector< OUString>& rVector)
+    : OIndexesHelper(pTable, rMutex, rVector)
+    , m_pTable(pTable)
+{
+}
+
+// XDrop
+void Indexes::dropObject(sal_Int32 /*nPosition*/, const OUString sIndexName)
+{
+    OUString sSql("DROP INDEX \"" + sIndexName +"\"");
+    m_pTable->getConnection()->createStatement()->execute(sSql);
+}
\ No newline at end of file
diff --git a/connectivity/source/drivers/firebird/Indexes.hxx b/connectivity/source/drivers/firebird/Indexes.hxx
new file mode 100644
index 0000000..32d035c
--- /dev/null
+++ b/connectivity/source/drivers/firebird/Indexes.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef CONNECTIVITY_FIREBIRD_INDEXES_HXX
+#define CONNECTIVITY_FIREBIRD_INDEXES_HXX
+
+#include "Table.hxx"
+
+#include <connectivity/TIndexes.hxx>
+
+namespace connectivity
+{
+    namespace firebird
+    {
+
+        /**
+         * Firebird has a non-standard DROP INDEX statement, hence we need
+         * to override OIndexesHelper::dropObject
+         */
+        class Indexes: public ::connectivity::OIndexesHelper
+        {
+        private:
+            Table* m_pTable;
+        protected:
+            // XDrop
+            virtual void dropObject(sal_Int32 nPosition,
+                                    const ::rtl::OUString sIndexName);
+        public:
+            Indexes(Table* pTable,
+                    ::osl::Mutex& rMutex,
+                    const ::std::vector< ::rtl::OUString>& rVector);
+        };
+
+    } // namespace firebird
+} // namespace connectivity
+
+#endif // CONNECTIVITY_FIREBIRD_INDEXES_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/firebird/Table.cxx b/connectivity/source/drivers/firebird/Table.cxx
index 98e446b..2b9d578 100644
--- a/connectivity/source/drivers/firebird/Table.cxx
+++ b/connectivity/source/drivers/firebird/Table.cxx
@@ -8,6 +8,7 @@
  */
 
 #include "Columns.hxx"
+#include "Indexes.hxx"
 #include "Keys.hxx"
 #include "Table.hxx"
 
@@ -15,7 +16,6 @@
 
 #include <comphelper/sequence.hxx>
 #include <connectivity/dbtools.hxx>
-#include <connectivity/TIndexes.hxx>
 
 #include <com/sun/star/sdbc/ColumnValue.hpp>
 #include <com/sun/star/sdbcx/Privilege.hpp>
@@ -105,9 +105,9 @@ OCollection* Table::createKeys(const TStringVector& rNames)
 
 OCollection* Table::createIndexes(const TStringVector& rNames)
 {
-    return new OIndexesHelper(this,
-                              m_rMutex,
-                              rNames);
+    return new Indexes(this,
+                       m_rMutex,
+                       rNames);
 }
 
 //----- XAlterTable -----------------------------------------------------------


More information about the Libreoffice-commits mailing list