summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2012-07-10 17:18:56 +0200
committerLionel Elie Mamane <lionel@mamane.lu>2012-07-10 17:29:01 +0200
commit00d453b9332d0f5f3ab64d40186b68b4b3bb6d5e (patch)
tree5cb8a57cc1fdafe65d414fcfda55acfbe2025e83 /connectivity
parent7119c94f78f8160ee502fc4277bdaaf0b5ddf138 (diff)
fdo#50849 work around psqlodbc segfault
Change-Id: Ib7e484f778d97b3f18845cef12718618324c859f
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx13
1 files changed, 13 insertions, 0 deletions
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx
index 2dfb9608ce0c..2e115ca86382 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() != '%')