[Libreoffice-commits] .: 4 commits - connectivity/source offapi/com

Lionel Elie Mamane lmamane at kemper.freedesktop.org
Tue Feb 14 06:07:26 PST 2012


 connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx  |   39 ++----------
 connectivity/source/drivers/odbcbase/OPreparedStatement.cxx |    3 
 connectivity/source/inc/odbc/OBoundParam.hxx                |    2 
 offapi/com/sun/star/sdbc/XDatabaseMetaData.idl              |   16 ++--
 4 files changed, 18 insertions(+), 42 deletions(-)

New commits:
commit 84d21e4de26bd69f7ca5b10f2c72779f07e11347
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Tue Feb 14 14:54:03 2012 +0100

    odbc 64 bit crash: correct buffer length allocation for a SQLLEN

diff --git a/connectivity/source/inc/odbc/OBoundParam.hxx b/connectivity/source/inc/odbc/OBoundParam.hxx
index 2310a2e..99a4901 100644
--- a/connectivity/source/inc/odbc/OBoundParam.hxx
+++ b/connectivity/source/inc/odbc/OBoundParam.hxx
@@ -68,7 +68,7 @@ namespace connectivity
                 // to a Java sal_Int32.  The jdbcodbc 'C' bridge provides an
                 // interface to do this.
 
-                paramLength = new sal_Int8[4];
+                paramLength = new sal_Int8[sizeof(SQLLEN)];
             }
 
             //--------------------------------------------------------------------
commit 288cc968c4d1fa07b4f3cc106ea6934c4afd955a
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Tue Feb 14 09:49:19 2012 +0100

    new[] already allocates each element of the array
    
    And calls the default constructor, naturally.

diff --git a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
index 2dbde52..63401f5 100644
--- a/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
+++ b/connectivity/source/drivers/odbcbase/OPreparedStatement.cxx
@@ -641,11 +641,10 @@ void OPreparedStatement::initBoundParam () throw(SQLException)
 
         boundParams = new OBoundParam[numParams];
 
-        // Allocate and initialize each bound parameter
+        // initialize each bound parameter
 
         for (sal_Int32 i = 0; i < numParams; i++)
         {
-            boundParams[i] = OBoundParam();
             boundParams[i].initialize ();
         }
     }
commit 50e5118710c84461b0e09dc0576e924ea149f6d4
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Tue Feb 14 06:27:51 2012 +0100

    odbc getTableTypes: ask the driver instead of guessing

diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
index 093c6d9..783e259 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
@@ -728,43 +728,18 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins(  ) throw(SQLException,
 // -------------------------------------------------------------------------
 Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes(  ) throw(SQLException, RuntimeException)
 {
-
-    // there exists no possibility to get table types so we have to check
-    static ::rtl::OUString sTableTypes[] =
-    {
-        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")),
-        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW")),
-        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSTEM TABLE")),
-        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GLOBAL TEMPORARY")),
-        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOCAL TEMPORARY")),
-        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALIAS")),
-        ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYNONYM"))
-    };
-    sal_Int32  nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
-    ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
-    Reference< XResultSet > xRef = pResult;
-    SQLUINTEGER nValue = 0;
+    Reference< XResultSet > xRef;
     try
     {
-        OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CREATE_VIEW,nValue,*this);
-    }
-    catch(const Exception&)
-    {
+        ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+        xRef = pResult;
+        pResult->openTablesTypes();
     }
-    sal_Bool bViewsSupported = (nValue & SQL_CV_CREATE_VIEW) == SQL_CV_CREATE_VIEW;
-
-    ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
-    for(sal_Int32 i=0;i < nSize;++i)
+    catch(SQLException&)
     {
-        if( !bViewsSupported && i == 1)
-            continue; // no views supported
-        ::connectivity::ODatabaseMetaDataResultSet::ORow aRow;
-        aRow.push_back(::connectivity::ODatabaseMetaDataResultSet::getEmptyValue());
-        aRow.push_back(new ::connectivity::ORowSetValueDecorator(sTableTypes[i]));
-        aRows.push_back(aRow);
+        xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
     }
-    pResult->setRows(aRows);
-     return xRef;
+    return xRef;
 }
 // -------------------------------------------------------------------------
 sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw(  )
commit 7535373fa693ddff5311054800efcc602cdcacd9
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Tue Feb 14 06:19:08 2012 +0100

    correct documentation of com::sun::star::sdbc::XDatabaseMetaData

diff --git a/offapi/com/sun/star/sdbc/XDatabaseMetaData.idl b/offapi/com/sun/star/sdbc/XDatabaseMetaData.idl
index 4f06bb5..abee6d2 100644
--- a/offapi/com/sun/star/sdbc/XDatabaseMetaData.idl
+++ b/offapi/com/sun/star/sdbc/XDatabaseMetaData.idl
@@ -45,31 +45,33 @@
     the form of
     <type scope="com::sun::star::sdbc">XResultSet</type>
     objects.
-    You can use the normal <type scope="com::sun::star::sdbc">XResultSet</type>
+    You can use the normal <type scope="com::sun::star::sdbc">XRow</type>
+    (or <type scope="com::sun::star::sdb">XColumn</type>)
     methods such as
-    <member scope="com::sun::star::sdbc">XResultSet::getString()</member>
+    <member scope="com::sun::star::sdbc">XRow::getString()</member>
     and
-    <member scope="com::sun::star::sdbc">XResultSet::getInt()</member>
+    <member scope="com::sun::star::sdbc">XRow::getInt()</member>
     to retrieve the data from these XResultSets. If a given form of
     metadata is not available, these methods should throw a
     <type scope="com::sun::star::sdbc">SQLException</type>
     .
-    That a value of <type scope="com::sun::star::sdbc">XResultSet</type> is <NULL/>
-    can be checked with the method <member scope="com::sun::star::sdbc">XResultSet::wasNull()</member>.
+    After calling one of the getXXX() methods,
+    one can check whether that value is <NULL/>
+    with the method <member scope="com::sun::star::sdbc">XRow::wasNull()</member>.
     In the text only "(may be <NULL/>)" is mentioned for this case.
     </p>
     <p>Some of these methods take arguments that are String patterns. These
     arguments all have names such as fooPattern. Within a pattern String, "%"
     means match any substring of 0 or more characters, and "_" means match
     any one character. Only metadata entries matching the search pattern
-    are returned. If a search pattern argument is set to <VOID/>,
+    is returned. If a search pattern argument is set to <VOID/>,
     that argument's criteria will be dropped from the search.
     </p>
     <p>
     A
     <type scope="com::sun::star::sdbc">SQLException</type>
     will be thrown if a driver does not support
-    a meta data method. In the case of methods that return an XResultSet,
+    a metadata method. In the case of methods that return an XResultSet,
     either an XResultSet (which may be empty) is returned or a
     SQLException is thrown.</p>
  */


More information about the Libreoffice-commits mailing list