summaryrefslogtreecommitdiffstats
path: root/connectivity
diff options
context:
space:
mode:
authorLionel Elie Mamane <lionel@mamane.lu>2012-02-14 06:27:51 +0100
committerLionel Elie Mamane <lionel@mamane.lu>2012-02-14 15:07:04 +0100
commit50e5118710c84461b0e09dc0576e924ea149f6d4 (patch)
treea7eeb9d9d9a08043cb35e678f5c4c95786bb95f6 /connectivity
parentcorrect documentation of com::sun::star::sdbc::XDatabaseMetaData (diff)
downloadcore-50e5118710c84461b0e09dc0576e924ea149f6d4.tar.gz
core-50e5118710c84461b0e09dc0576e924ea149f6d4.zip
odbc getTableTypes: ask the driver instead of guessing
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx39
1 files changed, 7 insertions, 32 deletions
diff --git a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
index 093c6d9840f2..783e25906177 100644
--- a/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
+++ b/connectivity/source/drivers/odbcbase/ODatabaseMetaData.cxx
@@ -728,43 +728,18 @@ sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException,
// -------------------------------------------------------------------------
Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException)
{
-
- // there exists no possibility to get table types so we have to check
- static ::rtl::OUString sTableTypes[] =
- {
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TABLE")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("VIEW")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYSTEM TABLE")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("GLOBAL TEMPORARY")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("LOCAL TEMPORARY")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ALIAS")),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("SYNONYM"))
- };
- sal_Int32 nSize = sizeof(sTableTypes) / sizeof(::rtl::OUString);
- ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
- Reference< XResultSet > xRef = pResult;
- SQLUINTEGER nValue = 0;
+ Reference< XResultSet > xRef;
try
{
- OTools::GetInfo(m_pConnection,m_aConnectionHandle,SQL_CREATE_VIEW,nValue,*this);
- }
- catch(const Exception&)
- {
+ ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(m_pConnection);
+ xRef = pResult;
+ pResult->openTablesTypes();
}
- sal_Bool bViewsSupported = (nValue & SQL_CV_CREATE_VIEW) == SQL_CV_CREATE_VIEW;
-
- ::connectivity::ODatabaseMetaDataResultSet::ORows aRows;
- for(sal_Int32 i=0;i < nSize;++i)
+ catch(SQLException&)
{
- if( !bViewsSupported && i == 1)
- continue; // no views supported
- ::connectivity::ODatabaseMetaDataResultSet::ORow aRow;
- aRow.push_back(::connectivity::ODatabaseMetaDataResultSet::getEmptyValue());
- aRow.push_back(new ::connectivity::ORowSetValueDecorator(sTableTypes[i]));
- aRows.push_back(aRow);
+ xRef = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes);
}
- pResult->setRows(aRows);
- return xRef;
+ return xRef;
}
// -------------------------------------------------------------------------
sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( )