[Libreoffice-commits] .: Branch 'features/base-preview' - connectivity/source

Lionel Elie Mamane lmamane at kemper.freedesktop.org
Tue Jul 10 08:18:28 PDT 2012


 connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx |   13 ++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 409131875d7852a57cd5f52a5354f262d1eff525
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Tue Jul 10 17:18:56 2012 +0200

    fdo#50849 work around psqlodbc segfault
    
    Change-Id: Ib7e484f778d97b3f18845cef12718618324c859f

diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
index a364915..ec3ab25 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
@@ -1125,6 +1125,19 @@ void ODatabaseMetaDataResultSet::openSpecialColumns(sal_Bool _bRowVer,const Any&
                                     const ::rtl::OUString& table,sal_Int32 scope,   sal_Bool nullable )
                                     throw(SQLException, RuntimeException)
 {
+    // Some ODBC drivers really don't like getting an empty string as tableName
+    // E.g. psqlodbc up to at least version 09.01.0100 segfaults
+    if (table.isEmpty())
+    {
+        const char errMsg[] = "ODBC: Trying to get special columns of empty table name";
+        const char SQLState[] = "HY009";
+        throw SQLException( ::rtl::OUString(errMsg, sizeof(errMsg) - sizeof(errMsg[0]), RTL_TEXTENCODING_ASCII_US),
+                            *this,
+                            ::rtl::OUString(SQLState, sizeof(SQLState) - sizeof(SQLState[0]), RTL_TEXTENCODING_ASCII_US),
+                            -1,
+                            Any() );
+    }
+
     const ::rtl::OUString *pSchemaPat = NULL;
 
     if(schema.toChar() != '%')


More information about the Libreoffice-commits mailing list