1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 20 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATA_HXX 21 #define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATA_HXX 22 23 #include <TDatabaseMetaDataBase.hxx> 24 #include <map> 25 26 namespace connectivity 27 { 28 namespace ado 29 { 30 class WpADOConnection; 31 class OConnection; 32 33 //************ Class: ODatabaseMetaData 34 35 36 class ODatabaseMetaData : public ODatabaseMetaDataBase 37 { 38 struct LiteralInfo 39 { 40 OUString pwszLiteralValue; 41 sal_uInt32 cchMaxLen; 42 bool fSupported; 43 }; 44 45 std::map<sal_uInt32,LiteralInfo> m_aLiteralInfo; 46 WpADOConnection* m_pADOConnection; 47 OConnection* m_pConnection; 48 49 void fillLiterals(); 50 // get information out of rowset 51 sal_Int32 getMaxSize(sal_uInt32 _nId); 52 bool isCapable(sal_uInt32 _nId); 53 OUString getLiteral(sal_uInt32 _nProperty); 54 55 // get info out of properties 56 /// @throws css::sdbc::SQLException 57 /// @throws css::uno::RuntimeException 58 OUString getStringProperty(const OUString& _aProperty); 59 /// @throws css::sdbc::SQLException 60 /// @throws css::uno::RuntimeException 61 sal_Int32 getInt32Property(const OUString& _aProperty); 62 /// @throws css::sdbc::SQLException 63 /// @throws css::uno::RuntimeException 64 bool getBoolProperty(const OUString& _aProperty); 65 66 virtual css::uno::Reference< css::sdbc::XResultSet > impl_getTypeInfo_throw() override; 67 // cached database information 68 virtual OUString impl_getIdentifierQuoteString_throw( ) override; 69 virtual bool impl_isCatalogAtStart_throw( ) override; 70 virtual OUString impl_getCatalogSeparator_throw( ) override; 71 virtual bool impl_supportsCatalogsInTableDefinitions_throw( ) override; 72 virtual bool impl_supportsSchemasInTableDefinitions_throw( ) override; 73 virtual bool impl_supportsCatalogsInDataManipulation_throw( ) override; 74 virtual bool impl_supportsSchemasInDataManipulation_throw( ) override; 75 virtual bool impl_supportsMixedCaseQuotedIdentifiers_throw( ) override; 76 virtual bool impl_supportsAlterTableWithAddColumn_throw( ) override; 77 virtual bool impl_supportsAlterTableWithDropColumn_throw( ) override; 78 virtual sal_Int32 impl_getMaxStatements_throw( ) override; 79 virtual sal_Int32 impl_getMaxTablesInSelect_throw( ) override; 80 virtual bool impl_storesMixedCaseQuotedIdentifiers_throw( ) override; 81 public: 82 83 ODatabaseMetaData(OConnection* _pCon); 84 85 // XDatabaseMetaData 86 virtual sal_Bool SAL_CALL allProceduresAreCallable( ) override; 87 virtual sal_Bool SAL_CALL allTablesAreSelectable( ) override; 88 virtual OUString SAL_CALL getURL( ) override; 89 virtual OUString SAL_CALL getUserName( ) override; 90 virtual sal_Bool SAL_CALL isReadOnly( ) override; 91 virtual sal_Bool SAL_CALL nullsAreSortedHigh( ) override; 92 virtual sal_Bool SAL_CALL nullsAreSortedLow( ) override; 93 virtual sal_Bool SAL_CALL nullsAreSortedAtStart( ) override; 94 virtual sal_Bool SAL_CALL nullsAreSortedAtEnd( ) override; 95 virtual OUString SAL_CALL getDatabaseProductName( ) override; 96 virtual OUString SAL_CALL getDatabaseProductVersion( ) override; 97 virtual OUString SAL_CALL getDriverName( ) override; 98 virtual OUString SAL_CALL getDriverVersion( ) override; 99 virtual sal_Int32 SAL_CALL getDriverMajorVersion( ) override; 100 virtual sal_Int32 SAL_CALL getDriverMinorVersion( ) override; 101 virtual sal_Bool SAL_CALL usesLocalFiles( ) override; 102 virtual sal_Bool SAL_CALL usesLocalFilePerTable( ) override; 103 virtual sal_Bool SAL_CALL supportsMixedCaseIdentifiers( ) override; 104 virtual sal_Bool SAL_CALL storesUpperCaseIdentifiers( ) override; 105 virtual sal_Bool SAL_CALL storesLowerCaseIdentifiers( ) override; 106 virtual sal_Bool SAL_CALL storesMixedCaseIdentifiers( ) override; 107 108 virtual sal_Bool SAL_CALL storesUpperCaseQuotedIdentifiers( ) override; 109 virtual sal_Bool SAL_CALL storesLowerCaseQuotedIdentifiers( ) override; 110 111 virtual OUString SAL_CALL getSQLKeywords( ) override; 112 virtual OUString SAL_CALL getNumericFunctions( ) override; 113 virtual OUString SAL_CALL getStringFunctions( ) override; 114 virtual OUString SAL_CALL getSystemFunctions( ) override; 115 virtual OUString SAL_CALL getTimeDateFunctions( ) override; 116 virtual OUString SAL_CALL getSearchStringEscape( ) override; 117 virtual OUString SAL_CALL getExtraNameCharacters( ) override; 118 virtual sal_Bool SAL_CALL supportsColumnAliasing( ) override; 119 virtual sal_Bool SAL_CALL nullPlusNonNullIsNull( ) override; 120 virtual sal_Bool SAL_CALL supportsTypeConversion( ) override; 121 virtual sal_Bool SAL_CALL supportsConvert( sal_Int32 fromType, sal_Int32 toType ) override; 122 virtual sal_Bool SAL_CALL supportsTableCorrelationNames( ) override; 123 virtual sal_Bool SAL_CALL supportsDifferentTableCorrelationNames( ) override; 124 virtual sal_Bool SAL_CALL supportsExpressionsInOrderBy( ) override; 125 virtual sal_Bool SAL_CALL supportsOrderByUnrelated( ) override; 126 virtual sal_Bool SAL_CALL supportsGroupBy( ) override; 127 virtual sal_Bool SAL_CALL supportsGroupByUnrelated( ) override; 128 virtual sal_Bool SAL_CALL supportsGroupByBeyondSelect( ) override; 129 virtual sal_Bool SAL_CALL supportsLikeEscapeClause( ) override; 130 virtual sal_Bool SAL_CALL supportsMultipleResultSets( ) override; 131 virtual sal_Bool SAL_CALL supportsMultipleTransactions( ) override; 132 virtual sal_Bool SAL_CALL supportsNonNullableColumns( ) override; 133 virtual sal_Bool SAL_CALL supportsMinimumSQLGrammar( ) override; 134 virtual sal_Bool SAL_CALL supportsCoreSQLGrammar( ) override; 135 virtual sal_Bool SAL_CALL supportsExtendedSQLGrammar( ) override; 136 virtual sal_Bool SAL_CALL supportsANSI92EntryLevelSQL( ) override; 137 virtual sal_Bool SAL_CALL supportsANSI92IntermediateSQL( ) override; 138 virtual sal_Bool SAL_CALL supportsANSI92FullSQL( ) override; 139 virtual sal_Bool SAL_CALL supportsIntegrityEnhancementFacility( ) override; 140 virtual sal_Bool SAL_CALL supportsOuterJoins( ) override; 141 virtual sal_Bool SAL_CALL supportsFullOuterJoins( ) override; 142 virtual sal_Bool SAL_CALL supportsLimitedOuterJoins( ) override; 143 virtual OUString SAL_CALL getSchemaTerm( ) override; 144 virtual OUString SAL_CALL getProcedureTerm( ) override; 145 virtual OUString SAL_CALL getCatalogTerm( ) override; 146 virtual sal_Bool SAL_CALL supportsSchemasInProcedureCalls( ) override; 147 virtual sal_Bool SAL_CALL supportsSchemasInIndexDefinitions( ) override; 148 virtual sal_Bool SAL_CALL supportsSchemasInPrivilegeDefinitions( ) override; 149 virtual sal_Bool SAL_CALL supportsCatalogsInProcedureCalls( ) override; 150 virtual sal_Bool SAL_CALL supportsCatalogsInIndexDefinitions( ) override; 151 virtual sal_Bool SAL_CALL supportsCatalogsInPrivilegeDefinitions( ) override; 152 virtual sal_Bool SAL_CALL supportsPositionedDelete( ) override; 153 virtual sal_Bool SAL_CALL supportsPositionedUpdate( ) override; 154 virtual sal_Bool SAL_CALL supportsSelectForUpdate( ) override; 155 virtual sal_Bool SAL_CALL supportsStoredProcedures( ) override; 156 virtual sal_Bool SAL_CALL supportsSubqueriesInComparisons( ) override; 157 virtual sal_Bool SAL_CALL supportsSubqueriesInExists( ) override; 158 virtual sal_Bool SAL_CALL supportsSubqueriesInIns( ) override; 159 virtual sal_Bool SAL_CALL supportsSubqueriesInQuantifieds( ) override; 160 virtual sal_Bool SAL_CALL supportsCorrelatedSubqueries( ) override; 161 virtual sal_Bool SAL_CALL supportsUnion( ) override; 162 virtual sal_Bool SAL_CALL supportsUnionAll( ) override; 163 virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossCommit( ) override; 164 virtual sal_Bool SAL_CALL supportsOpenCursorsAcrossRollback( ) override; 165 virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossCommit( ) override; 166 virtual sal_Bool SAL_CALL supportsOpenStatementsAcrossRollback( ) override; 167 virtual sal_Int32 SAL_CALL getMaxBinaryLiteralLength( ) override; 168 virtual sal_Int32 SAL_CALL getMaxCharLiteralLength( ) override; 169 virtual sal_Int32 SAL_CALL getMaxColumnNameLength( ) override; 170 virtual sal_Int32 SAL_CALL getMaxColumnsInGroupBy( ) override; 171 virtual sal_Int32 SAL_CALL getMaxColumnsInIndex( ) override; 172 virtual sal_Int32 SAL_CALL getMaxColumnsInOrderBy( ) override; 173 virtual sal_Int32 SAL_CALL getMaxColumnsInSelect( ) override; 174 virtual sal_Int32 SAL_CALL getMaxColumnsInTable( ) override; 175 virtual sal_Int32 SAL_CALL getMaxConnections( ) override; 176 virtual sal_Int32 SAL_CALL getMaxCursorNameLength( ) override; 177 virtual sal_Int32 SAL_CALL getMaxIndexLength( ) override; 178 virtual sal_Int32 SAL_CALL getMaxSchemaNameLength( ) override; 179 virtual sal_Int32 SAL_CALL getMaxProcedureNameLength( ) override; 180 virtual sal_Int32 SAL_CALL getMaxCatalogNameLength( ) override; 181 virtual sal_Int32 SAL_CALL getMaxRowSize( ) override; 182 virtual sal_Bool SAL_CALL doesMaxRowSizeIncludeBlobs( ) override; 183 virtual sal_Int32 SAL_CALL getMaxStatementLength( ) override; 184 virtual sal_Int32 SAL_CALL getMaxTableNameLength( ) override; 185 virtual sal_Int32 SAL_CALL getMaxUserNameLength( ) override; 186 virtual sal_Int32 SAL_CALL getDefaultTransactionIsolation( ) override; 187 virtual sal_Bool SAL_CALL supportsTransactions( ) override; 188 virtual sal_Bool SAL_CALL supportsTransactionIsolationLevel( sal_Int32 level ) override; 189 virtual sal_Bool SAL_CALL supportsDataDefinitionAndDataManipulationTransactions( ) override; 190 virtual sal_Bool SAL_CALL supportsDataManipulationTransactionsOnly( ) override; 191 virtual sal_Bool SAL_CALL dataDefinitionCausesTransactionCommit( ) override; 192 virtual sal_Bool SAL_CALL dataDefinitionIgnoredInTransactions( ) override; 193 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedures( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern ) override; 194 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getProcedureColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& procedureNamePattern, const OUString& columnNamePattern ) override; 195 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTables( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const css::uno::Sequence< OUString >& types ) override; 196 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getSchemas( ) override; 197 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCatalogs( ) override; 198 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTableTypes( ) override; 199 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumns( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern, const OUString& columnNamePattern ) override; 200 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getColumnPrivileges( const css::uno::Any& catalog, const OUString& schema, const OUString& table, const OUString& columnNamePattern ) override; 201 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getTablePrivileges( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& tableNamePattern ) override; 202 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getPrimaryKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; 203 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getImportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; 204 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getExportedKeys( const css::uno::Any& catalog, const OUString& schema, const OUString& table ) override; 205 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getCrossReference( const css::uno::Any& primaryCatalog, const OUString& primarySchema, const OUString& primaryTable, const css::uno::Any& foreignCatalog, const OUString& foreignSchema, const OUString& foreignTable ) override; 206 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getIndexInfo( const css::uno::Any& catalog, const OUString& schema, const OUString& table, sal_Bool unique, sal_Bool approximate ) override; 207 virtual sal_Bool SAL_CALL supportsResultSetType( sal_Int32 setType ) override; 208 virtual sal_Bool SAL_CALL supportsResultSetConcurrency( sal_Int32 setType, sal_Int32 concurrency ) override; 209 virtual sal_Bool SAL_CALL ownUpdatesAreVisible( sal_Int32 setType ) override; 210 virtual sal_Bool SAL_CALL ownDeletesAreVisible( sal_Int32 setType ) override; 211 virtual sal_Bool SAL_CALL ownInsertsAreVisible( sal_Int32 setType ) override; 212 virtual sal_Bool SAL_CALL othersUpdatesAreVisible( sal_Int32 setType ) override; 213 virtual sal_Bool SAL_CALL othersDeletesAreVisible( sal_Int32 setType ) override; 214 virtual sal_Bool SAL_CALL othersInsertsAreVisible( sal_Int32 setType ) override; 215 virtual sal_Bool SAL_CALL updatesAreDetected( sal_Int32 setType ) override; 216 virtual sal_Bool SAL_CALL deletesAreDetected( sal_Int32 setType ) override; 217 virtual sal_Bool SAL_CALL insertsAreDetected( sal_Int32 setType ) override; 218 virtual sal_Bool SAL_CALL supportsBatchUpdates( ) override; 219 virtual css::uno::Reference< css::sdbc::XResultSet > SAL_CALL getUDTs( const css::uno::Any& catalog, const OUString& schemaPattern, const OUString& typeNamePattern, const css::uno::Sequence< sal_Int32 >& types ) override; 220 }; 221 } 222 } 223 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_ADATABASEMETADATA_HXX 224 225 226 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 227