[Libreoffice-commits] .: Branch 'libreoffice-3-6' - connectivity/source

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


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

New commits:
commit 00d453b9332d0f5f3ab64d40186b68b4b3bb6d5e
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 2dfb960..2e115ca 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
@@ -1126,6 +1126,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