fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / connectivity / dbmetadata.hxx
blob565854ba7ed8589b86d210a6e12593d4dd81e561
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
21 #define CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
23 #include <com/sun/star/sdbc/XConnection.hpp>
25 #include <memory>
26 #include "connectivity/dbtoolsdllapi.hxx"
28 namespace comphelper
30 class ComponentContext;
33 //........................................................................
34 namespace dbtools
36 //........................................................................
38 //====================================================================
39 //= DatabaseMetaData
40 //====================================================================
41 struct DatabaseMetaData_Impl;
42 /** encapsulates meta data about a database/connection which cannot be obtained
43 from the usual XDatabaseMetaData result set.
45 Meta data perhaps isn't really the right term ... Some of the methods
46 in this class involved heuristics, some are just a convenient wrapper
47 around more complex ways to obtain the same information.
49 @todo
50 Once CWS dba30 is integrated, we could easily add all the meta data
51 which is part of the "Info" property of a data source.
53 class OOO_DLLPUBLIC_DBTOOLS DatabaseMetaData
55 private:
56 ::std::auto_ptr< DatabaseMetaData_Impl > m_pImpl;
58 public:
59 DatabaseMetaData();
60 /** constructs a DatabaseMetaData instance
61 @param _rxConnection
62 is the connection whose meta data you're interested in.
63 Note that some of the information provided by this class can only be obtained
64 if this connection denotes an application-level connection, i.e. supports
65 the com.sun.star.sdb.Connection service.
67 @throws ::com::sun::star::lang::IllegalArgumentException
68 if the given connection is not <NULL/>, but the XDatabaseMetaData provided by it
69 are <NULL/>
70 @throws ::com::sun::star::sdbc::SQLException
71 if obtaining the meta data from the connection throws an SQLException
72 @throws ::com::sun::star::uno::RuntimeException
73 if obtaining the meta data from the connection throws an RuntimeException
75 DatabaseMetaData(
76 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _connection );
77 DatabaseMetaData( const DatabaseMetaData& _copyFrom );
78 DatabaseMetaData& operator=( const DatabaseMetaData& _copyFrom );
80 ~DatabaseMetaData();
82 public:
83 /** determines whether or not the instances is based on a valid connection
85 As long as this method returns true<TRUE/>, you should expect all other
86 methods throwing an SQLException when called.
88 bool isConnected() const;
90 /** resets the instance so that it's based on a new connection
92 inline void reset( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _connection )
94 *this = DatabaseMetaData( _connection );
97 /// wraps XDatabaseMetaData::getIdentifierQuoteString
98 const OUString& getIdentifierQuoteString() const;
100 /// wraps XDatabaseMetaData::getCatalogSeparator
101 const OUString& getCatalogSeparator() const;
103 /** determines whether the database supports sub queries in the FROM part
104 of a SELECT clause are supported.
105 @throws ::com::sun::star::sdbc::SQLException
106 with SQLState 08003 (connection does not exist) if the instances was
107 default-constructed and does not have a connection, yet.
109 bool supportsSubqueriesInFrom() const;
111 /** checks whether the database supports primary keys
113 Since there's no dedicated API to ask a database for this, a heuristics needs to be applied.
114 First, the <code>PrimaryKeySupport<code> settings of the data source is examined. If it is <TRUE/>
115 or <FALSE/>, then value is returned. If it is <NULL/>, then the database meta data are examined
116 for support of core SQL grammar, and the result is returned. The assumption is that a database/driver
117 which supports core SQL grammar usually also supports primary keys, and vice versa. At least, experience
118 shows this is true most of the time.
120 bool supportsPrimaryKeys() const;
122 /** determines whether names in the database should be restricted to SQL-92 identifiers
124 Effectively, this method checks the EnableSQL92Check property of the data source settings,
125 if present.
127 bool restrictIdentifiersToSQL92() const;
129 /** determines whether when generating SQL statements, an AS keyword should be generated
130 before a correlation name.
132 E.g., it determines whether <code>SELECT * FROM table AS correlation_name</code> or
133 <code>SELECT * FROM table correlation_name</code> is generated.
135 bool generateASBeforeCorrelationName() const;
137 /** should date time be escaped like '2001-01-01' => {D '2001-01-01' }
139 bool shouldEscapeDateTime() const;
141 /** auto increment columns should be automaticly used as primary key.
143 bool isAutoIncrementPrimaryKey() const;
145 /** determines the syntax to use for boolean comparison predicates
147 @see ::com::sun::star::sdb::BooleanComparisonMode
149 sal_Int32
150 getBooleanComparisonMode() const;
152 /** determines in relations are supported.
154 * \return <TRUE/> when relations are supported, otherwise <FALSE/>
156 bool supportsRelations() const;
158 /** determines if column alias names can be used in the order by clause.
160 * \return <TRUE/> when relations are supported, otherwise <FALSE/>
162 bool supportsColumnAliasInOrderBy() const;
164 /** determines whether user administration is supported for the database
166 User administration support is controlled by the availability of the XUsersSupplier
167 interface, and it returning a non-NULL users container.
169 @param _rContext
170 the component context we operate in. Might be needed to create the
171 css.sdbc.DriverManager instance.
173 bool supportsUserAdministration( const ::comphelper::ComponentContext& _rContext ) const;
175 /** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed
177 bool displayEmptyTableFolders() const;
179 /** determines that threads are supported.
181 * \return <TRUE/> when threads are supported, otherwise <FALSE/>
183 bool supportsThreads() const;
186 //........................................................................
187 } // namespace dbtools
188 //........................................................................
190 #endif // CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */