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

Andrzej J.R. Hunt andrzej at ahunt.org
Mon Jul 22 02:06:49 PDT 2013


 connectivity/Library_firebird_sdbc.mk                       |    1 
 connectivity/source/drivers/firebird/FDatabaseMetaData.cxx  |  296 +++++++++---
 connectivity/source/drivers/firebird/FResultSetMetaData.cxx |   87 ---
 connectivity/source/drivers/firebird/Util.cxx               |  151 ++++++
 connectivity/source/drivers/firebird/Util.hxx               |   35 +
 5 files changed, 430 insertions(+), 140 deletions(-)

New commits:
commit 074ef06c908af1e5c6922a0c8ff9ccc9a9d54063
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Mon Jul 22 10:49:37 2013 +0200

    Implement getColumns() (firebird-sdbc).
    
    Change-Id: I07e9af5e049d58dc794cad4481a2f4e2b1fe547d

diff --git a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
index 38f61a1..c6e33c9 100644
--- a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
@@ -35,10 +35,12 @@
 
 #include "FDatabaseMetaData.hxx"
 #include "FDatabaseMetaDataResultSet.hxx"
+#include "Util.hxx"
 
 #include <ibase.h>
 #include <rtl/ustrbuf.hxx>
 
+#include <com/sun/star/sdbc/ColumnValue.hpp>
 #include <com/sun/star/sdbc/DataType.hpp>
 #include <com/sun/star/sdbc/ResultSetType.hpp>
 #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
@@ -849,18 +851,193 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
     (void) columnNamePattern;
     return NULL;
 }
-// -------------------------------------------------------------------------
+
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
-    const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern,
-    const OUString& columnNamePattern ) throw(SQLException, RuntimeException)
+        const Any& catalog,
+        const OUString& schemaPattern,
+        const OUString& tableNamePattern,
+        const OUString& columnNamePattern)
+    throw(SQLException, RuntimeException)
 {
-    (void) catalog;
-    (void) schemaPattern;
-    (void) tableNamePattern;
-    (void) columnNamePattern;
-    return NULL;
+    (void) catalog;         // Unsupported in firebird
+    (void) schemaPattern;   // Unsupported in firebird
+    SAL_INFO("connectivity.firebird", "getColumns() with "
+             "TableNamePattern: " << tableNamePattern <<
+             " & ColumnNamePattern: " << columnNamePattern);
+
+    OUStringBuffer queryBuf("SELECT "
+        "relfields.RDB$RELATION_NAME, " // 1
+        "relfields.RDB$FIELD_NAME, "    // 2
+        "relfields.RDB$DESCRIPTION,"    // 3
+        "relfields.RDB$DEFAULT_VALUE, " // 4
+        "relfields.RDB$FIELD_POSITION, "// 5
+        "fields.RDB$FIELD_TYPE, "       // 6
+        "fields.RDB$FIELD_LENGTH, "     // 7
+        "fields.RDB$FIELD_PRECISION, "  // 8
+        "fields.RDB$NULL_FLAG "         // 9
+        "FROM RDB$RELATION_FIELDS relfields "
+        "JOIN RDB$FIELDS fields "
+        "on (relfields.RDB$FIELD_NAME = fields.RDB$FIELD_NAME) ");
+
+    if (!tableNamePattern.isEmpty())
+    {
+        OUString sAppend;
+        if (tableNamePattern.match("%"))
+            sAppend = "AND RDB$RELATION_NAME LIKE '%' ";
+        else
+            sAppend = "AND RDB$RELATION_NAME = '%' ";
+
+        queryBuf.append(sAppend.replaceAll("%", tableNamePattern));
+    }
+
+    if (!columnNamePattern.isEmpty())
+    {
+        OUString sAppend;
+        if (columnNamePattern.match("%"))
+            sAppend = "AND RDB$FIELD_NAME LIKE '%' ";
+        else
+            sAppend = "AND RDB$FIELD_NAME = '%' ";
+
+        queryBuf.append(sAppend.replaceAll("%", columnNamePattern));
+    }
+
+    OUString query = queryBuf.makeStringAndClear();
+
+    uno::Reference< XStatement > statement = m_pConnection->createStatement();
+    uno::Reference< XResultSet > rs = statement->executeQuery(query.getStr());
+    uno::Reference< XRow > xRow( rs, UNO_QUERY_THROW );
+
+    ODatabaseMetaDataResultSet::ORows aResults;
+
+    while( rs->next() )
+    {
+        ODatabaseMetaDataResultSet::ORow aCurrentRow(16);
+
+        // 1. TABLE_CAT (catalog) may be null -- thus we omit it.
+        // 2. TABLE_SCHEM (schema) may be null -- thus we omit it.
+        // 3. TABLE_NAME
+        {
+            OUString aTableName = xRow->getString(1);
+            aCurrentRow.push_back(new ORowSetValueDecorator(aTableName));
+        }
+        // 4. Column Name
+        {
+            OUString aColumnName = xRow->getString(2);
+            aCurrentRow.push_back(new ORowSetValueDecorator(aColumnName));
+        }
+
+        // 5. Datatype
+        short aType = getFBTypeFromBlrType(xRow->getShort(6));
+        aCurrentRow.push_back(new ORowSetValueDecorator(getColumnTypeFromFBType(aType)));
+        // 6. Typename (SQL_*)
+        aCurrentRow.push_back(new ORowSetValueDecorator(getColumnTypeNameFromFBType(aType)));
+
+        // 7. Column Sizes
+        {
+            sal_Int32 aColumnSize = 0;
+            switch (aType)
+            {
+                case SQL_TEXT:
+                case SQL_VARYING:
+                    aColumnSize = xRow->getShort(7);
+                    break;
+                case SQL_SHORT:
+                case SQL_LONG:
+                case SQL_FLOAT:
+                case SQL_DOUBLE:
+                case SQL_D_FLOAT:
+                case SQL_INT64:
+                case SQL_QUAD:
+                    aColumnSize = xRow->getShort(8);
+                    break;
+                case SQL_TIMESTAMP:
+                case SQL_BLOB:
+                case SQL_ARRAY:
+                case SQL_TYPE_TIME:
+                case SQL_TYPE_DATE:
+                case SQL_NULL:
+                    // TODO: implement.
+                    break;
+            }
+            aCurrentRow.push_back(new ORowSetValueDecorator(aColumnSize));
+        }
+        // 8. Unused
+        aCurrentRow.push_back(new ORowSetValueDecorator());
+        // 9. Decimal Digits
+        // TODO: implement
+        aCurrentRow.push_back(new ORowSetValueDecorator(0));
+        // 10. Radix
+        aCurrentRow.push_back(new ORowSetValueDecorator(10));
+        // 11. Nullable
+        if (xRow->getShort(9))
+        {
+            aCurrentRow.push_back(new ORowSetValueDecorator(ColumnValue::NO_NULLS));
+        }
+        else
+        {
+            aCurrentRow.push_back(new ORowSetValueDecorator(ColumnValue::NULLABLE));
+        }
+        // 12. Comments -- may be omitted
+        {
+            uno::Reference< XBlob > xDescriptionBlob = xRow->getBlob(3);
+            if (xDescriptionBlob.is())
+            {
+                sal_Int32 aBlobLength = (sal_Int32) xDescriptionBlob->length();
+                OUString aDescription = OUString((char*) xDescriptionBlob->getBytes(0, aBlobLength).getArray(),
+                                        aBlobLength,
+                                        RTL_TEXTENCODING_UTF8);
+                aCurrentRow.push_back(new ORowSetValueDecorator(aDescription));
+            }
+        }
+        // 13. Default --  may be omitted.
+        {
+            uno::Reference< XBlob > xDefaultValueBlob = xRow->getBlob(4);
+            if (xDefaultValueBlob.is())
+            {
+                // TODO: push to back
+            }
+        }
+        // 14. Unused
+        aCurrentRow.push_back(new ORowSetValueDecorator());
+        // 15. Unused
+        aCurrentRow.push_back(new ORowSetValueDecorator());
+        // 16. Bytes in Column for char
+        if (aType == SQL_TEXT)
+        {
+            aCurrentRow.push_back(new ORowSetValueDecorator(xRow->getShort(7)));
+        }
+        else if (aType == SQL_VARYING)
+        {
+            aCurrentRow.push_back(new ORowSetValueDecorator(32767));
+        }
+        else
+        {
+            aCurrentRow.push_back(new ORowSetValueDecorator(0));
+        }
+        // 17. Index in column
+        {
+            short aColumnNumber = xRow->getShort(5);
+            aCurrentRow.push_back(new ORowSetValueDecorator(aColumnNumber));
+        }
+        // 18. Is nullable
+        if (xRow->getShort(9))
+        {
+            aCurrentRow.push_back(new ORowSetValueDecorator("NO"));
+        }
+        else
+        {
+            aCurrentRow.push_back(new ORowSetValueDecorator("YES"));
+        }
+
+        aResults.push_back(aCurrentRow);
+    }
+    ODatabaseMetaDataResultSet* pResultSet = new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
+    uno::Reference< XResultSet > xResultSet = pResultSet;
+    pResultSet->setRows( aResults );
+
+    return xResultSet;
 }
-// -------------------------------------------------------------------------
+
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
         const Any& catalog,
         const OUString& schemaPattern,
@@ -880,7 +1057,6 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
     uno::Reference< XStatement > statement = m_pConnection->createStatement();
 
     static const OUString wld("%");
-    // TODO: OUStringBuf
     OUStringBuffer queryBuf(
             "SELECT "
             "RDB$RELATION_NAME, RDB$SYSTEM_FLAG, RDB$RELATION_TYPE, "
commit 76fc51223f171dfc9f7752c4a3ebb97070f1f38a
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Mon Jul 22 10:35:26 2013 +0200

    Fix blr type conversion.
    
    Change-Id: Ie2ed26110c944c27f767d818139d8526e278f33d

diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx
index c41dde2..0c23495 100644
--- a/connectivity/source/drivers/firebird/Util.cxx
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -101,7 +101,7 @@ OUString firebird::getColumnTypeNameFromFBType(short aType)
     }
 }
 
-short getFBTypeFromBlrType(short blrType)
+short firebird::getFBTypeFromBlrType(short blrType)
 {
     switch (blrType)
     {
commit c729e75129ed5de9b8e8044a9fe071ade621dc93
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Mon Jul 22 09:30:30 2013 +0200

    Add conversion of blr types to firebird SQL_ types.
    
    Internally firebird uses blr_* types -- we encounter these values e.g.
    when retrieving column metadata within RDB$FIELD_TYPE. These can
    be converted to the firebird SQL_* types for use within the rest
    of the driver as appropriate.
    
    Change-Id: If9a9bc3c58d99a2f61f52faef6316e2d3451af1a

diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx
index 5fd08e3..c41dde2 100644
--- a/connectivity/source/drivers/firebird/Util.cxx
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -17,7 +17,7 @@ using namespace ::rtl;
 
 using namespace ::com::sun::star::sdbc;
 
-sal_Int32 firebird::getColumnTypeFromFBType(int aType)
+sal_Int32 firebird::getColumnTypeFromFBType(short aType)
 {
     aType &= ~1; // Remove last bit -- it is used to denote whether column
                  // can store Null, not needed for type determination
@@ -59,7 +59,7 @@ sal_Int32 firebird::getColumnTypeFromFBType(int aType)
     }
 }
 
-OUString firebird::getColumnTypeNameFromFBType(int aType)
+OUString firebird::getColumnTypeNameFromFBType(short aType)
 {
     aType &= ~1; // Remove last bit -- it is used to denote whether column
                 // can store Null, not needed for type determination
@@ -101,4 +101,51 @@ OUString firebird::getColumnTypeNameFromFBType(int aType)
     }
 }
 
+short getFBTypeFromBlrType(short blrType)
+{
+    switch (blrType)
+    {
+    case blr_text:
+        return SQL_TEXT;
+    case blr_text2:
+        assert(false);
+        return 0; // No idea if this should be supported
+    case blr_varying:
+        return SQL_VARYING;
+    case blr_varying2:
+        assert(false);
+        return 0; // No idea if this should be supported
+    case blr_short:
+        return SQL_SHORT;
+    case blr_long:
+        return SQL_LONG;
+    case blr_float:
+        return SQL_FLOAT;
+    case blr_double:
+        return SQL_DOUBLE;
+    case blr_d_float:
+        return SQL_D_FLOAT;
+    case blr_timestamp:
+        return SQL_TIMESTAMP;
+    case blr_blob:
+        return SQL_BLOB;
+//     case blr_SQL_ARRAY:
+//         return OUString("SQL_ARRAY");
+    case blr_sql_time:
+        return SQL_TYPE_TIME;
+    case blr_sql_date:
+        return SQL_TYPE_DATE;
+    case blr_int64:
+        return SQL_INT64;
+//     case SQL_NULL:
+//         return OUString("SQL_NULL");
+    case blr_quad:
+        return SQL_QUAD;
+    default:
+        // If this happens we have hit one of the extra types in ibase.h
+        // look up blr_* for a list, e.g. blr_domain_name, blr_not_nullable etc.
+        assert(false);
+        return 0;
+    }
+}
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/connectivity/source/drivers/firebird/Util.hxx b/connectivity/source/drivers/firebird/Util.hxx
index 5324031..0d68099 100644
--- a/connectivity/source/drivers/firebird/Util.hxx
+++ b/connectivity/source/drivers/firebird/Util.hxx
@@ -18,8 +18,16 @@ namespace connectivity
 {
     namespace firebird
     {
-        sal_Int32 getColumnTypeFromFBType(int aType);
-        ::rtl::OUString getColumnTypeNameFromFBType(int aType);
+        sal_Int32 getColumnTypeFromFBType(short aType);
+        ::rtl::OUString getColumnTypeNameFromFBType(short aType);
+
+        /**
+         * Internally (i.e. in RDB$FIELD_TYPE) firebird stores the data type
+         * for a column as defined in blr_*, however in the firebird
+         * api the SQL_* types are used, hence we need to be able to convert
+         * between the two when retrieving column metadata.
+         */
+        short getFBTypeFromBlrType(short blrType);
     }
 }
 #endif //CONNECTIVITY_FIREBIRD_UTIL_HXX
commit cd21fb50b2cbc33707e08b654717a64e1f6217a6
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Mon Jul 22 09:27:34 2013 +0200

    Sql types are short within firebird.
    
    Change-Id: Iff9baf31ce06a71c6c460a7689c7bac817370b27

diff --git a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
index fe087f2..266664e 100644
--- a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
@@ -73,7 +73,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnType(sal_Int32 column)
 {
     verifyValidColumn(column);
 
-    int aType = m_pSqlda->sqlvar[column-1].sqltype;
+    short aType = m_pSqlda->sqlvar[column-1].sqltype;
 
     return getColumnTypeFromFBType(aType);
 }
@@ -122,7 +122,7 @@ OUString SAL_CALL OResultSetMetaData::getColumnTypeName(sal_Int32 column)
 {
     verifyValidColumn(column);
 
-    int aType = m_pSqlda->sqlvar[column-1].sqltype;
+    short aType = m_pSqlda->sqlvar[column-1].sqltype;
 
     return getColumnTypeNameFromFBType(aType);
 }
commit 734a30a23dd392924a1072172d61a372167529b0
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Mon Jul 22 08:36:52 2013 +0200

    Move sqltype identification into Util (firebird-sdbc).
    
    Change-Id: I2e3068bf46555fea63c62bc1abc8a467c588a8b5

diff --git a/connectivity/Library_firebird_sdbc.mk b/connectivity/Library_firebird_sdbc.mk
index e884ca8..37486da 100644
--- a/connectivity/Library_firebird_sdbc.mk
+++ b/connectivity/Library_firebird_sdbc.mk
@@ -46,6 +46,7 @@ $(eval $(call gb_Library_add_exception_objects,firebird_sdbc,\
     connectivity/source/drivers/firebird/FResultSetMetaData \
     connectivity/source/drivers/firebird/FServices \
     connectivity/source/drivers/firebird/FStatement \
+    connectivity/source/drivers/firebird/Util \
 ))
 
 # vim: set noet sw=4 ts=4:
diff --git a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
index 3c11fba..fe087f2 100644
--- a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
@@ -34,6 +34,7 @@
  *************************************************************************/
 
 #include "FResultSetMetaData.hxx"
+#include "Util.hxx"
 
 #include <com/sun/star/sdbc/ColumnValue.hpp>
 
@@ -74,44 +75,7 @@ sal_Int32 SAL_CALL OResultSetMetaData::getColumnType(sal_Int32 column)
 
     int aType = m_pSqlda->sqlvar[column-1].sqltype;
 
-    aType &= ~1; // Remove last bit -- it is used to denote whether column
-                // can store Null, not needed for type determination
-    switch (aType)
-    {
-        case SQL_TEXT:
-            return DataType::CHAR;
-        case SQL_VARYING:
-            return DataType::VARCHAR;
-        case SQL_SHORT:
-            return DataType::SMALLINT;
-        case SQL_LONG:
-            return DataType::INTEGER;
-        case SQL_FLOAT:
-            return DataType::REAL;
-        case SQL_DOUBLE:
-            return DataType::DOUBLE;
-        case SQL_D_FLOAT:
-            return DataType::FLOAT;
-        case SQL_TIMESTAMP:
-            return DataType::TIMESTAMP;
-        case SQL_BLOB:
-            return DataType::BLOB;
-        case SQL_ARRAY:
-            return DataType::ARRAY;
-        case SQL_TYPE_TIME:
-            return DataType::TIME;
-        case SQL_TYPE_DATE:
-            return DataType::DATE;
-        case SQL_INT64:
-            return DataType::BIGINT;
-        case SQL_NULL:
-            return DataType::SQLNULL;
-        case SQL_QUAD:      // Is a "Blob ID" according to the docs
-            return 0;       // TODO: verify
-        default:
-            assert(false); // Should never happen
-            return 0;
-    }
+    return getColumnTypeFromFBType(aType);
 }
 
 sal_Bool SAL_CALL OResultSetMetaData::isCaseSensitive(sal_Int32 column)
@@ -160,44 +124,7 @@ OUString SAL_CALL OResultSetMetaData::getColumnTypeName(sal_Int32 column)
 
     int aType = m_pSqlda->sqlvar[column-1].sqltype;
 
-    aType &= ~1; // Remove last bit -- it is used to denote whether column
-                // can store Null, not needed for type determination
-    switch (aType)
-    {
-        case SQL_TEXT:
-            return OUString("SQL_TEXT");
-        case SQL_VARYING:
-            return OUString("SQL_VARYING");
-        case SQL_SHORT:
-            return OUString("SQL_SHORT");
-        case SQL_LONG:
-            return OUString("SQL_LONG");
-        case SQL_FLOAT:
-            return OUString("SQL_FLOAT");
-        case SQL_DOUBLE:
-            return OUString("SQL_DOUBLE");
-        case SQL_D_FLOAT:
-            return OUString("SQL_D_FLOAT");
-        case SQL_TIMESTAMP:
-            return OUString("SQL_TIMESTAMP");
-        case SQL_BLOB:
-            return OUString("SQL_BLOB");
-        case SQL_ARRAY:
-            return OUString("SQL_ARRAY");
-        case SQL_TYPE_TIME:
-            return OUString("SQL_TYPE_TIME");
-        case SQL_TYPE_DATE:
-            return OUString("SQL_TYPE_DATE");
-        case SQL_INT64:
-            return OUString("SQL_INT64");
-        case SQL_NULL:
-            return OUString("SQL_NULL");
-        case SQL_QUAD:
-            return OUString("SQL_QUAD");
-        default:
-            assert(false); // Should never happen
-            return OUString();
-    }
+    return getColumnTypeNameFromFBType(aType);
 }
 
 OUString SAL_CALL OResultSetMetaData::getColumnLabel(sal_Int32 column)
diff --git a/connectivity/source/drivers/firebird/Util.cxx b/connectivity/source/drivers/firebird/Util.cxx
new file mode 100644
index 0000000..5fd08e3
--- /dev/null
+++ b/connectivity/source/drivers/firebird/Util.cxx
@@ -0,0 +1,104 @@
+/* -*- 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 "Util.hxx"
+
+#include <ibase.h>
+
+using namespace ::connectivity;
+
+using namespace ::rtl;
+
+using namespace ::com::sun::star::sdbc;
+
+sal_Int32 firebird::getColumnTypeFromFBType(int aType)
+{
+    aType &= ~1; // Remove last bit -- it is used to denote whether column
+                 // can store Null, not needed for type determination
+    switch (aType)
+    {
+    case SQL_TEXT:
+        return DataType::CHAR;
+    case SQL_VARYING:
+        return DataType::VARCHAR;
+    case SQL_SHORT:
+        return DataType::SMALLINT;
+    case SQL_LONG:
+        return DataType::INTEGER;
+    case SQL_FLOAT:
+        return DataType::REAL;
+    case SQL_DOUBLE:
+        return DataType::DOUBLE;
+    case SQL_D_FLOAT:
+        return DataType::FLOAT;
+    case SQL_TIMESTAMP:
+        return DataType::TIMESTAMP;
+    case SQL_BLOB:
+        return DataType::BLOB;
+    case SQL_ARRAY:
+        return DataType::ARRAY;
+    case SQL_TYPE_TIME:
+        return DataType::TIME;
+    case SQL_TYPE_DATE:
+        return DataType::DATE;
+    case SQL_INT64:
+        return DataType::BIGINT;
+    case SQL_NULL:
+        return DataType::SQLNULL;
+    case SQL_QUAD:      // Is a "Blob ID" according to the docs
+        return 0;       // TODO: verify
+    default:
+        assert(false); // Should never happen
+        return 0;
+    }
+}
+
+OUString firebird::getColumnTypeNameFromFBType(int aType)
+{
+    aType &= ~1; // Remove last bit -- it is used to denote whether column
+                // can store Null, not needed for type determination
+    switch (aType)
+    {
+    case SQL_TEXT:
+        return OUString("SQL_TEXT");
+    case SQL_VARYING:
+        return OUString("SQL_VARYING");
+    case SQL_SHORT:
+        return OUString("SQL_SHORT");
+    case SQL_LONG:
+        return OUString("SQL_LONG");
+    case SQL_FLOAT:
+        return OUString("SQL_FLOAT");
+    case SQL_DOUBLE:
+        return OUString("SQL_DOUBLE");
+    case SQL_D_FLOAT:
+        return OUString("SQL_D_FLOAT");
+    case SQL_TIMESTAMP:
+        return OUString("SQL_TIMESTAMP");
+    case SQL_BLOB:
+        return OUString("SQL_BLOB");
+    case SQL_ARRAY:
+        return OUString("SQL_ARRAY");
+    case SQL_TYPE_TIME:
+        return OUString("SQL_TYPE_TIME");
+    case SQL_TYPE_DATE:
+        return OUString("SQL_TYPE_DATE");
+    case SQL_INT64:
+        return OUString("SQL_INT64");
+    case SQL_NULL:
+        return OUString("SQL_NULL");
+    case SQL_QUAD:
+        return OUString("SQL_QUAD");
+    default:
+        assert(false); // Should never happen
+        return OUString();
+    }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
diff --git a/connectivity/source/drivers/firebird/Util.hxx b/connectivity/source/drivers/firebird/Util.hxx
new file mode 100644
index 0000000..5324031
--- /dev/null
+++ b/connectivity/source/drivers/firebird/Util.hxx
@@ -0,0 +1,27 @@
+/* -*- 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_UTIL_HXX
+#define CONNECTIVITY_FIREBIRD_UTIL_HXX
+
+#include <rtl/ustring.hxx>
+
+#include <com/sun/star/sdbc/DataType.hpp>
+
+namespace connectivity
+{
+    namespace firebird
+    {
+        sal_Int32 getColumnTypeFromFBType(int aType);
+        ::rtl::OUString getColumnTypeNameFromFBType(int aType);
+    }
+}
+#endif //CONNECTIVITY_FIREBIRD_UTIL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
\ No newline at end of file
commit abc147410e92f165ec27067e678c75667ede31f1
Author: Andrzej J.R. Hunt <andrzej at ahunt.org>
Date:   Sun Jul 21 20:38:58 2013 +0200

    rtl::OUString prefix cleanup FDatabaseMetaData (firebird-sdbc).
    
    Change-Id: I210ff31a69c7dc1d5bc3478d6494ad3c0959904f

diff --git a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
index 6745046..38f61a1 100644
--- a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
@@ -246,16 +246,16 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns(  ) throw(SQLExc
     return sal_False;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getIdentifierQuoteString(  ) throw(SQLException, RuntimeException)
 {
     // normally this is "
-    ::rtl::OUString aVal("\"");
+    OUString aVal("\"");
     return aVal;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters(  ) throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aVal;
+    OUString aVal;
     return aVal;
 }
 // -------------------------------------------------------------------------
@@ -567,45 +567,45 @@ OUString SAL_CALL ODatabaseMetaData::getURL() throw(SQLException, RuntimeExcepti
     return m_pConnection->getConnectionURL();
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getUserName(  ) throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aValue;
+    OUString aValue;
     return aValue;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getDriverName(  ) throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aValue;
+    OUString aValue;
     return aValue;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getDriverVersion() throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aValue;
+    OUString aValue;
     return aValue;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion(  ) throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aValue;
+    OUString aValue;
     return aValue;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName(  ) throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aValue;
+    OUString aValue;
     return aValue;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getProcedureTerm(  ) throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aValue;
+    OUString aValue;
     return aValue;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getSchemaTerm(  ) throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aValue;
+    OUString aValue;
     return aValue;
 }
 // -------------------------------------------------------------------------
@@ -624,36 +624,36 @@ sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion(  ) throw(RuntimeExc
     return 0;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getSQLKeywords(  ) throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aValue;
+    OUString aValue;
     return aValue;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape(  ) throw(SQLException, RuntimeException)
 {
-    ::rtl::OUString aValue;
+    OUString aValue;
     return aValue;
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getStringFunctions(  ) throw(SQLException, RuntimeException)
 {
-    return ::rtl::OUString();
+    return OUString();
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions(  ) throw(SQLException, RuntimeException)
 {
-    return ::rtl::OUString();
+    return OUString();
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getSystemFunctions(  ) throw(SQLException, RuntimeException)
 {
-    return ::rtl::OUString();
+    return OUString();
 }
 // -------------------------------------------------------------------------
-::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions(  ) throw(SQLException, RuntimeException)
+OUString SAL_CALL ODatabaseMetaData::getNumericFunctions(  ) throw(SQLException, RuntimeException)
 {
-    return ::rtl::OUString();
+    return OUString();
 }
 // -------------------------------------------------------------------------
 sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar(  ) throw(SQLException, RuntimeException)
@@ -840,8 +840,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas(  ) throw(SQ
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
-    const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
-    const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
+    const Any& catalog, const OUString& schema, const OUString& table,
+    const OUString& columnNamePattern ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schema;
@@ -851,8 +851,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
-    const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern,
-    const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
+    const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern,
+    const OUString& columnNamePattern ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schemaPattern;
@@ -863,9 +863,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
         const Any& catalog,
-        const ::rtl::OUString& schemaPattern,
-        const ::rtl::OUString& tableNamePattern,
-        const Sequence< ::rtl::OUString >& types)
+        const OUString& schemaPattern,
+        const OUString& tableNamePattern,
+        const Sequence< OUString >& types)
     throw(SQLException, RuntimeException)
 {
     (void) catalog;
@@ -960,8 +960,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
-    const Any& catalog, const ::rtl::OUString& schemaPattern,
-    const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException)
+    const Any& catalog, const OUString& schemaPattern,
+    const OUString& procedureNamePattern, const OUString& columnNamePattern ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schemaPattern;
@@ -971,8 +971,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
-    const Any& catalog, const ::rtl::OUString& schemaPattern,
-    const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException)
+    const Any& catalog, const OUString& schemaPattern,
+    const OUString& procedureNamePattern ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schemaPattern;
@@ -981,7 +981,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
-    const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
+    const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schema;
@@ -990,7 +990,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
-    const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
+    const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schema;
@@ -999,7 +999,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
-    const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
+    const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schema;
@@ -1008,7 +1008,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
-    const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException)
+    const Any& catalog, const OUString& schema, const OUString& table ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schema;
@@ -1017,7 +1017,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
-    const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table,
+    const Any& catalog, const OUString& schema, const OUString& table,
     sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
@@ -1029,7 +1029,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
-    const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, sal_Int32 scope,
+    const Any& catalog, const OUString& schema, const OUString& table, sal_Int32 scope,
     sal_Bool nullable ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
@@ -1041,7 +1041,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
-    const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException)
+    const Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schemaPattern;
@@ -1050,9 +1050,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
-    const Any& primaryCatalog, const ::rtl::OUString& primarySchema,
-    const ::rtl::OUString& primaryTable, const Any& foreignCatalog,
-    const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException)
+    const Any& primaryCatalog, const OUString& primarySchema,
+    const OUString& primaryTable, const Any& foreignCatalog,
+    const OUString& foreignSchema, const OUString& foreignTable ) throw(SQLException, RuntimeException)
 {
     (void) primaryCatalog;
     (void) primarySchema;
@@ -1063,7 +1063,7 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
     return NULL;
 }
 // -------------------------------------------------------------------------
-uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException)
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const OUString& schemaPattern, const OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException)
 {
     (void) catalog;
     (void) schemaPattern;


More information about the Libreoffice-commits mailing list