connectivity/source/drivers/firebird/FDatabaseMetaData.cxx  |  394 ++++++++++--
 connectivity/source/drivers/firebird/FResultSet.cxx         |    4 
 connectivity/source/drivers/firebird/FResultSetMetaData.cxx |    5 
 3 files changed, 354 insertions(+), 49 deletions(-)

New commits:
commit 136f3bb1795048adc3ca5ba28d44809e5b791701
Author: Andrzej J.R. Hunt <andr...@ahunt.org>
Date:   Mon Jul 29 17:43:03 2013 +0200

    Implement a large chunk of getTypeInfo. (firebird-sdbc)
    
    Change-Id: Ide63479943dad50000b72bc132f336bace11a09c

diff --git a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx 
b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
index 436c4d1..539df19 100644
--- a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
@@ -800,46 +800,175 @@ uno::Reference< XResultSet > SAL_CALL 
ODatabaseMetaData::getTableTypes(  ) throw
 {
     return NULL;
 }
-// -------------------------------------------------------------------------
-uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo(  ) 
throw(SQLException, RuntimeException)
+
+uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
+    throw(SQLException, RuntimeException)
 {
-    SAL_INFO("connectivity.firebird", "getTypeInfo().");
+    SAL_INFO("connectivity.firebird", "getTypeInfo()");
 
     // this returns an empty resultset where the column-names are already set
     // in special the metadata of the resultset already returns the right 
columns
-    ODatabaseMetaDataResultSet* pResultSet = new 
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
+    ODatabaseMetaDataResultSet* pResultSet =
+            new 
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTypeInfo);
     uno::Reference< XResultSet > xResultSet = pResultSet;
-    static ODatabaseMetaDataResultSet::ORows aRows;
+    static ODatabaseMetaDataResultSet::ORows aResults;
 
-    if(aRows.empty())
+    if(aResults.empty())
     {
-        ODatabaseMetaDataResultSet::ORow aRow;
-        aRow.reserve(19);
-        aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
-        aRow.push_back(new ORowSetValueDecorator(OUString("VARCHAR(100)")));
-        aRow.push_back(new ORowSetValueDecorator(DataType::VARCHAR));
-        aRow.push_back(new 
ORowSetValueDecorator((sal_Int32)s_nCHAR_OCTET_LENGTH));
-        aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
-        aRow.push_back(ODatabaseMetaDataResultSet::getQuoteValue());
-        aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
-        // aRow.push_back(new 
ORowSetValueDecorator((sal_Int32)ColumnValue::NULLABLE));
-        aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
-        aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
-        aRow.push_back(new 
ORowSetValueDecorator((sal_Int32)ColumnSearch::CHAR));
-        aRow.push_back(ODatabaseMetaDataResultSet::get1Value());
-        aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
-        aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
-        aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
-        aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
-        aRow.push_back(ODatabaseMetaDataResultSet::get0Value());
-        aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
-        aRow.push_back(ODatabaseMetaDataResultSet::getEmptyValue());
-        aRow.push_back(new ORowSetValueDecorator((sal_Int32)10));
-
-        aRows.push_back(aRow);
-
+        ODatabaseMetaDataResultSet::ORow aRow(19);
+
+        // Common data
+        aRow[4] = ODatabaseMetaDataResultSet::getQuoteValue(); // Literal 
quote marks
+        aRow[5] = ODatabaseMetaDataResultSet::getQuoteValue(); // Literal 
quote marks
+        aRow[6] = new ORowSetValueDecorator();               // Create Params
+        aRow[7] = new ORowSetValueDecorator(sal_Bool(true)); // Nullable
+        aRow[8] = new ORowSetValueDecorator(sal_Bool(true)); // Case sensitive
+        aRow[10] = new ORowSetValueDecorator(sal_Bool(false)); // Is unsigned
+        // Localised Type Name -- TODO: implement (but can be null):
+        aRow[13] = new ORowSetValueDecorator();
+        aRow[16] = new ORowSetValueDecorator();             // Unused
+        aRow[17] = new ORowSetValueDecorator();             // Unused
+        aRow[18] = new ORowSetValueDecorator(sal_Int16(10));// Radix
+
+        // TODO: sort by DATA_TYPE
+
+        // SQL_TEXT
+        aRow[1] = new ORowSetValueDecorator(OUString("CHAR"));
+        aRow[2] = new ORowSetValueDecorator(getColumnTypeFromFBType(SQL_TEXT));
+        aRow[3] = new ORowSetValueDecorator(sal_Int16(32767)); // Prevision = 
max length
+        aRow[9] = new ORowSetValueDecorator(
+                sal_Int16(ColumnSearch::FULL)); // Searchable
+        aRow[11] = new ORowSetValueDecorator(sal_Bool(true)); // Can be money 
value
+        aRow[12] = new ORowSetValueDecorator(sal_Bool(false)); // Autoincrement
+        aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
+        aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
+        aResults.push_back(aRow);
+
+        // SQL_VARYING
+        aRow[1] = new ORowSetValueDecorator(OUString("VARCHAR"));
+        aRow[2] = new 
ORowSetValueDecorator(getColumnTypeFromFBType(SQL_VARYING));
+        aRow[3] = new ORowSetValueDecorator(sal_Int16(32767)); // Prevision = 
max length
+        aRow[9] = new ORowSetValueDecorator(
+                sal_Int16(ColumnSearch::FULL)); // Searchable
+        aRow[11] = new ORowSetValueDecorator(sal_Bool(true)); // Can be money 
value
+        aRow[12] = new ORowSetValueDecorator(sal_Bool(false)); // Autoincrement
+        aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
+        aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
+        aResults.push_back(aRow);
+
+        // Integer Types common
+        {
+            aRow[9] = new ORowSetValueDecorator(
+                sal_Int16(ColumnSearch::FULL)); // Searchable
+            aRow[11] = new ORowSetValueDecorator(sal_Bool(true)); // Can be 
money value
+            aRow[12] = new ORowSetValueDecorator(sal_Bool(true)); // 
Autoincrement
+            aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum 
scale
+            aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
+        }
+        // SQL_SHORT
+        aRow[1] = new ORowSetValueDecorator(OUString("SMALLINT"));
+        aRow[2] = new 
ORowSetValueDecorator(getColumnTypeFromFBType(SQL_SHORT));
+        aRow[3] = new ORowSetValueDecorator(sal_Int16(5)); // Prevision
+        aResults.push_back(aRow);
+        // SQL_LONG
+        aRow[1] = new ORowSetValueDecorator(OUString("INTEGER"));
+        aRow[2] = new ORowSetValueDecorator(getColumnTypeFromFBType(SQL_LONG));
+        aRow[3] = new ORowSetValueDecorator(sal_Int16(10)); // Precision
+        aResults.push_back(aRow);
+        // SQL_INT64
+        aRow[1] = new ORowSetValueDecorator(OUString("BIGINT"));
+        aRow[2] = new 
ORowSetValueDecorator(getColumnTypeFromFBType(SQL_INT64));
+        aRow[3] = new ORowSetValueDecorator(sal_Int16(20)); // Precision
+        aResults.push_back(aRow);
+
+        // Decimal Types common
+        {
+            aRow[9] = new ORowSetValueDecorator(
+                sal_Int16(ColumnSearch::FULL)); // Searchable
+            aRow[11] = new ORowSetValueDecorator(sal_Bool(true)); // Can be 
money value
+            aRow[12] = new ORowSetValueDecorator(sal_Bool(true)); // 
Autoincrement
+        }
+        // SQL_FLOAT
+        aRow[1] = new ORowSetValueDecorator(OUString("FLOAT"));
+        aRow[2] = new 
ORowSetValueDecorator(getColumnTypeFromFBType(SQL_FLOAT));
+        aRow[3] = new ORowSetValueDecorator(sal_Int16(7)); // Precision
+        aRow[14] = new ORowSetValueDecorator(sal_Int16(1)); // Minimum scale
+        aRow[15] = new ORowSetValueDecorator(sal_Int16(7)); // Max scale
+        aResults.push_back(aRow);
+        // SQL_DOUBLE
+        aRow[1] = new ORowSetValueDecorator(OUString("REAL"));
+        aRow[2] = new 
ORowSetValueDecorator(getColumnTypeFromFBType(SQL_DOUBLE));
+        aRow[3] = new ORowSetValueDecorator(sal_Int16(15)); // Precision
+        aRow[14] = new ORowSetValueDecorator(sal_Int16(1)); // Minimum scale
+        aRow[15] = new ORowSetValueDecorator(sal_Int16(15)); // Max scale
+        aResults.push_back(aRow);
+//         // SQL_D_FLOAT
+//         aRow[1] = new 
ORowSetValueDecorator(getColumnTypeNameFromFBType(SQL_D_FLOAT));
+//         aRow[2] = new 
ORowSetValueDecorator(getColumnTypeFromFBType(SQL_D_FLOAT));
+//         aRow[3] = new ORowSetValueDecorator(sal_Int16(15)); // Precision
+//         aRow[14] = new ORowSetValueDecorator(sal_Int16(1)); // Minimum scale
+//         aRow[15] = new ORowSetValueDecorator(sal_Int16(15)); // Max scale
+//         aResults.push_back(aRow);
+        // TODO: no idea whether D_FLOAT corresponds to an sql type
+
+        // SQL_TIMESTAMP
+        // TODO: precision?
+        aRow[1] = new ORowSetValueDecorator(OUString("timestamp"));
+        aRow[2] = new 
ORowSetValueDecorator(getColumnTypeFromFBType(SQL_TIMESTAMP));
+        aRow[3] = new ORowSetValueDecorator(sal_Int32(8)); // Prevision = max 
length
+        aRow[9] = new ORowSetValueDecorator(
+                sal_Int16(ColumnSearch::FULL)); // Searchable
+        aRow[11] = new ORowSetValueDecorator(sal_Bool(false)); // Can be money 
value
+        aRow[12] = new ORowSetValueDecorator(sal_Bool(false)); // Autoincrement
+        aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
+        aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
+        aResults.push_back(aRow);
+
+        // SQL_TYPE_TIME
+        // TODO: precision?
+        aRow[1] = new ORowSetValueDecorator(OUString("TIME"));
+        aRow[2] = new 
ORowSetValueDecorator(getColumnTypeFromFBType(SQL_TYPE_TIME));
+        aRow[3] = new ORowSetValueDecorator(sal_Int32(8)); // Prevision = max 
length
+        aRow[9] = new ORowSetValueDecorator(
+                sal_Int16(ColumnSearch::FULL)); // Searchable
+        aRow[11] = new ORowSetValueDecorator(sal_Bool(false)); // Can be money 
value
+        aRow[12] = new ORowSetValueDecorator(sal_Bool(false)); // Autoincrement
+        aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
+        aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
+        aResults.push_back(aRow);
+
+        // SQL_TYPE_DATE
+        // TODO: precision?
+        aRow[1] = new ORowSetValueDecorator(OUString("DATE"));
+        aRow[2] = new 
ORowSetValueDecorator(getColumnTypeFromFBType(SQL_TYPE_DATE));
+        aRow[3] = new ORowSetValueDecorator(sal_Int32(8)); // Prevision = max 
length
+        aRow[9] = new ORowSetValueDecorator(
+                sal_Int16(ColumnSearch::FULL)); // Searchable
+        aRow[11] = new ORowSetValueDecorator(sal_Bool(false)); // Can be money 
value
+        aRow[12] = new ORowSetValueDecorator(sal_Bool(false)); // Autoincrement
+        aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
+        aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
+        aResults.push_back(aRow);
+
+        // SQL_BLOB
+        // TODO: precision?
+        aRow[1] = new ORowSetValueDecorator(OUString("BLOB"));
+        aRow[2] = new ORowSetValueDecorator(getColumnTypeFromFBType(SQL_BLOB));
+        aRow[3] = new ORowSetValueDecorator(sal_Int32(0)); // Prevision = max 
length
+        aRow[9] = new ORowSetValueDecorator(
+                sal_Int16(ColumnSearch::NONE)); // Searchable
+        aRow[11] = new ORowSetValueDecorator(sal_Bool(false)); // Can be money 
value
+        aRow[12] = new ORowSetValueDecorator(sal_Bool(false)); // Autoincrement
+        aRow[14] = ODatabaseMetaDataResultSet::get0Value(); // Minimum scale
+        aRow[15] = ODatabaseMetaDataResultSet::get0Value(); // Max scale
+        aResults.push_back(aRow);
+
+        // TODO: complete
+//     case SQL_ARRAY:
+//     case SQL_NULL:
+//     case SQL_QUAD:      // Is a "Blob ID" according to the docs
     }
-    pResultSet->setRows(aRows);
+    pResultSet->setRows(aResults);
     return xResultSet;
 }
 
commit e1b645e62f836e4e43d9722822d50f75603ba5a6
Author: Andrzej J.R. Hunt <andr...@ahunt.org>
Date:   Mon Jul 29 11:28:36 2013 +0200

    Fix typo.
    
    Change-Id: I1473facceb0b08289052282b93a6e1fb46f0ea14

diff --git a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx 
b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
index a833085..f699b8f 100644
--- a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
@@ -71,7 +71,7 @@ sal_Bool SAL_CALL 
OResultSetMetaData::isCaseSensitive(sal_Int32 column)
     // there remains some ambiguity if there is another mixed-case-named column
     // of the same name. For safety always assume case insensitive.
     (void) column;
-    return sal_False;
+    return sal_True;
 }
 
 OUString SAL_CALL OResultSetMetaData::getSchemaName(sal_Int32 column)
commit 97a142d6df0a38972e548e5348e53c357adc5eea
Author: Andrzej J.R. Hunt <andr...@ahunt.org>
Date:   Mon Jul 29 11:20:50 2013 +0200

    Implement getColumnPrivileges. (firebird-sdbc)
    
    Change-Id: I31e179462a06db135467e8b78e4b550cc603a04a

diff --git a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx 
b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
index f245117..436c4d1 100644
--- a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
@@ -848,16 +848,106 @@ uno::Reference< XResultSet > SAL_CALL 
ODatabaseMetaData::getSchemas()
 {
     return NULL;
 }
-// -------------------------------------------------------------------------
+
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges(
-    const Any& catalog, const OUString& schema, const OUString& table,
-    const OUString& columnNamePattern ) throw(SQLException, RuntimeException)
+        const Any& aCatalog,
+        const OUString& sSchema,
+        const OUString& sTable,
+        const OUString& sColumnNamePattern)
+    throw(SQLException, RuntimeException)
 {
-    (void) catalog;
-    (void) schema;
-    (void) table;
-    (void) columnNamePattern;
-    return NULL;
+    (void) aCatalog;
+    (void) sSchema;
+
+    SAL_INFO("connectivity.firebird", "getColumnPrivileges() with "
+             "Table: " << sTable
+             << " & ColumnNamePattern: " << sColumnNamePattern);
+
+    ODatabaseMetaDataResultSet* pResultSet = new 
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
+    uno::Reference< XResultSet > xResultSet = pResultSet;
+    uno::Reference< XStatement > statement = m_pConnection->createStatement();
+
+    static const OUString wld("%");
+    OUStringBuffer queryBuf(
+            "SELECT "
+            "priv.RDB$RELATION_NAME, "  // 1 Table name
+            "priv.RDB$GRANTOR,"         // 2
+            "priv.RDB$USER, "           // 3 Grantee
+            "priv.RDB$PRIVILEGE, "      // 4
+            "priv.RDB$GRANT_OPTION, "   // 5 is Grantable
+            "priv.RDB$FIELD_NAME "      // 6 Column name
+            "FROM RDB$USER_PRIVILEGES priv ");
+
+    {
+        OUString sAppend = "WHERE priv.RDB$RELATION_NAME = '%' ";
+        queryBuf.append(sAppend.replaceAll("%", sTable));
+    }
+    if (!sColumnNamePattern.isEmpty())
+    {
+        OUString sAppend;
+        if (sColumnNamePattern.match(wld))
+            sAppend = "AND priv.RDB$FIELD_NAME LIKE '%' ";
+        else
+            sAppend = "AND priv.RDB$FIELD_NAME = '%' ";
+
+        queryBuf.append(sAppend.replaceAll(wld, sColumnNamePattern));
+    }
+
+    queryBuf.append(" ORDER BY priv.RDB$FIELD, "
+                              "priv.RDB$PRIVILEGE");
+
+    OUString query = queryBuf.makeStringAndClear();
+
+    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(8);
+
+        // 1. TABLE_CAT
+        aCurrentRow.push_back(new ORowSetValueDecorator());
+        // 2. TABLE_SCHEM
+        aCurrentRow.push_back(new ORowSetValueDecorator());
+
+        // 3. TABLE_NAME
+        {
+            OUString sTableName = xRow->getString(1);
+            aCurrentRow.push_back(new ORowSetValueDecorator(sTableName));
+        }
+        // 3. COLUMN_NAME
+        {
+            OUString sColumnName = xRow->getString(6);
+            aCurrentRow.push_back(new ORowSetValueDecorator(sColumnName));
+        }
+        // 4. GRANTOR
+        {
+            OUString sGrantor = xRow->getString(2);
+            aCurrentRow.push_back(new ORowSetValueDecorator(sGrantor));
+        }
+        // 5. GRANTEE
+        {
+            OUString sGrantee = xRow->getString(3);
+            aCurrentRow.push_back(new ORowSetValueDecorator(sGrantee));
+        }
+        // 6. Privilege
+        {
+            OUString sPrivilege = xRow->getString(4);
+            aCurrentRow.push_back(new ORowSetValueDecorator(sPrivilege));
+        }
+        // 7. IS_GRANTABLE
+        {
+            sal_Bool bIsGrantable = xRow->getBoolean(5);
+            aCurrentRow.push_back(new ORowSetValueDecorator(bIsGrantable));
+        }
+
+        aResults.push_back(aCurrentRow);
+    }
+
+    pResultSet->setRows( aResults );
+
+    return xResultSet;
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns(
@@ -1256,6 +1346,8 @@ uno::Reference< XResultSet > SAL_CALL 
ODatabaseMetaData::getTablePrivileges(
     uno::Reference< XResultSet > xResultSet = pResultSet;
     uno::Reference< XStatement > statement = m_pConnection->createStatement();
 
+    // TODO: column specific privileges are included, we may need
+    // to have WHERE RDB$FIELD_NAME = NULL or similar.
     static const OUString wld("%");
     OUStringBuffer queryBuf(
             "SELECT "
@@ -1271,9 +1363,9 @@ uno::Reference< XResultSet > SAL_CALL 
ODatabaseMetaData::getTablePrivileges(
     {
         OUString sAppend;
         if (sTableNamePattern.match(wld))
-            sAppend = "AND priv.RDB$RELATION_NAME LIKE '%' ";
+            sAppend = "WHERE priv.RDB$RELATION_NAME LIKE '%' ";
         else
-            sAppend = "AND priv.RDB$RELATION_NAME = '%' ";
+            sAppend = "WHERE priv.RDB$RELATION_NAME = '%' ";
 
         queryBuf.append(sAppend.replaceAll(wld, sTableNamePattern));
     }
commit 1db4ed1bc95ff4ed78b4e8fbada4a94afeaabfd6
Author: Andrzej J.R. Hunt <andr...@ahunt.org>
Date:   Mon Jul 29 11:02:45 2013 +0200

    Implement getTablePrivileges. (firebird-sdbc)
    
    Change-Id: Id5bb79fdd01014594582de2bad6e16142259b0ce

diff --git a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx 
b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
index ff90350..f245117 100644
--- a/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FDatabaseMetaData.cxx
@@ -1239,14 +1239,95 @@ uno::Reference< XResultSet > SAL_CALL 
ODatabaseMetaData::getBestRowIdentifier(
     (void) nullable;
     return NULL;
 }
-// -------------------------------------------------------------------------
+
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
-    const Any& catalog, const OUString& schemaPattern, const OUString& 
tableNamePattern ) throw(SQLException, RuntimeException)
+        const Any& aCatalog,
+        const OUString& sSchemaPattern,
+        const OUString& sTableNamePattern)
+    throw(SQLException, RuntimeException)
 {
-    (void) catalog;
-    (void) schemaPattern;
-    (void) tableNamePattern;
-    return NULL;
+    (void) aCatalog;
+    (void) sSchemaPattern;
+
+    SAL_INFO("connectivity.firebird", "getTablePrivileges() with "
+             "TableNamePattern: " << sTableNamePattern);
+
+    ODatabaseMetaDataResultSet* pResultSet = new 
ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTables);
+    uno::Reference< XResultSet > xResultSet = pResultSet;
+    uno::Reference< XStatement > statement = m_pConnection->createStatement();
+
+    static const OUString wld("%");
+    OUStringBuffer queryBuf(
+            "SELECT "
+            "priv.RDB$RELATION_NAME, "  // 1
+            "priv.RDB$GRANTOR,"         // 2
+            "priv.RDB$USER, "           // 3 Grantee
+            "priv.RDB$PRIVILEGE, "      // 4
+            "priv.RDB$GRANT_OPTION "    // 5 is Grantable
+            "FROM RDB$USER_PRIVILEGES priv ");
+    // "WHERE (priv.RDB$USER = ?????????)"
+
+    if (!sTableNamePattern.isEmpty())
+    {
+        OUString sAppend;
+        if (sTableNamePattern.match(wld))
+            sAppend = "AND priv.RDB$RELATION_NAME LIKE '%' ";
+        else
+            sAppend = "AND priv.RDB$RELATION_NAME = '%' ";
+
+        queryBuf.append(sAppend.replaceAll(wld, sTableNamePattern));
+    }
+    queryBuf.append(" ORDER BY priv.RDB$RELATION_TYPE, "
+                              "priv.RDB$RELATION_NAME, "
+                              "priv.RDB$PRIVILEGE");
+
+    OUString query = queryBuf.makeStringAndClear();
+
+    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(7);
+
+        // 1. TABLE_CAT
+        aCurrentRow.push_back(new ORowSetValueDecorator());
+        // 2. TABLE_SCHEM
+        aCurrentRow.push_back(new ORowSetValueDecorator());
+
+        // 3. TABLE_NAME
+        {
+            OUString sTableName = xRow->getString(1);
+            aCurrentRow.push_back(new ORowSetValueDecorator(sTableName));
+        }
+        // 4. GRANTOR
+        {
+            OUString sGrantor = xRow->getString(2);
+            aCurrentRow.push_back(new ORowSetValueDecorator(sGrantor));
+        }
+        // 5. GRANTEE
+        {
+            OUString sGrantee = xRow->getString(3);
+            aCurrentRow.push_back(new ORowSetValueDecorator(sGrantee));
+        }
+        // 6. Privilege
+        {
+            OUString sPrivilege = xRow->getString(4);
+            aCurrentRow.push_back(new ORowSetValueDecorator(sPrivilege));
+        }
+        // 7. IS_GRANTABLE
+        {
+            sal_Bool bIsGrantable = xRow->getBoolean(5);
+            aCurrentRow.push_back(new ORowSetValueDecorator(bIsGrantable));
+        }
+
+        aResults.push_back(aCurrentRow);
+    }
+
+    pResultSet->setRows( aResults );
+
+    return xResultSet;
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
commit 03919cfa7904be4c6312b0ecdd7129990fa554c6
Author: Andrzej J.R. Hunt <andr...@ahunt.org>
Date:   Mon Jul 29 09:18:26 2013 +0200

    Use column name for getColumnLabel (firebird-sdbc).
    
    Change-Id: I2e92c5dbdfe4cb9d8441e2d120b139fe97209d3e

diff --git a/connectivity/source/drivers/firebird/FResultSet.cxx 
b/connectivity/source/drivers/firebird/FResultSet.cxx
index fd9843f..ca0ded1 100644
--- a/connectivity/source/drivers/firebird/FResultSet.cxx
+++ b/connectivity/source/drivers/firebird/FResultSet.cxx
@@ -321,6 +321,10 @@ sal_Int32 SAL_CALL OResultSet::findColumn(const OUString& 
columnName)
             break;
     }
 
+    // TODO: add appropriate error
+    if (i > nLen)
+        throw SQLException();
+
     return i;
 }
 // -------------------------------------------------------------------------
diff --git a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx 
b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
index 4a23f99..a833085 100644
--- a/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
+++ b/connectivity/source/drivers/firebird/FResultSetMetaData.cxx
@@ -120,8 +120,7 @@ OUString SAL_CALL 
OResultSetMetaData::getColumnLabel(sal_Int32 column)
     throw(SQLException, RuntimeException)
 {
     // TODO: clarify what this is -- probably not the alias
-    (void) column;
-    return OUString();
+    return getColumnName(column);
 }
 
 OUString SAL_CALL OResultSetMetaData::getColumnServiceName(sal_Int32 column)
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to