[Libreoffice-commits] core.git: 4 commits - connectivity/source wizards/com

Julien Nabet serval2412 at yahoo.fr
Fri Oct 25 01:09:59 PDT 2013


 connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx         |    8 +
 connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx |   12 ++
 connectivity/source/drivers/firebird/DatabaseMetaData.cxx              |   43 +++++++---
 connectivity/source/inc/FDatabaseMetaDataResultSet.hxx                 |    5 -
 connectivity/source/inc/FDatabaseMetaDataResultSetMetaData.hxx         |    1 
 wizards/com/sun/star/wizards/db/DBMetaData.java                        |    2 
 6 files changed, 58 insertions(+), 13 deletions(-)

New commits:
commit a95ecd8b65ea2275a66f6694f0c09e3faaef4407
Author: Julien Nabet <serval2412 at yahoo.fr>
Date:   Thu Oct 24 08:30:41 2013 +0200

    fdo#69772 make StringsFromResultSet more robust
    
    Correctly handle case argument _xResultSet == null,
    instead of throwing a NullPointerException.
    
    Change-Id: I81e35c77116e2e0302da86f03f7e757a52e97b29

diff --git a/wizards/com/sun/star/wizards/db/DBMetaData.java b/wizards/com/sun/star/wizards/db/DBMetaData.java
index a75009c..9e8b98d 100644
--- a/wizards/com/sun/star/wizards/db/DBMetaData.java
+++ b/wizards/com/sun/star/wizards/db/DBMetaData.java
@@ -959,6 +959,8 @@ public class DBMetaData
     private String[] StringsFromResultSet(XResultSet _xResultSet, int _icol)
     {
         String[] sColValues = null;
+        if (_xResultSet == null)
+            return sColValues;
         try
         {
             XRow xRow = UnoRuntime.queryInterface( XRow.class, _xResultSet );
commit d1fdaafd7c1c1ce3d89dda3bd745f9dd594d83ca
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri Oct 25 09:59:40 2013 +0200

    fdo#6412 firebird-sdbc DatabaseMetaData unimplemented getXXX: provide empty RS
    
    As opposed to NULL object. Else, callers that do a UNO_QUERY_THROW get unexpected results.
    
    Change-Id: Ie9dd157eed03031ba04ed59c363a45e246bbb001

diff --git a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
index a1ba07a..fbc82ba 100644
--- a/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
+++ b/connectivity/source/drivers/firebird/DatabaseMetaData.cxx
@@ -91,7 +91,9 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInDataManipulation(  ) thro
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs() throw(SQLException, RuntimeException)
 {
-    return 0;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eCatalogs);
 }
 
 sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls() throw(SQLException, RuntimeException)
@@ -150,7 +152,9 @@ OUString SAL_CALL ODatabaseMetaData::getSchemaTerm()
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas()
     throw(SQLException, RuntimeException)
 {
-    return 0;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eSchemas);
 }
 
 //----- Max Sizes/Lengths -----------------------------------------------------
@@ -838,7 +842,9 @@ uno::Reference< XConnection > SAL_CALL ODatabaseMetaData::getConnection()
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes(  ) throw(SQLException, RuntimeException)
 {
-    return NULL;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eTableTypes);
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTypeInfo()
@@ -1413,7 +1419,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns(
     (void) schemaPattern;
     (void) procedureNamePattern;
     (void) columnNamePattern;
-    return NULL;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eProcedureColumns);
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
@@ -1424,7 +1432,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures(
     (void) catalog;
     (void) schemaPattern;
     (void) procedureNamePattern;
-    return NULL;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eProcedures);
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
@@ -1434,7 +1444,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getVersionColumns(
     (void) catalog;
     (void) schema;
     (void) table;
-    return NULL;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eVersionColumns);
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
@@ -1447,7 +1459,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys(
     (void) catalog;
     (void) schema;
     (void) table;
-    return NULL;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eExportedKeys);
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
@@ -1460,7 +1474,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys(
     (void) catalog;
     (void) schema;
     (void) table;
-    return NULL;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eImportedKeys);
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys(
@@ -1627,7 +1643,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getBestRowIdentifier(
     (void) table;
     (void) scope;
     (void) nullable;
-    return NULL;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eBestRowIdentifier);
 }
 
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges(
@@ -1709,7 +1727,9 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference(
     (void) foreignCatalog;
     (void) foreignSchema;
     (void) foreignTable;
-    return NULL;
+    OSL_FAIL("Not implemented yet!");
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eCrossReference);
 }
 // -------------------------------------------------------------------------
 uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& catalog, const OUString& schemaPattern, const OUString& typeNamePattern, const Sequence< sal_Int32 >& types ) throw(SQLException, RuntimeException)
@@ -1719,7 +1739,8 @@ uno::Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& cat
     (void) typeNamePattern;
     (void) types;
     OSL_FAIL("Not implemented yet!");
-    throw SQLException();
+    // TODO implement
+    return new ODatabaseMetaDataResultSet(ODatabaseMetaDataResultSet::eUDTs);
 }
 // -----------------------------------------------------------------------------
 
commit 373e4d33c1ecbef94736f551fae75d68c4f21f8e
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri Oct 25 09:56:56 2013 +0200

    connectivity commontools DatabaseMetaData: provide for getUDTs, too
    
    Change-Id: Id361ac34f400922893f6a906e4345eed2be1b2d2

diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
index 102a4f6..c56272c 100644
--- a/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/commontools/FDatabaseMetaDataResultSet.cxx
@@ -111,6 +111,7 @@ void ODatabaseMetaDataResultSet::setType(MetaDataResultSetType _eType)
         case eTypeInfo:             setTypeInfoMap(); break;
         case eBestRowIdentifier:    setBestRowIdentifierMap(); break;
         case eVersionColumns:       setVersionColumnsMap(); break;
+        case eUDTs:                 setUDTsMap(); break;
         default:
             OSL_FAIL("Wrong type!");
     }
@@ -611,6 +612,13 @@ void ODatabaseMetaDataResultSet::setTypeInfoMap()
     m_xMetaData = pMetaData;
 }
 // -------------------------------------------------------------------------
+void ODatabaseMetaDataResultSet::setUDTsMap()
+{
+    ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
+    pMetaData->setUDTsMap();
+    m_xMetaData = pMetaData;
+}
+// -------------------------------------------------------------------------
 void ODatabaseMetaDataResultSet::setTableTypes()
 {
     ODatabaseMetaDataResultSetMetaData* pMetaData = new ODatabaseMetaDataResultSetMetaData();
diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
index ea2af9b..fe5c961 100644
--- a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
+++ b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
@@ -352,4 +352,14 @@ void ODatabaseMetaDataResultSetMetaData::setVersionColumnsMap()
     m_mColumns[8] = OColumn(OUString(),"PSEUDO_COLUMN", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
 }
 
+void ODatabaseMetaDataResultSetMetaData::setUDTsMap()
+{
+    m_mColumns[1] = OColumn(OUString(),"TYPE_CAT",   ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+    m_mColumns[2] = OColumn(OUString(),"TYPE_SCHEM", ColumnValue::NULLABLE, 0,0,0, DataType::VARCHAR);
+    m_mColumns[3] = OColumn(OUString(),"TYPE_NAME",  ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+    m_mColumns[4] = OColumn(OUString(),"CLASS_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+    m_mColumns[5] = OColumn(OUString(),"DATA_TYPE",  ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+    m_mColumns[6] = OColumn(OUString(),"REMARKS",    ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
index a503bae..0ca1cf4 100644
--- a/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
+++ b/connectivity/source/inc/FDatabaseMetaDataResultSet.hxx
@@ -101,7 +101,9 @@ namespace connectivity
             /// describes a result set as expected by XDatabaseMetaData::getBestRowIdentifier
             eBestRowIdentifier = 15,
             /// describes a result set as expected by XDatabaseMetaData::getVersionColumns
-            eVersionColumns = 16
+            eVersionColumns = 16,
+            /// describes a result set as expected by XDatabaseMetaData::getUDTs
+            eUDTs = 17
         };
 
     private:
@@ -234,6 +236,7 @@ namespace connectivity
         void setTypeInfoMap();
         void setBestRowIdentifierMap();
         void setVersionColumnsMap();
+        void setUDTsMap();
     public:
         // some methods to get already defined ORowSetValues
         // this increase the reuse of ORowSetValues
diff --git a/connectivity/source/inc/FDatabaseMetaDataResultSetMetaData.hxx b/connectivity/source/inc/FDatabaseMetaDataResultSetMetaData.hxx
index e940948..8703be4 100644
--- a/connectivity/source/inc/FDatabaseMetaDataResultSetMetaData.hxx
+++ b/connectivity/source/inc/FDatabaseMetaDataResultSetMetaData.hxx
@@ -96,6 +96,7 @@ namespace connectivity
         void setImportedKeysMap() { setCrossReferenceMap(); }
         void setCatalogsMap();
         void setSchemasMap();
+        void setUDTsMap();
     };
 }
 #endif // _CONNECTIVITY_FILE_ADATABASEMETARESULTSETMETADATA_HXX_
commit 60b67b7e39217521d65e41398182f253e720333e
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Fri Oct 25 09:55:07 2013 +0200

    janitorial: indentation
    
    Change-Id: I0b571a9fe719c4f18f89638eb62434dd0813bd01

diff --git a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
index 816a1a4..ea2af9b 100644
--- a/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
+++ b/connectivity/source/commontools/FDatabaseMetaDataResultSetMetaData.cxx
@@ -342,7 +342,7 @@ void ODatabaseMetaDataResultSetMetaData::setSchemasMap()
 
 void ODatabaseMetaDataResultSetMetaData::setVersionColumnsMap()
 {
-   m_mColumns[1] = OColumn(OUString(),"SCOPE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
+    m_mColumns[1] = OColumn(OUString(),"SCOPE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
     m_mColumns[2] = OColumn(OUString(),"COLUMN_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);
     m_mColumns[3] = OColumn(OUString(),"DATA_TYPE", ColumnValue::NO_NULLS, 0,0,0, DataType::INTEGER);
     m_mColumns[4] = OColumn(OUString(),"TYPE_NAME", ColumnValue::NO_NULLS, 0,0,0, DataType::VARCHAR);


More information about the Libreoffice-commits mailing list