diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2012-07-10 17:18:56 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2012-07-10 17:23:13 +0200 |
commit | 1c67fc8015d88a383f2138c4d03d692314d6f579 (patch) | |
tree | 306c57fb9ae3d4275a260ef40c9db24e35231319 | |
parent | 9991c0f552bfc9c6ea3e6e6d65fe67cc32f243fd (diff) |
fdo#50849 work around psqlodbc segfault
Change-Id: Ib7e484f778d97b3f18845cef12718618324c859f
-rw-r--r-- | connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx index ac8156756eb7..953ccc53ab77 100644 --- a/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx +++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaDataResultSet.cxx @@ -1117,6 +1117,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() != '%') |