1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_connectivity.hxx" 30*cdf0e10cSrcweir #include "ado/ADatabaseMetaData.hxx" 31*cdf0e10cSrcweir #include "ado/ADatabaseMetaDataResultSet.hxx" 32*cdf0e10cSrcweir #include <com/sun/star/sdbc/DataType.hpp> 33*cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetType.hpp> 34*cdf0e10cSrcweir #include <com/sun/star/sdbc/ResultSetConcurrency.hpp> 35*cdf0e10cSrcweir #include <com/sun/star/sdbc/TransactionIsolation.hpp> 36*cdf0e10cSrcweir #include "ado/AConnection.hxx" 37*cdf0e10cSrcweir #include "ado/adoimp.hxx" 38*cdf0e10cSrcweir #include "FDatabaseMetaDataResultSet.hxx" 39*cdf0e10cSrcweir #include <comphelper/types.hxx> 40*cdf0e10cSrcweir #include <connectivity/dbexception.hxx> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir using namespace ::comphelper; 43*cdf0e10cSrcweir 44*cdf0e10cSrcweir using namespace connectivity; 45*cdf0e10cSrcweir using namespace connectivity::ado; 46*cdf0e10cSrcweir using namespace com::sun::star::uno; 47*cdf0e10cSrcweir using namespace com::sun::star::lang; 48*cdf0e10cSrcweir using namespace com::sun::star::beans; 49*cdf0e10cSrcweir using namespace com::sun::star::sdbc; 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir // using namespace connectivity; 53*cdf0e10cSrcweir 54*cdf0e10cSrcweir ODatabaseMetaData::ODatabaseMetaData(OConnection* _pCon) 55*cdf0e10cSrcweir : ::connectivity::ODatabaseMetaDataBase(_pCon,_pCon->getConnectionInfo()) 56*cdf0e10cSrcweir ,m_pADOConnection(_pCon->getConnection()) 57*cdf0e10cSrcweir ,m_pConnection(_pCon) 58*cdf0e10cSrcweir { 59*cdf0e10cSrcweir } 60*cdf0e10cSrcweir // ------------------------------------------------------------------------- 61*cdf0e10cSrcweir sal_Int32 ODatabaseMetaData::getInt32Property(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 62*cdf0e10cSrcweir { 63*cdf0e10cSrcweir connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties()); 64*cdf0e10cSrcweir // ADOS::ThrowException(*m_pADOConnection,*this); 65*cdf0e10cSrcweir OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection"); 66*cdf0e10cSrcweir ADO_PROP(_aProperty); 67*cdf0e10cSrcweir sal_Int32 nValue(0); 68*cdf0e10cSrcweir if(!aVar.isNull() && !aVar.isEmpty()) 69*cdf0e10cSrcweir nValue = aVar; 70*cdf0e10cSrcweir return nValue; 71*cdf0e10cSrcweir } 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir // ------------------------------------------------------------------------- 74*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::getBoolProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties()); 77*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 78*cdf0e10cSrcweir OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection"); 79*cdf0e10cSrcweir ADO_PROP(_aProperty); 80*cdf0e10cSrcweir return (!aVar.isNull() && !aVar.isEmpty() ? aVar.getBool() : sal_False); 81*cdf0e10cSrcweir } 82*cdf0e10cSrcweir // ------------------------------------------------------------------------- 83*cdf0e10cSrcweir ::rtl::OUString ODatabaseMetaData::getStringProperty(const ::rtl::OUString& _aProperty) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException) 84*cdf0e10cSrcweir { 85*cdf0e10cSrcweir connectivity::ado::WpADOProperties aProps(m_pADOConnection->get_Properties()); 86*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 87*cdf0e10cSrcweir OSL_ENSURE(aProps.IsValid(),"There are no properties at the connection"); 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir ADO_PROP(_aProperty); 90*cdf0e10cSrcweir ::rtl::OUString aValue; 91*cdf0e10cSrcweir if(!aVar.isNull() && !aVar.isEmpty() && aVar.getType() == VT_BSTR) 92*cdf0e10cSrcweir aValue = aVar; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir return aValue; 95*cdf0e10cSrcweir } 96*cdf0e10cSrcweir // ------------------------------------------------------------------------- 97*cdf0e10cSrcweir Reference< XResultSet > ODatabaseMetaData::impl_getTypeInfo_throw( ) 98*cdf0e10cSrcweir { 99*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getTypeInfo(); 100*cdf0e10cSrcweir // ADOS::ThrowException(*m_pADOConnection,*this); 101*cdf0e10cSrcweir 102*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 103*cdf0e10cSrcweir pResult->setTypeInfoMap(ADOS::isJetEngine(m_pConnection->getEngineType())); 104*cdf0e10cSrcweir Reference< XResultSet > xRef = pResult; 105*cdf0e10cSrcweir return xRef; 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir // ------------------------------------------------------------------------- 108*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCatalogs( ) throw(SQLException, RuntimeException) 109*cdf0e10cSrcweir { 110*cdf0e10cSrcweir OLEVariant vtEmpty; 111*cdf0e10cSrcweir vtEmpty.setNoArg(); 112*cdf0e10cSrcweir 113*cdf0e10cSrcweir ADORecordset *pRecordset = NULL; 114*cdf0e10cSrcweir m_pADOConnection->OpenSchema(adSchemaCatalogs,vtEmpty,vtEmpty,&pRecordset); 115*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir Reference< XResultSet > xRef; 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 120*cdf0e10cSrcweir pResult->setCatalogsMap(); 121*cdf0e10cSrcweir xRef = pResult; 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir return xRef; 124*cdf0e10cSrcweir } 125*cdf0e10cSrcweir // ------------------------------------------------------------------------- 126*cdf0e10cSrcweir ::rtl::OUString ODatabaseMetaData::impl_getCatalogSeparator_throw( ) 127*cdf0e10cSrcweir { 128*cdf0e10cSrcweir return getLiteral(DBLITERAL_CATALOG_SEPARATOR); 129*cdf0e10cSrcweir } 130*cdf0e10cSrcweir // ------------------------------------------------------------------------- 131*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getSchemas( ) throw(SQLException, RuntimeException) 132*cdf0e10cSrcweir { 133*cdf0e10cSrcweir OLEVariant vtEmpty; 134*cdf0e10cSrcweir vtEmpty.setNoArg(); 135*cdf0e10cSrcweir 136*cdf0e10cSrcweir ADORecordset *pRecordset = NULL; 137*cdf0e10cSrcweir m_pADOConnection->OpenSchema(adSchemaSchemata,vtEmpty,vtEmpty,&pRecordset); 138*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir Reference< XResultSet > xRef; 141*cdf0e10cSrcweir 142*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 143*cdf0e10cSrcweir pResult->setSchemasMap(); 144*cdf0e10cSrcweir xRef = pResult; 145*cdf0e10cSrcweir return xRef; 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir // ------------------------------------------------------------------------- 148*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumnPrivileges( 149*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, 150*cdf0e10cSrcweir const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) 151*cdf0e10cSrcweir { 152*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getColumnPrivileges(catalog,schema,table,columnNamePattern); 153*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir Reference< XResultSet > xRef; 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 158*cdf0e10cSrcweir pResult->setColumnPrivilegesMap(); 159*cdf0e10cSrcweir xRef = pResult; 160*cdf0e10cSrcweir return xRef; 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir // ------------------------------------------------------------------------- 163*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getColumns( 164*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern, 165*cdf0e10cSrcweir const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getColumns(catalog,schemaPattern,tableNamePattern,columnNamePattern); 168*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 169*cdf0e10cSrcweir 170*cdf0e10cSrcweir Reference< XResultSet > xRef; 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 173*cdf0e10cSrcweir pResult->setColumnsMap(); 174*cdf0e10cSrcweir xRef = pResult; 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir return xRef; 177*cdf0e10cSrcweir } 178*cdf0e10cSrcweir // ------------------------------------------------------------------------- 179*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTables( 180*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schemaPattern, 181*cdf0e10cSrcweir const ::rtl::OUString& tableNamePattern, const Sequence< ::rtl::OUString >& types ) throw(SQLException, RuntimeException) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getTables(catalog,schemaPattern,tableNamePattern,types); 184*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 185*cdf0e10cSrcweir 186*cdf0e10cSrcweir Reference< XResultSet > xRef; 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 189*cdf0e10cSrcweir pResult->setTablesMap(); 190*cdf0e10cSrcweir xRef = pResult; 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir return xRef; 193*cdf0e10cSrcweir } 194*cdf0e10cSrcweir // ------------------------------------------------------------------------- 195*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedureColumns( 196*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schemaPattern, 197*cdf0e10cSrcweir const ::rtl::OUString& procedureNamePattern, const ::rtl::OUString& columnNamePattern ) throw(SQLException, RuntimeException) 198*cdf0e10cSrcweir { 199*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getProcedureColumns(catalog,schemaPattern,procedureNamePattern,columnNamePattern); 200*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 201*cdf0e10cSrcweir 202*cdf0e10cSrcweir Reference< XResultSet > xRef; 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 205*cdf0e10cSrcweir pResult->setProcedureColumnsMap(); 206*cdf0e10cSrcweir xRef = pResult; 207*cdf0e10cSrcweir 208*cdf0e10cSrcweir return xRef; 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir // ------------------------------------------------------------------------- 211*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getProcedures( 212*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schemaPattern, 213*cdf0e10cSrcweir const ::rtl::OUString& procedureNamePattern ) throw(SQLException, RuntimeException) 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir // Create elements used in the array 216*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getProcedures(catalog,schemaPattern,procedureNamePattern); 217*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir Reference< XResultSet > xRef; 220*cdf0e10cSrcweir 221*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 222*cdf0e10cSrcweir pResult->setProceduresMap(); 223*cdf0e10cSrcweir xRef = pResult; 224*cdf0e10cSrcweir 225*cdf0e10cSrcweir return xRef; 226*cdf0e10cSrcweir } 227*cdf0e10cSrcweir // ------------------------------------------------------------------------- 228*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxBinaryLiteralLength( ) throw(SQLException, RuntimeException) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir return getMaxSize(DBLITERAL_BINARY_LITERAL); 231*cdf0e10cSrcweir } 232*cdf0e10cSrcweir // ------------------------------------------------------------------------- 233*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxRowSize( ) throw(SQLException, RuntimeException) 234*cdf0e10cSrcweir { 235*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Maximum Row Size")); 236*cdf0e10cSrcweir } 237*cdf0e10cSrcweir // ------------------------------------------------------------------------- 238*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCatalogNameLength( ) throw(SQLException, RuntimeException) 239*cdf0e10cSrcweir { 240*cdf0e10cSrcweir return getMaxSize(DBLITERAL_CATALOG_NAME); 241*cdf0e10cSrcweir } 242*cdf0e10cSrcweir // ------------------------------------------------------------------------- 243*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCharLiteralLength( ) throw(SQLException, RuntimeException) 244*cdf0e10cSrcweir { 245*cdf0e10cSrcweir return getMaxSize(DBLITERAL_CHAR_LITERAL); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir // ------------------------------------------------------------------------- 248*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnNameLength( ) throw(SQLException, RuntimeException) 249*cdf0e10cSrcweir { 250*cdf0e10cSrcweir return getMaxSize(DBLITERAL_COLUMN_NAME); 251*cdf0e10cSrcweir } 252*cdf0e10cSrcweir // ------------------------------------------------------------------------- 253*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInIndex( ) throw(SQLException, RuntimeException) 254*cdf0e10cSrcweir { 255*cdf0e10cSrcweir // return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Index")); 256*cdf0e10cSrcweir return 0; 257*cdf0e10cSrcweir } 258*cdf0e10cSrcweir // ------------------------------------------------------------------------- 259*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxCursorNameLength( ) throw(SQLException, RuntimeException) 260*cdf0e10cSrcweir { 261*cdf0e10cSrcweir return getMaxSize(DBLITERAL_CURSOR_NAME); 262*cdf0e10cSrcweir } 263*cdf0e10cSrcweir // ------------------------------------------------------------------------- 264*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxConnections( ) throw(SQLException, RuntimeException) 265*cdf0e10cSrcweir { 266*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Active Sessions")); 267*cdf0e10cSrcweir } 268*cdf0e10cSrcweir // ------------------------------------------------------------------------- 269*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInTable( ) throw(SQLException, RuntimeException) 270*cdf0e10cSrcweir { 271*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Table")); 272*cdf0e10cSrcweir } 273*cdf0e10cSrcweir // ------------------------------------------------------------------------- 274*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxStatementLength( ) throw(SQLException, RuntimeException) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir return getMaxSize(DBLITERAL_TEXT_COMMAND); 277*cdf0e10cSrcweir } 278*cdf0e10cSrcweir // ------------------------------------------------------------------------- 279*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxTableNameLength( ) throw(SQLException, RuntimeException) 280*cdf0e10cSrcweir { 281*cdf0e10cSrcweir return getMaxSize(DBLITERAL_TABLE_NAME); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir // ------------------------------------------------------------------------- 284*cdf0e10cSrcweir sal_Int32 ODatabaseMetaData::impl_getMaxTablesInSelect_throw( ) 285*cdf0e10cSrcweir { 286*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Maximum Tables in SELECT")); 287*cdf0e10cSrcweir } 288*cdf0e10cSrcweir // ------------------------------------------------------------------------- 289*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getExportedKeys( 290*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) 291*cdf0e10cSrcweir { 292*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getExportedKeys(catalog,schema,table); 293*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 294*cdf0e10cSrcweir 295*cdf0e10cSrcweir Reference< XResultSet > xRef; 296*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 297*cdf0e10cSrcweir pResult->setCrossReferenceMap(); 298*cdf0e10cSrcweir xRef = pResult; 299*cdf0e10cSrcweir 300*cdf0e10cSrcweir return xRef; 301*cdf0e10cSrcweir } 302*cdf0e10cSrcweir // ------------------------------------------------------------------------- 303*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getImportedKeys( 304*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) 305*cdf0e10cSrcweir { 306*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getImportedKeys(catalog,schema,table); 307*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 308*cdf0e10cSrcweir 309*cdf0e10cSrcweir Reference< XResultSet > xRef; 310*cdf0e10cSrcweir 311*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 312*cdf0e10cSrcweir pResult->setCrossReferenceMap(); 313*cdf0e10cSrcweir xRef = pResult; 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir return xRef; 316*cdf0e10cSrcweir } 317*cdf0e10cSrcweir // ------------------------------------------------------------------------- 318*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getPrimaryKeys( 319*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table ) throw(SQLException, RuntimeException) 320*cdf0e10cSrcweir { 321*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getPrimaryKeys(catalog,schema,table); 322*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 323*cdf0e10cSrcweir 324*cdf0e10cSrcweir Reference< XResultSet > xRef; 325*cdf0e10cSrcweir 326*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 327*cdf0e10cSrcweir pResult->setPrimaryKeysMap(); 328*cdf0e10cSrcweir xRef = pResult; 329*cdf0e10cSrcweir 330*cdf0e10cSrcweir return xRef; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir // ------------------------------------------------------------------------- 333*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getIndexInfo( 334*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schema, const ::rtl::OUString& table, 335*cdf0e10cSrcweir sal_Bool unique, sal_Bool approximate ) throw(SQLException, RuntimeException) 336*cdf0e10cSrcweir { 337*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getIndexInfo(catalog,schema,table,unique,approximate); 338*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 339*cdf0e10cSrcweir 340*cdf0e10cSrcweir Reference< XResultSet > xRef; 341*cdf0e10cSrcweir 342*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 343*cdf0e10cSrcweir pResult->setIndexInfoMap(); 344*cdf0e10cSrcweir xRef = pResult; 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir return xRef; 347*cdf0e10cSrcweir } 348*cdf0e10cSrcweir // ------------------------------------------------------------------------- 349*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTablePrivileges( 350*cdf0e10cSrcweir const Any& catalog, const ::rtl::OUString& schemaPattern, const ::rtl::OUString& tableNamePattern ) throw(SQLException, RuntimeException) 351*cdf0e10cSrcweir { 352*cdf0e10cSrcweir Reference< XResultSet > xRef; 353*cdf0e10cSrcweir if(!ADOS::isJetEngine(m_pConnection->getEngineType())) 354*cdf0e10cSrcweir { // the jet provider doesn't support this method 355*cdf0e10cSrcweir // Create elements used in the array 356*cdf0e10cSrcweir 357*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getTablePrivileges(catalog,schemaPattern,tableNamePattern); 358*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 359*cdf0e10cSrcweir 360*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 361*cdf0e10cSrcweir pResult->setTablePrivilegesMap(); 362*cdf0e10cSrcweir xRef = pResult; 363*cdf0e10cSrcweir } 364*cdf0e10cSrcweir else 365*cdf0e10cSrcweir { 366*cdf0e10cSrcweir ::connectivity::ODatabaseMetaDataResultSet* pResult = new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTablePrivileges); 367*cdf0e10cSrcweir xRef = pResult; 368*cdf0e10cSrcweir ::connectivity::ODatabaseMetaDataResultSet::ORows aRows; 369*cdf0e10cSrcweir ::connectivity::ODatabaseMetaDataResultSet::ORow aRow(8); 370*cdf0e10cSrcweir aRows.reserve(8); 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir aRow[0] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); 373*cdf0e10cSrcweir aRow[1] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); 374*cdf0e10cSrcweir aRow[2] = new ::connectivity::ORowSetValueDecorator(tableNamePattern); 375*cdf0e10cSrcweir aRow[3] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); 376*cdf0e10cSrcweir aRow[4] = ::connectivity::ODatabaseMetaDataResultSet::getEmptyValue(); 377*cdf0e10cSrcweir aRow[5] = new ::connectivity::ORowSetValueDecorator(getUserName()); 378*cdf0e10cSrcweir aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getSelectValue(); 379*cdf0e10cSrcweir aRow[7] = new ::connectivity::ORowSetValueDecorator(::rtl::OUString::createFromAscii("NO")); 380*cdf0e10cSrcweir 381*cdf0e10cSrcweir aRows.push_back(aRow); 382*cdf0e10cSrcweir aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getInsertValue(); 383*cdf0e10cSrcweir aRows.push_back(aRow); 384*cdf0e10cSrcweir aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDeleteValue(); 385*cdf0e10cSrcweir aRows.push_back(aRow); 386*cdf0e10cSrcweir aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getUpdateValue(); 387*cdf0e10cSrcweir aRows.push_back(aRow); 388*cdf0e10cSrcweir aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getCreateValue(); 389*cdf0e10cSrcweir aRows.push_back(aRow); 390*cdf0e10cSrcweir aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getReadValue(); 391*cdf0e10cSrcweir aRows.push_back(aRow); 392*cdf0e10cSrcweir aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getAlterValue(); 393*cdf0e10cSrcweir aRows.push_back(aRow); 394*cdf0e10cSrcweir aRow[6] = ::connectivity::ODatabaseMetaDataResultSet::getDropValue(); 395*cdf0e10cSrcweir aRows.push_back(aRow); 396*cdf0e10cSrcweir pResult->setRows(aRows); 397*cdf0e10cSrcweir } 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir return xRef; 400*cdf0e10cSrcweir } 401*cdf0e10cSrcweir // ------------------------------------------------------------------------- 402*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getCrossReference( 403*cdf0e10cSrcweir const Any& primaryCatalog, const ::rtl::OUString& primarySchema, 404*cdf0e10cSrcweir const ::rtl::OUString& primaryTable, const Any& foreignCatalog, 405*cdf0e10cSrcweir const ::rtl::OUString& foreignSchema, const ::rtl::OUString& foreignTable ) throw(SQLException, RuntimeException) 406*cdf0e10cSrcweir { 407*cdf0e10cSrcweir ADORecordset *pRecordset = m_pADOConnection->getCrossReference(primaryCatalog,primarySchema,primaryTable,foreignCatalog,foreignSchema,foreignTable); 408*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 409*cdf0e10cSrcweir 410*cdf0e10cSrcweir Reference< XResultSet > xRef; 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir ODatabaseMetaDataResultSet* pResult = new ODatabaseMetaDataResultSet(pRecordset); 413*cdf0e10cSrcweir pResult->setCrossReferenceMap(); 414*cdf0e10cSrcweir xRef = pResult; 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir return xRef; 417*cdf0e10cSrcweir } 418*cdf0e10cSrcweir // ------------------------------------------------------------------------- 419*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::doesMaxRowSizeIncludeBlobs( ) throw(SQLException, RuntimeException) 420*cdf0e10cSrcweir { 421*cdf0e10cSrcweir return getBoolProperty(::rtl::OUString::createFromAscii("Maximum Row Size Includes BLOB")); 422*cdf0e10cSrcweir } 423*cdf0e10cSrcweir // ------------------------------------------------------------------------- 424*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) 425*cdf0e10cSrcweir { 426*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ; 427*cdf0e10cSrcweir } 428*cdf0e10cSrcweir // ------------------------------------------------------------------------- 429*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::storesLowerCaseIdentifiers( ) throw(SQLException, RuntimeException) 430*cdf0e10cSrcweir { 431*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_LOWER) == DBPROPVAL_IC_LOWER ; 432*cdf0e10cSrcweir } 433*cdf0e10cSrcweir // ------------------------------------------------------------------------- 434*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::impl_storesMixedCaseQuotedIdentifiers_throw( ) 435*cdf0e10cSrcweir { 436*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ; 437*cdf0e10cSrcweir } 438*cdf0e10cSrcweir // ------------------------------------------------------------------------- 439*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::storesMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) 440*cdf0e10cSrcweir { 441*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED ; 442*cdf0e10cSrcweir } 443*cdf0e10cSrcweir // ------------------------------------------------------------------------- 444*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseQuotedIdentifiers( ) throw(SQLException, RuntimeException) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ; 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir // ------------------------------------------------------------------------- 449*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::storesUpperCaseIdentifiers( ) throw(SQLException, RuntimeException) 450*cdf0e10cSrcweir { 451*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_UPPER) == DBPROPVAL_IC_UPPER ; 452*cdf0e10cSrcweir } 453*cdf0e10cSrcweir // ------------------------------------------------------------------------- 454*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithAddColumn_throw( ) 455*cdf0e10cSrcweir { 456*cdf0e10cSrcweir return sal_True; 457*cdf0e10cSrcweir } 458*cdf0e10cSrcweir // ------------------------------------------------------------------------- 459*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::impl_supportsAlterTableWithDropColumn_throw( ) 460*cdf0e10cSrcweir { 461*cdf0e10cSrcweir return sal_True; 462*cdf0e10cSrcweir } 463*cdf0e10cSrcweir // ------------------------------------------------------------------------- 464*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxIndexLength( ) throw(SQLException, RuntimeException) 465*cdf0e10cSrcweir { 466*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Maximum Index Size")); 467*cdf0e10cSrcweir } 468*cdf0e10cSrcweir // ------------------------------------------------------------------------- 469*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsNonNullableColumns( ) throw(SQLException, RuntimeException) 470*cdf0e10cSrcweir { 471*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NON_NULL; 472*cdf0e10cSrcweir } 473*cdf0e10cSrcweir // ------------------------------------------------------------------------- 474*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getCatalogTerm( ) throw(SQLException, RuntimeException) 475*cdf0e10cSrcweir { 476*cdf0e10cSrcweir return getStringProperty(::rtl::OUString::createFromAscii("Catalog Term")); 477*cdf0e10cSrcweir } 478*cdf0e10cSrcweir // ------------------------------------------------------------------------- 479*cdf0e10cSrcweir ::rtl::OUString ODatabaseMetaData::impl_getIdentifierQuoteString_throw( ) 480*cdf0e10cSrcweir { 481*cdf0e10cSrcweir return getLiteral(DBLITERAL_QUOTE_PREFIX); 482*cdf0e10cSrcweir 483*cdf0e10cSrcweir } 484*cdf0e10cSrcweir // ------------------------------------------------------------------------- 485*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getExtraNameCharacters( ) throw(SQLException, RuntimeException) 486*cdf0e10cSrcweir { 487*cdf0e10cSrcweir // return getStringProperty(::rtl::OUString::createFromAscii("Special Characters")); 488*cdf0e10cSrcweir return ::rtl::OUString(); 489*cdf0e10cSrcweir } 490*cdf0e10cSrcweir // ------------------------------------------------------------------------- 491*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsDifferentTableCorrelationNames( ) throw(SQLException, RuntimeException) 492*cdf0e10cSrcweir { 493*cdf0e10cSrcweir return isCapable(DBLITERAL_CORRELATION_NAME); 494*cdf0e10cSrcweir } 495*cdf0e10cSrcweir // ------------------------------------------------------------------------- 496*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::impl_isCatalogAtStart_throw( ) 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Catalog Location")) == DBPROPVAL_CL_START; 499*cdf0e10cSrcweir } 500*cdf0e10cSrcweir // ------------------------------------------------------------------------- 501*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionIgnoredInTransactions( ) throw(SQLException, RuntimeException) 502*cdf0e10cSrcweir { 503*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_IGNORE; 504*cdf0e10cSrcweir } 505*cdf0e10cSrcweir // ------------------------------------------------------------------------- 506*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::dataDefinitionCausesTransactionCommit( ) throw(SQLException, RuntimeException) 507*cdf0e10cSrcweir { 508*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DDL_COMMIT; 509*cdf0e10cSrcweir } 510*cdf0e10cSrcweir // ------------------------------------------------------------------------- 511*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsDataManipulationTransactionsOnly( ) throw(SQLException, RuntimeException) 512*cdf0e10cSrcweir { 513*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_DML; 514*cdf0e10cSrcweir } 515*cdf0e10cSrcweir // ------------------------------------------------------------------------- 516*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsDataDefinitionAndDataManipulationTransactions( ) throw(SQLException, RuntimeException) 517*cdf0e10cSrcweir { 518*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_ALL; 519*cdf0e10cSrcweir } 520*cdf0e10cSrcweir // ------------------------------------------------------------------------- 521*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedDelete( ) throw(SQLException, RuntimeException) 522*cdf0e10cSrcweir { 523*cdf0e10cSrcweir return sal_True; 524*cdf0e10cSrcweir } 525*cdf0e10cSrcweir // ------------------------------------------------------------------------- 526*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsPositionedUpdate( ) throw(SQLException, RuntimeException) 527*cdf0e10cSrcweir { 528*cdf0e10cSrcweir return sal_True; 529*cdf0e10cSrcweir } 530*cdf0e10cSrcweir // ------------------------------------------------------------------------- 531*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossRollback( ) throw(SQLException, RuntimeException) 532*cdf0e10cSrcweir { 533*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Prepare Abort Behavior")) == DBPROPVAL_CB_PRESERVE; 534*cdf0e10cSrcweir } 535*cdf0e10cSrcweir // ------------------------------------------------------------------------- 536*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenStatementsAcrossCommit( ) throw(SQLException, RuntimeException) 537*cdf0e10cSrcweir { 538*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Prepare Commit Behavior")) == DBPROPVAL_CB_PRESERVE; 539*cdf0e10cSrcweir } 540*cdf0e10cSrcweir // ------------------------------------------------------------------------- 541*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossCommit( ) throw(SQLException, RuntimeException) 542*cdf0e10cSrcweir { 543*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_COMMIT) == DBPROPVAL_TR_COMMIT; 544*cdf0e10cSrcweir } 545*cdf0e10cSrcweir // ------------------------------------------------------------------------- 546*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsOpenCursorsAcrossRollback( ) throw(SQLException, RuntimeException) 547*cdf0e10cSrcweir { 548*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Isolation Retention")) & DBPROPVAL_TR_ABORT) == DBPROPVAL_TR_ABORT; 549*cdf0e10cSrcweir } 550*cdf0e10cSrcweir // ------------------------------------------------------------------------- 551*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactionIsolationLevel( sal_Int32 level ) throw(SQLException, RuntimeException) 552*cdf0e10cSrcweir { 553*cdf0e10cSrcweir sal_Bool bValue(sal_False); 554*cdf0e10cSrcweir 555*cdf0e10cSrcweir sal_Int32 nTxn = getInt32Property(::rtl::OUString::createFromAscii("Isolation Levels")); 556*cdf0e10cSrcweir if(level == TransactionIsolation::NONE) 557*cdf0e10cSrcweir bValue = sal_True; 558*cdf0e10cSrcweir else if(level == TransactionIsolation::READ_UNCOMMITTED) 559*cdf0e10cSrcweir bValue = (nTxn & DBPROPVAL_TI_READUNCOMMITTED) == DBPROPVAL_TI_READUNCOMMITTED; 560*cdf0e10cSrcweir else if(level == TransactionIsolation::READ_COMMITTED) 561*cdf0e10cSrcweir bValue = (nTxn & DBPROPVAL_TI_READCOMMITTED) == DBPROPVAL_TI_READCOMMITTED; 562*cdf0e10cSrcweir else if(level == TransactionIsolation::REPEATABLE_READ) 563*cdf0e10cSrcweir bValue = (nTxn & DBPROPVAL_TI_REPEATABLEREAD) == DBPROPVAL_TI_REPEATABLEREAD; 564*cdf0e10cSrcweir else if(level == TransactionIsolation::SERIALIZABLE) 565*cdf0e10cSrcweir bValue = (nTxn & DBPROPVAL_TI_SERIALIZABLE) == DBPROPVAL_TI_SERIALIZABLE; 566*cdf0e10cSrcweir 567*cdf0e10cSrcweir return bValue; 568*cdf0e10cSrcweir } 569*cdf0e10cSrcweir // ------------------------------------------------------------------------- 570*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::impl_supportsSchemasInDataManipulation_throw( ) 571*cdf0e10cSrcweir { 572*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_DML_STATEMENTS) == DBPROPVAL_SU_DML_STATEMENTS; 573*cdf0e10cSrcweir } 574*cdf0e10cSrcweir // ------------------------------------------------------------------------- 575*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92FullSQL( ) throw(SQLException, RuntimeException) 576*cdf0e10cSrcweir { 577*cdf0e10cSrcweir sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); 578*cdf0e10cSrcweir return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_FULL) == DBPROPVAL_SQL_ANSI92_FULL); 579*cdf0e10cSrcweir } 580*cdf0e10cSrcweir // ------------------------------------------------------------------------- 581*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92EntryLevelSQL( ) throw(SQLException, RuntimeException) 582*cdf0e10cSrcweir { 583*cdf0e10cSrcweir sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); 584*cdf0e10cSrcweir return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_ENTRY) == DBPROPVAL_SQL_ANSI92_ENTRY); 585*cdf0e10cSrcweir } 586*cdf0e10cSrcweir // ------------------------------------------------------------------------- 587*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsIntegrityEnhancementFacility( ) throw(SQLException, RuntimeException) 588*cdf0e10cSrcweir { 589*cdf0e10cSrcweir sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); 590*cdf0e10cSrcweir return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI89_IEF) == DBPROPVAL_SQL_ANSI89_IEF); 591*cdf0e10cSrcweir } 592*cdf0e10cSrcweir // ------------------------------------------------------------------------- 593*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInIndexDefinitions( ) throw(SQLException, RuntimeException) 594*cdf0e10cSrcweir { 595*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_INDEX_DEFINITION) == DBPROPVAL_SU_INDEX_DEFINITION; 596*cdf0e10cSrcweir } 597*cdf0e10cSrcweir // ------------------------------------------------------------------------- 598*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::impl_supportsSchemasInTableDefinitions_throw( ) 599*cdf0e10cSrcweir { 600*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_TABLE_DEFINITION) == DBPROPVAL_SU_TABLE_DEFINITION; 601*cdf0e10cSrcweir } 602*cdf0e10cSrcweir // ------------------------------------------------------------------------- 603*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::impl_supportsCatalogsInTableDefinitions_throw( ) 604*cdf0e10cSrcweir { 605*cdf0e10cSrcweir // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_TABLE_DEFINITION) == DBPROPVAL_CU_TABLE_DEFINITION; 606*cdf0e10cSrcweir return sal_False; 607*cdf0e10cSrcweir } 608*cdf0e10cSrcweir // ------------------------------------------------------------------------- 609*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInIndexDefinitions( ) throw(SQLException, RuntimeException) 610*cdf0e10cSrcweir { 611*cdf0e10cSrcweir // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_INDEX_DEFINITION) == DBPROPVAL_CU_INDEX_DEFINITION; 612*cdf0e10cSrcweir return sal_False; 613*cdf0e10cSrcweir } 614*cdf0e10cSrcweir // ------------------------------------------------------------------------- 615*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::impl_supportsCatalogsInDataManipulation_throw( ) 616*cdf0e10cSrcweir { 617*cdf0e10cSrcweir // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_DML_STATEMENTS) == DBPROPVAL_CU_DML_STATEMENTS; 618*cdf0e10cSrcweir return sal_False; 619*cdf0e10cSrcweir } 620*cdf0e10cSrcweir // ------------------------------------------------------------------------- 621*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsOuterJoins( ) throw(SQLException, RuntimeException) 622*cdf0e10cSrcweir { 623*cdf0e10cSrcweir if ( ADOS::isJetEngine(m_pConnection->getEngineType()) ) 624*cdf0e10cSrcweir return sal_True; 625*cdf0e10cSrcweir return getBoolProperty(::rtl::OUString::createFromAscii("Outer Join Capabilities")); 626*cdf0e10cSrcweir } 627*cdf0e10cSrcweir // ------------------------------------------------------------------------- 628*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getTableTypes( ) throw(SQLException, RuntimeException) 629*cdf0e10cSrcweir { 630*cdf0e10cSrcweir return new ::connectivity::ODatabaseMetaDataResultSet(::connectivity::ODatabaseMetaDataResultSet::eTableTypes); 631*cdf0e10cSrcweir } 632*cdf0e10cSrcweir // ------------------------------------------------------------------------- 633*cdf0e10cSrcweir sal_Int32 ODatabaseMetaData::impl_getMaxStatements_throw( ) 634*cdf0e10cSrcweir { 635*cdf0e10cSrcweir return 0; 636*cdf0e10cSrcweir } 637*cdf0e10cSrcweir // ------------------------------------------------------------------------- 638*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxProcedureNameLength( ) throw(SQLException, RuntimeException) 639*cdf0e10cSrcweir { 640*cdf0e10cSrcweir return getMaxSize(DBLITERAL_PROCEDURE_NAME); 641*cdf0e10cSrcweir } 642*cdf0e10cSrcweir // ------------------------------------------------------------------------- 643*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxSchemaNameLength( ) throw(SQLException, RuntimeException) 644*cdf0e10cSrcweir { 645*cdf0e10cSrcweir return getMaxSize(DBLITERAL_SCHEMA_NAME); 646*cdf0e10cSrcweir } 647*cdf0e10cSrcweir // ------------------------------------------------------------------------- 648*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsTransactions( ) throw(SQLException, RuntimeException) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Transaction DDL")) == DBPROPVAL_TC_NONE; 651*cdf0e10cSrcweir } 652*cdf0e10cSrcweir // ------------------------------------------------------------------------- 653*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::allProceduresAreCallable( ) throw(SQLException, RuntimeException) 654*cdf0e10cSrcweir { 655*cdf0e10cSrcweir return sal_True; 656*cdf0e10cSrcweir } 657*cdf0e10cSrcweir // ------------------------------------------------------------------------- 658*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsStoredProcedures( ) throw(SQLException, RuntimeException) 659*cdf0e10cSrcweir { 660*cdf0e10cSrcweir return sal_True; 661*cdf0e10cSrcweir } 662*cdf0e10cSrcweir // ------------------------------------------------------------------------- 663*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsSelectForUpdate( ) throw(SQLException, RuntimeException) 664*cdf0e10cSrcweir { 665*cdf0e10cSrcweir return sal_True; 666*cdf0e10cSrcweir } 667*cdf0e10cSrcweir // ------------------------------------------------------------------------- 668*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::allTablesAreSelectable( ) throw(SQLException, RuntimeException) 669*cdf0e10cSrcweir { 670*cdf0e10cSrcweir return sal_True; 671*cdf0e10cSrcweir } 672*cdf0e10cSrcweir // ------------------------------------------------------------------------- 673*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::isReadOnly( ) throw(SQLException, RuntimeException) 674*cdf0e10cSrcweir { 675*cdf0e10cSrcweir return getBoolProperty(::rtl::OUString::createFromAscii("Read-Only Data Source")); 676*cdf0e10cSrcweir } 677*cdf0e10cSrcweir // ------------------------------------------------------------------------- 678*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFiles( ) throw(SQLException, RuntimeException) 679*cdf0e10cSrcweir { 680*cdf0e10cSrcweir return sal_False; 681*cdf0e10cSrcweir } 682*cdf0e10cSrcweir // ------------------------------------------------------------------------- 683*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::usesLocalFilePerTable( ) throw(SQLException, RuntimeException) 684*cdf0e10cSrcweir { 685*cdf0e10cSrcweir return sal_False; 686*cdf0e10cSrcweir } 687*cdf0e10cSrcweir // ------------------------------------------------------------------------- 688*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsTypeConversion( ) throw(SQLException, RuntimeException) 689*cdf0e10cSrcweir { 690*cdf0e10cSrcweir return sal_True; 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir // ------------------------------------------------------------------------- 693*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::nullPlusNonNullIsNull( ) throw(SQLException, RuntimeException) 694*cdf0e10cSrcweir { 695*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("NULL Concatenation Behavior")) == DBPROPVAL_CB_NULL; 696*cdf0e10cSrcweir } 697*cdf0e10cSrcweir // ------------------------------------------------------------------------- 698*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsColumnAliasing( ) throw(SQLException, RuntimeException) 699*cdf0e10cSrcweir { 700*cdf0e10cSrcweir return isCapable(DBLITERAL_COLUMN_ALIAS); 701*cdf0e10cSrcweir } 702*cdf0e10cSrcweir // ------------------------------------------------------------------------- 703*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsTableCorrelationNames( ) throw(SQLException, RuntimeException) 704*cdf0e10cSrcweir { 705*cdf0e10cSrcweir return isCapable(DBLITERAL_CORRELATION_NAME); 706*cdf0e10cSrcweir } 707*cdf0e10cSrcweir // ------------------------------------------------------------------------- 708*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsConvert( sal_Int32 /*fromType*/, sal_Int32 /*toType*/ ) throw(SQLException, RuntimeException) 709*cdf0e10cSrcweir { 710*cdf0e10cSrcweir return getBoolProperty(::rtl::OUString::createFromAscii("Rowset Conversions on Command")); 711*cdf0e10cSrcweir } 712*cdf0e10cSrcweir // ------------------------------------------------------------------------- 713*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsExpressionsInOrderBy( ) throw(SQLException, RuntimeException) 714*cdf0e10cSrcweir { 715*cdf0e10cSrcweir return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List")); 716*cdf0e10cSrcweir } 717*cdf0e10cSrcweir // ------------------------------------------------------------------------- 718*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupBy( ) throw(SQLException, RuntimeException) 719*cdf0e10cSrcweir { 720*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_NOT_SUPPORTED; 721*cdf0e10cSrcweir } 722*cdf0e10cSrcweir // ------------------------------------------------------------------------- 723*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByBeyondSelect( ) throw(SQLException, RuntimeException) 724*cdf0e10cSrcweir { 725*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) != DBPROPVAL_GB_CONTAINS_SELECT; 726*cdf0e10cSrcweir } 727*cdf0e10cSrcweir // ------------------------------------------------------------------------- 728*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsGroupByUnrelated( ) throw(SQLException, RuntimeException) 729*cdf0e10cSrcweir { 730*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("GROUP BY Support")) == DBPROPVAL_GB_NO_RELATION; 731*cdf0e10cSrcweir } 732*cdf0e10cSrcweir // ------------------------------------------------------------------------- 733*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleTransactions( ) throw(SQLException, RuntimeException) 734*cdf0e10cSrcweir { 735*cdf0e10cSrcweir return sal_True; 736*cdf0e10cSrcweir } 737*cdf0e10cSrcweir // ------------------------------------------------------------------------- 738*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsMultipleResultSets( ) throw(SQLException, RuntimeException) 739*cdf0e10cSrcweir { 740*cdf0e10cSrcweir return sal_False; 741*cdf0e10cSrcweir } 742*cdf0e10cSrcweir // ------------------------------------------------------------------------- 743*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsLikeEscapeClause( ) throw(SQLException, RuntimeException) 744*cdf0e10cSrcweir { 745*cdf0e10cSrcweir return isCapable(DBLITERAL_ESCAPE_PERCENT); 746*cdf0e10cSrcweir } 747*cdf0e10cSrcweir // ------------------------------------------------------------------------- 748*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsOrderByUnrelated( ) throw(SQLException, RuntimeException) 749*cdf0e10cSrcweir { 750*cdf0e10cSrcweir return getBoolProperty(::rtl::OUString::createFromAscii("ORDER BY Columns in Select List")); 751*cdf0e10cSrcweir } 752*cdf0e10cSrcweir // ------------------------------------------------------------------------- 753*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsUnion( ) throw(SQLException, RuntimeException) 754*cdf0e10cSrcweir { 755*cdf0e10cSrcweir return sal_True; 756*cdf0e10cSrcweir } 757*cdf0e10cSrcweir // ------------------------------------------------------------------------- 758*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsUnionAll( ) throw(SQLException, RuntimeException) 759*cdf0e10cSrcweir { 760*cdf0e10cSrcweir return sal_True; 761*cdf0e10cSrcweir } 762*cdf0e10cSrcweir // ------------------------------------------------------------------------- 763*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsMixedCaseIdentifiers( ) throw(SQLException, RuntimeException) 764*cdf0e10cSrcweir { 765*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED; 766*cdf0e10cSrcweir } 767*cdf0e10cSrcweir // ------------------------------------------------------------------------- 768*cdf0e10cSrcweir sal_Bool ODatabaseMetaData::impl_supportsMixedCaseQuotedIdentifiers_throw( ) 769*cdf0e10cSrcweir { 770*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Identifier Case Sensitivity")) & DBPROPVAL_IC_MIXED) == DBPROPVAL_IC_MIXED; 771*cdf0e10cSrcweir } 772*cdf0e10cSrcweir // ------------------------------------------------------------------------- 773*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtEnd( ) throw(SQLException, RuntimeException) 774*cdf0e10cSrcweir { 775*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_END) == DBPROPVAL_NC_END; 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir // ------------------------------------------------------------------------- 778*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedAtStart( ) throw(SQLException, RuntimeException) 779*cdf0e10cSrcweir { 780*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_START) == DBPROPVAL_NC_START; 781*cdf0e10cSrcweir } 782*cdf0e10cSrcweir // ------------------------------------------------------------------------- 783*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedHigh( ) throw(SQLException, RuntimeException) 784*cdf0e10cSrcweir { 785*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_HIGH) == DBPROPVAL_NC_HIGH; 786*cdf0e10cSrcweir } 787*cdf0e10cSrcweir // ------------------------------------------------------------------------- 788*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::nullsAreSortedLow( ) throw(SQLException, RuntimeException) 789*cdf0e10cSrcweir { 790*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("NULL Collation Order")) & DBPROPVAL_NC_LOW) == DBPROPVAL_NC_LOW; 791*cdf0e10cSrcweir } 792*cdf0e10cSrcweir // ------------------------------------------------------------------------- 793*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInProcedureCalls( ) throw(SQLException, RuntimeException) 794*cdf0e10cSrcweir { 795*cdf0e10cSrcweir return sal_False; 796*cdf0e10cSrcweir } 797*cdf0e10cSrcweir // ------------------------------------------------------------------------- 798*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsSchemasInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) 799*cdf0e10cSrcweir { 800*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Schema Usage")) & DBPROPVAL_SU_PRIVILEGE_DEFINITION) == DBPROPVAL_SU_PRIVILEGE_DEFINITION; 801*cdf0e10cSrcweir } 802*cdf0e10cSrcweir // ------------------------------------------------------------------------- 803*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInProcedureCalls( ) throw(SQLException, RuntimeException) 804*cdf0e10cSrcweir { 805*cdf0e10cSrcweir return sal_False; 806*cdf0e10cSrcweir } 807*cdf0e10cSrcweir // ------------------------------------------------------------------------- 808*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsCatalogsInPrivilegeDefinitions( ) throw(SQLException, RuntimeException) 809*cdf0e10cSrcweir { 810*cdf0e10cSrcweir // return (getInt32Property(::rtl::OUString::createFromAscii("Catalog Usage")) & DBPROPVAL_CU_PRIVILEGE_DEFINITION) == DBPROPVAL_CU_PRIVILEGE_DEFINITION; 811*cdf0e10cSrcweir return sal_False; 812*cdf0e10cSrcweir } 813*cdf0e10cSrcweir // ------------------------------------------------------------------------- 814*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsCorrelatedSubqueries( ) throw(SQLException, RuntimeException) 815*cdf0e10cSrcweir { 816*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_CORRELATEDSUBQUERIES) == DBPROPVAL_SQ_CORRELATEDSUBQUERIES; 817*cdf0e10cSrcweir } 818*cdf0e10cSrcweir // ------------------------------------------------------------------------- 819*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInComparisons( ) throw(SQLException, RuntimeException) 820*cdf0e10cSrcweir { 821*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_COMPARISON) == DBPROPVAL_SQ_COMPARISON; 822*cdf0e10cSrcweir } 823*cdf0e10cSrcweir // ------------------------------------------------------------------------- 824*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInExists( ) throw(SQLException, RuntimeException) 825*cdf0e10cSrcweir { 826*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_EXISTS) == DBPROPVAL_SQ_EXISTS; 827*cdf0e10cSrcweir } 828*cdf0e10cSrcweir // ------------------------------------------------------------------------- 829*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInIns( ) throw(SQLException, RuntimeException) 830*cdf0e10cSrcweir { 831*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_IN) == DBPROPVAL_SQ_IN; 832*cdf0e10cSrcweir } 833*cdf0e10cSrcweir // ------------------------------------------------------------------------- 834*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsSubqueriesInQuantifieds( ) throw(SQLException, RuntimeException) 835*cdf0e10cSrcweir { 836*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Subquery Support")) & DBPROPVAL_SQ_QUANTIFIED) == DBPROPVAL_SQ_QUANTIFIED; 837*cdf0e10cSrcweir } 838*cdf0e10cSrcweir // ------------------------------------------------------------------------- 839*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsANSI92IntermediateSQL( ) throw(SQLException, RuntimeException) 840*cdf0e10cSrcweir { 841*cdf0e10cSrcweir sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); 842*cdf0e10cSrcweir return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ANSI92_INTERMEDIATE) == DBPROPVAL_SQL_ANSI92_INTERMEDIATE); 843*cdf0e10cSrcweir } 844*cdf0e10cSrcweir // ------------------------------------------------------------------------- 845*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getURL( ) throw(SQLException, RuntimeException) 846*cdf0e10cSrcweir { 847*cdf0e10cSrcweir return ::rtl::OUString::createFromAscii("sdbc:ado:")+ m_pADOConnection->GetConnectionString(); 848*cdf0e10cSrcweir } 849*cdf0e10cSrcweir // ------------------------------------------------------------------------- 850*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getUserName( ) throw(SQLException, RuntimeException) 851*cdf0e10cSrcweir { 852*cdf0e10cSrcweir return getStringProperty(::rtl::OUString::createFromAscii("User Name")); 853*cdf0e10cSrcweir } 854*cdf0e10cSrcweir // ------------------------------------------------------------------------- 855*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverName( ) throw(SQLException, RuntimeException) 856*cdf0e10cSrcweir { 857*cdf0e10cSrcweir return getStringProperty(::rtl::OUString::createFromAscii("Provider Friendly Name")); 858*cdf0e10cSrcweir } 859*cdf0e10cSrcweir // ------------------------------------------------------------------------- 860*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getDriverVersion( ) throw(SQLException, RuntimeException) 861*cdf0e10cSrcweir { 862*cdf0e10cSrcweir return getStringProperty(::rtl::OUString::createFromAscii("Provider Version")); 863*cdf0e10cSrcweir } 864*cdf0e10cSrcweir // ------------------------------------------------------------------------- 865*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductVersion( ) throw(SQLException, RuntimeException) 866*cdf0e10cSrcweir { 867*cdf0e10cSrcweir return getStringProperty(::rtl::OUString::createFromAscii("DBMS Version")); 868*cdf0e10cSrcweir } 869*cdf0e10cSrcweir // ------------------------------------------------------------------------- 870*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getDatabaseProductName( ) throw(SQLException, RuntimeException) 871*cdf0e10cSrcweir { 872*cdf0e10cSrcweir return getStringProperty(::rtl::OUString::createFromAscii("DBMS Name")); 873*cdf0e10cSrcweir } 874*cdf0e10cSrcweir // ------------------------------------------------------------------------- 875*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getProcedureTerm( ) throw(SQLException, RuntimeException) 876*cdf0e10cSrcweir { 877*cdf0e10cSrcweir return getStringProperty(::rtl::OUString::createFromAscii("Procedure Term")); 878*cdf0e10cSrcweir } 879*cdf0e10cSrcweir // ------------------------------------------------------------------------- 880*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getSchemaTerm( ) throw(SQLException, RuntimeException) 881*cdf0e10cSrcweir { 882*cdf0e10cSrcweir return getStringProperty(::rtl::OUString::createFromAscii("Schema Term")); 883*cdf0e10cSrcweir } 884*cdf0e10cSrcweir // ------------------------------------------------------------------------- 885*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMajorVersion( ) throw(RuntimeException) 886*cdf0e10cSrcweir { 887*cdf0e10cSrcweir return 1; 888*cdf0e10cSrcweir } 889*cdf0e10cSrcweir // ------------------------------------------------------------------------- 890*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getDefaultTransactionIsolation( ) throw(SQLException, RuntimeException) 891*cdf0e10cSrcweir { 892*cdf0e10cSrcweir sal_Int32 nRet = TransactionIsolation::NONE; 893*cdf0e10cSrcweir switch(m_pADOConnection->get_IsolationLevel()) 894*cdf0e10cSrcweir { 895*cdf0e10cSrcweir case adXactReadCommitted: 896*cdf0e10cSrcweir nRet = TransactionIsolation::READ_COMMITTED; 897*cdf0e10cSrcweir break; 898*cdf0e10cSrcweir case adXactRepeatableRead: 899*cdf0e10cSrcweir nRet = TransactionIsolation::REPEATABLE_READ; 900*cdf0e10cSrcweir break; 901*cdf0e10cSrcweir case adXactSerializable: 902*cdf0e10cSrcweir nRet = TransactionIsolation::SERIALIZABLE; 903*cdf0e10cSrcweir break; 904*cdf0e10cSrcweir case adXactReadUncommitted: 905*cdf0e10cSrcweir nRet = TransactionIsolation::READ_UNCOMMITTED; 906*cdf0e10cSrcweir break; 907*cdf0e10cSrcweir default: 908*cdf0e10cSrcweir ; 909*cdf0e10cSrcweir } 910*cdf0e10cSrcweir return nRet; 911*cdf0e10cSrcweir } 912*cdf0e10cSrcweir // ------------------------------------------------------------------------- 913*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getDriverMinorVersion( ) throw(RuntimeException) 914*cdf0e10cSrcweir { 915*cdf0e10cSrcweir return 0; 916*cdf0e10cSrcweir } 917*cdf0e10cSrcweir // ------------------------------------------------------------------------- 918*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getSQLKeywords( ) throw(SQLException, RuntimeException) 919*cdf0e10cSrcweir { 920*cdf0e10cSrcweir ADORecordset *pRecordset = NULL; 921*cdf0e10cSrcweir OLEVariant vtEmpty; 922*cdf0e10cSrcweir vtEmpty.setNoArg(); 923*cdf0e10cSrcweir m_pADOConnection->OpenSchema(adSchemaDBInfoKeywords,vtEmpty,vtEmpty,&pRecordset); 924*cdf0e10cSrcweir OSL_ENSURE(pRecordset,"getSQLKeywords: no resultset!"); 925*cdf0e10cSrcweir ADOS::ThrowException(*m_pADOConnection,*this); 926*cdf0e10cSrcweir if ( pRecordset ) 927*cdf0e10cSrcweir { 928*cdf0e10cSrcweir WpADORecordset aRecordset(pRecordset); 929*cdf0e10cSrcweir 930*cdf0e10cSrcweir aRecordset.MoveFirst(); 931*cdf0e10cSrcweir OLEVariant aValue; 932*cdf0e10cSrcweir ::rtl::OUString aRet,aComma = ::rtl::OUString::createFromAscii(","); 933*cdf0e10cSrcweir while(!aRecordset.IsAtEOF()) 934*cdf0e10cSrcweir { 935*cdf0e10cSrcweir WpOLEAppendCollection<ADOFields, ADOField, WpADOField> aFields(aRecordset.GetFields()); 936*cdf0e10cSrcweir WpADOField aField(aFields.GetItem(0)); 937*cdf0e10cSrcweir aField.get_Value(aValue); 938*cdf0e10cSrcweir aRet = aRet + aValue + aComma; 939*cdf0e10cSrcweir aRecordset.MoveNext(); 940*cdf0e10cSrcweir } 941*cdf0e10cSrcweir aRecordset.Close(); 942*cdf0e10cSrcweir if ( aRet.getLength() ) 943*cdf0e10cSrcweir return aRet.copy(0,aRet.lastIndexOf(',')); 944*cdf0e10cSrcweir } 945*cdf0e10cSrcweir return ::rtl::OUString(); 946*cdf0e10cSrcweir } 947*cdf0e10cSrcweir // ------------------------------------------------------------------------- 948*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getSearchStringEscape( ) throw(SQLException, RuntimeException) 949*cdf0e10cSrcweir { 950*cdf0e10cSrcweir return getLiteral(DBLITERAL_ESCAPE_PERCENT); 951*cdf0e10cSrcweir } 952*cdf0e10cSrcweir // ------------------------------------------------------------------------- 953*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getStringFunctions( ) throw(SQLException, RuntimeException) 954*cdf0e10cSrcweir { 955*cdf0e10cSrcweir ::rtl::OUString aValue; 956*cdf0e10cSrcweir return aValue.copy(0,aValue.lastIndexOf(',')); 957*cdf0e10cSrcweir } 958*cdf0e10cSrcweir // ------------------------------------------------------------------------- 959*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getTimeDateFunctions( ) throw(SQLException, RuntimeException) 960*cdf0e10cSrcweir { 961*cdf0e10cSrcweir ::rtl::OUString aValue; 962*cdf0e10cSrcweir return aValue; 963*cdf0e10cSrcweir } 964*cdf0e10cSrcweir // ------------------------------------------------------------------------- 965*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getSystemFunctions( ) throw(SQLException, RuntimeException) 966*cdf0e10cSrcweir { 967*cdf0e10cSrcweir ::rtl::OUString aValue; 968*cdf0e10cSrcweir return aValue.copy(0,aValue.lastIndexOf(',')); 969*cdf0e10cSrcweir } 970*cdf0e10cSrcweir // ------------------------------------------------------------------------- 971*cdf0e10cSrcweir ::rtl::OUString SAL_CALL ODatabaseMetaData::getNumericFunctions( ) throw(SQLException, RuntimeException) 972*cdf0e10cSrcweir { 973*cdf0e10cSrcweir ::rtl::OUString aValue; 974*cdf0e10cSrcweir return aValue; 975*cdf0e10cSrcweir } 976*cdf0e10cSrcweir // ------------------------------------------------------------------------- 977*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsExtendedSQLGrammar( ) throw(SQLException, RuntimeException) 978*cdf0e10cSrcweir { 979*cdf0e10cSrcweir sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); 980*cdf0e10cSrcweir return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_EXTENDED) == DBPROPVAL_SQL_ODBC_EXTENDED); 981*cdf0e10cSrcweir } 982*cdf0e10cSrcweir // ------------------------------------------------------------------------- 983*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsCoreSQLGrammar( ) throw(SQLException, RuntimeException) 984*cdf0e10cSrcweir { 985*cdf0e10cSrcweir sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); 986*cdf0e10cSrcweir return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_CORE) == DBPROPVAL_SQL_ODBC_CORE); 987*cdf0e10cSrcweir } 988*cdf0e10cSrcweir // ------------------------------------------------------------------------- 989*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsMinimumSQLGrammar( ) throw(SQLException, RuntimeException) 990*cdf0e10cSrcweir { 991*cdf0e10cSrcweir sal_Int32 nProp = getInt32Property(::rtl::OUString::createFromAscii("SQL Support")); 992*cdf0e10cSrcweir return (nProp == 512) || ((nProp & DBPROPVAL_SQL_ODBC_MINIMUM) == DBPROPVAL_SQL_ODBC_MINIMUM); 993*cdf0e10cSrcweir } 994*cdf0e10cSrcweir // ------------------------------------------------------------------------- 995*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsFullOuterJoins( ) throw(SQLException, RuntimeException) 996*cdf0e10cSrcweir { 997*cdf0e10cSrcweir if ( ADOS::isJetEngine(m_pConnection->getEngineType()) ) 998*cdf0e10cSrcweir return sal_True; 999*cdf0e10cSrcweir return (getInt32Property(::rtl::OUString::createFromAscii("Outer Join Capabilities")) & 0x00000004L) == 0x00000004L; 1000*cdf0e10cSrcweir } 1001*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1002*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsLimitedOuterJoins( ) throw(SQLException, RuntimeException) 1003*cdf0e10cSrcweir { 1004*cdf0e10cSrcweir return supportsFullOuterJoins( ); 1005*cdf0e10cSrcweir } 1006*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1007*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInGroupBy( ) throw(SQLException, RuntimeException) 1008*cdf0e10cSrcweir { 1009*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in GROUP BY")); 1010*cdf0e10cSrcweir } 1011*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1012*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInOrderBy( ) throw(SQLException, RuntimeException) 1013*cdf0e10cSrcweir { 1014*cdf0e10cSrcweir return getInt32Property(::rtl::OUString::createFromAscii("Max Columns in ORDER BY")); 1015*cdf0e10cSrcweir } 1016*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1017*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxColumnsInSelect( ) throw(SQLException, RuntimeException) 1018*cdf0e10cSrcweir { 1019*cdf0e10cSrcweir return 0; // getInt32Property(::rtl::OUString::createFromAscii("Max Columns in Select")); 1020*cdf0e10cSrcweir } 1021*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1022*cdf0e10cSrcweir sal_Int32 SAL_CALL ODatabaseMetaData::getMaxUserNameLength( ) throw(SQLException, RuntimeException) 1023*cdf0e10cSrcweir { 1024*cdf0e10cSrcweir return getMaxSize(DBLITERAL_USER_NAME); 1025*cdf0e10cSrcweir } 1026*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1027*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetType( sal_Int32 /*setType*/ ) throw(SQLException, RuntimeException) 1028*cdf0e10cSrcweir { 1029*cdf0e10cSrcweir return sal_True; 1030*cdf0e10cSrcweir } 1031*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1032*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsResultSetConcurrency( sal_Int32 /*setType*/, sal_Int32 /*concurrency*/ ) throw(SQLException, RuntimeException) 1033*cdf0e10cSrcweir { 1034*cdf0e10cSrcweir return sal_True; 1035*cdf0e10cSrcweir } 1036*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1037*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::ownUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) 1038*cdf0e10cSrcweir { 1039*cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY != setType; 1040*cdf0e10cSrcweir } 1041*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1042*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::ownDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) 1043*cdf0e10cSrcweir { 1044*cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY != setType; 1045*cdf0e10cSrcweir } 1046*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1047*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::ownInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) 1048*cdf0e10cSrcweir { 1049*cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY != setType; 1050*cdf0e10cSrcweir } 1051*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1052*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::othersUpdatesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) 1053*cdf0e10cSrcweir { 1054*cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY != setType; 1055*cdf0e10cSrcweir } 1056*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1057*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::othersDeletesAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) 1058*cdf0e10cSrcweir { 1059*cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY != setType; 1060*cdf0e10cSrcweir } 1061*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1062*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::othersInsertsAreVisible( sal_Int32 setType ) throw(SQLException, RuntimeException) 1063*cdf0e10cSrcweir { 1064*cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY != setType; 1065*cdf0e10cSrcweir } 1066*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1067*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::updatesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) 1068*cdf0e10cSrcweir { 1069*cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY != setType; 1070*cdf0e10cSrcweir } 1071*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1072*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::deletesAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) 1073*cdf0e10cSrcweir { 1074*cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY != setType; 1075*cdf0e10cSrcweir } 1076*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1077*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::insertsAreDetected( sal_Int32 setType ) throw(SQLException, RuntimeException) 1078*cdf0e10cSrcweir { 1079*cdf0e10cSrcweir return ResultSetType::FORWARD_ONLY != setType; 1080*cdf0e10cSrcweir } 1081*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1082*cdf0e10cSrcweir sal_Bool SAL_CALL ODatabaseMetaData::supportsBatchUpdates( ) throw(SQLException, RuntimeException) 1083*cdf0e10cSrcweir { 1084*cdf0e10cSrcweir return sal_True; 1085*cdf0e10cSrcweir } 1086*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1087*cdf0e10cSrcweir Reference< XResultSet > SAL_CALL ODatabaseMetaData::getUDTs( const Any& /*catalog*/, const ::rtl::OUString& /*schemaPattern*/, const ::rtl::OUString& /*typeNamePattern*/, const Sequence< sal_Int32 >& /*types*/ ) throw(SQLException, RuntimeException) 1088*cdf0e10cSrcweir { 1089*cdf0e10cSrcweir ::dbtools::throwFeatureNotImplementedException( "XDatabaseMetaData::getUDTs", *this ); 1090*cdf0e10cSrcweir return Reference< XResultSet >(); 1091*cdf0e10cSrcweir } 1092*cdf0e10cSrcweir // ------------------------------------------------------------------------- 1093*cdf0e10cSrcweir 1094