diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2014-05-15 12:55:06 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2014-05-15 13:00:15 +0200 |
commit | 94a07be5d726de71315f47d24ef9003991d201ad (patch) | |
tree | 66bf67590b963d73d8f7b2ca1eb655e66215f787 /connectivity/source | |
parent | f4ea8c2f73034cd43aca4262994e8a9aaa118b0a (diff) |
odbc: clean up SQL conformance level tests
Change-Id: I9c96ee389a086c76489f99750c2c86b7504cd393
Diffstat (limited to 'connectivity/source')
-rw-r--r-- | connectivity/source/drivers/odbc/ODatabaseMetaData.cxx | 54 |
1 files changed, 21 insertions, 33 deletions
diff --git a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx index 1b79ffb5439d..ab62346ff707 100644 --- a/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx +++ b/connectivity/source/drivers/odbc/ODatabaseMetaData.cxx @@ -655,14 +655,14 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLExceptio { SQLUINTEGER nValue; OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this); - return nValue == SQL_SC_SQL92_FULL; + return static_cast<bool>(nValue & SQL_SC_SQL92_FULL); } sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException, std::exception) { SQLUINTEGER nValue; OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this); - return nValue == SQL_SC_SQL92_ENTRY; + return static_cast<bool>(nValue &SQL_SC_SQL92_ENTRY); } sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException, std::exception) @@ -1173,7 +1173,7 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQL { SQLUINTEGER nValue; OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_SQL_CONFORMANCE,nValue,*this); - return nValue == SQL_SC_SQL92_INTERMEDIATE; + return static_cast<bool>(nValue & SQL_SC_SQL92_INTERMEDIATE); } OUString ODatabaseMetaData::getURLImpl() @@ -1476,46 +1476,34 @@ OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException, std::exception) { SQLUINTEGER nValue; - if(m_bOdbc3) - { - OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this); - return nValue == SQL_OIC_LEVEL2; - } - else - { - OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this); - return nValue == SQL_OAC_LEVEL2; - } + // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent. + OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this); + SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED), + "connectivity.odbc", + "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED"); + return nValue == SQL_OSC_EXTENDED; } sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException, std::exception) { SQLUINTEGER nValue; - if(m_bOdbc3) - { - OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this); - return nValue == SQL_OIC_CORE || nValue == SQL_OIC_LEVEL2 || nValue == SQL_OIC_LEVEL1; - } - else - { - OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this); - return nValue == SQL_OSC_CORE || nValue == SQL_OAC_LEVEL1 || nValue == SQL_OAC_LEVEL2; - } + // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent. + OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this); + SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED), + "connectivity.odbc", + "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED"); + return nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED; } sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException, std::exception) { SQLUINTEGER nValue; - if(m_bOdbc3) - { - OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this); - return nValue == SQL_OIC_LEVEL1 || nValue == SQL_OIC_LEVEL2; - } - else - { - OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_INTERFACE_CONFORMANCE,nValue,*this); - return nValue == SQL_OAC_LEVEL1 || nValue == SQL_OAC_LEVEL2; - } + // SQL_ODBC_SQL_CONFORMANCE is deprecated in ODBC 3.x, but there does not seem te be any equivalent. + OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_ODBC_SQL_CONFORMANCE,nValue,*this); + SAL_WARN_IF(! (nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED), + "connectivity.odbc", + "SQL_ODBC_SQL_CONFORMANCE is neither MINIMAL nor CORE nor EXTENDED"); + return nValue == SQL_OSC_MINIMUM || nValue == SQL_OSC_CORE || nValue == SQL_OSC_EXTENDED; } sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException, std::exception) |