LibreOffice Module connectivity (master) 1
|
encapsulates meta data about a database/connection which cannot be obtained from the usual XDatabaseMetaData result set. More...
#include <dbmetadata.hxx>
Public Member Functions | |
DatabaseMetaData () | |
DatabaseMetaData (const css::uno::Reference< css::sdbc::XConnection > &_connection) | |
constructs a DatabaseMetaData instance More... | |
DatabaseMetaData (const DatabaseMetaData &_copyFrom) | |
DatabaseMetaData & | operator= (const DatabaseMetaData &_copyFrom) |
DatabaseMetaData (DatabaseMetaData &&_copyFrom) noexcept | |
DatabaseMetaData & | operator= (DatabaseMetaData &&_copyFrom) noexcept |
~DatabaseMetaData () | |
bool | isConnected () const |
determines whether or not the instances is based on a valid connection More... | |
void | reset (const css::uno::Reference< css::sdbc::XConnection > &_connection) |
resets the instance so that it's based on a new connection More... | |
const OUString & | getIdentifierQuoteString () const |
wraps XDatabaseMetaData::getIdentifierQuoteString More... | |
const OUString & | getCatalogSeparator () const |
wraps XDatabaseMetaData::getCatalogSeparator More... | |
bool | supportsSubqueriesInFrom () const |
determines whether the database supports sub queries in the FROM part of a SELECT clause are supported. More... | |
bool | supportsPrimaryKeys () const |
checks whether the database supports primary keys More... | |
bool | restrictIdentifiersToSQL92 () const |
determines whether names in the database should be restricted to SQL-92 identifiers More... | |
bool | generateASBeforeCorrelationName () const |
determines whether when generating SQL statements, an AS keyword should be generated before a correlation name. More... | |
bool | shouldEscapeDateTime () const |
should date time be escaped like '2001-01-01' => {D '2001-01-01' } More... | |
bool | shouldSubstituteParameterNames () const |
should named parameters (:foo, [foo]) be replaced by unnamed parameters (?) More... | |
bool | isAutoIncrementPrimaryKey () const |
auto increment columns should be automatically used as primary key. More... | |
sal_Int32 | getBooleanComparisonMode () const |
determines the syntax to use for boolean comparison predicates More... | |
bool | supportsRelations () const |
determines in relations are supported. More... | |
bool | supportsColumnAliasInOrderBy () const |
determines if column alias names can be used in the order by clause. More... | |
bool | supportsUserAdministration (const css::uno::Reference< css::uno::XComponentContext > &_rContext) const |
determines whether user administration is supported for the database More... | |
bool | displayEmptyTableFolders () const |
determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed More... | |
bool | supportsThreads () const |
determines that threads are supported. More... | |
Private Attributes | |
::std::unique_ptr< DatabaseMetaData_Impl > | m_pImpl |
encapsulates meta data about a database/connection which cannot be obtained from the usual XDatabaseMetaData result set.
Meta data perhaps isn't really the right term ... Some of the methods in this class involved heuristics, some are just a convenient wrapper around more complex ways to obtain the same information.
Definition at line 49 of file dbmetadata.hxx.
dbtools::DatabaseMetaData::DatabaseMetaData | ( | ) |
Definition at line 168 of file dbmetadata.cxx.
References m_pImpl.
dbtools::DatabaseMetaData::DatabaseMetaData | ( | const css::uno::Reference< css::sdbc::XConnection > & | _connection | ) |
constructs a DatabaseMetaData instance
_rxConnection | is the connection whose meta data you're interested in. Note that some of the information provided by this class can only be obtained if this connection denotes an application-level connection, i.e. supports the com.sun.star.sdb.Connection service. |
css::lang::IllegalArgumentException | if the given connection is not <NULL>, but the XDatabaseMetaData provided by it are <NULL> |
css::sdbc::SQLException | if obtaining the meta data from the connection throws an SQLException |
css::uno::RuntimeException | if obtaining the meta data from the connection throws a RuntimeException |
dbtools::DatabaseMetaData::DatabaseMetaData | ( | const DatabaseMetaData & | _copyFrom | ) |
Definition at line 180 of file dbmetadata.cxx.
References m_pImpl.
|
noexcept |
Definition at line 185 of file dbmetadata.cxx.
References m_pImpl.
dbtools::DatabaseMetaData::~DatabaseMetaData | ( | ) |
Definition at line 205 of file dbmetadata.cxx.
bool dbtools::DatabaseMetaData::displayEmptyTableFolders | ( | ) | const |
determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed
Definition at line 400 of file dbmetadata.cxx.
References Any, DBG_UNHANDLED_EXCEPTION, Exception, m_pImpl, and SAL_WARN.
bool dbtools::DatabaseMetaData::generateASBeforeCorrelationName | ( | ) | const |
determines whether when generating SQL statements, an AS keyword should be generated before a correlation name.
E.g., it determines whether SELECT * FROM table AS correlation_name
or SELECT * FROM table correlation_name
is generated.
Definition at line 282 of file dbmetadata.cxx.
References Any, m_pImpl, and SAL_WARN.
Referenced by connectivity::OSQLParseNode::impl_parseNodeToString_throw().
sal_Int32 dbtools::DatabaseMetaData::getBooleanComparisonMode | ( | ) | const |
const OUString & dbtools::DatabaseMetaData::getCatalogSeparator | ( | ) | const |
wraps XDatabaseMetaData::getCatalogSeparator
Definition at line 263 of file dbmetadata.cxx.
References m_pImpl.
Referenced by connectivity::OSQLParseNode::parseLeaf().
const OUString & dbtools::DatabaseMetaData::getIdentifierQuoteString | ( | ) | const |
wraps XDatabaseMetaData::getIdentifierQuoteString
Definition at line 257 of file dbmetadata.cxx.
References m_pImpl.
Referenced by connectivity::OSQLParseNode::impl_parseTableNameNodeToString_throw(), and connectivity::OSQLParseNode::parseLeaf().
bool dbtools::DatabaseMetaData::isAutoIncrementPrimaryKey | ( | ) | const |
auto increment columns should be automatically used as primary key.
Definition at line 312 of file dbmetadata.cxx.
bool dbtools::DatabaseMetaData::isConnected | ( | ) | const |
determines whether or not the instances is based on a valid connection
As long as this method returns true<TRUE>, you should expect all other methods throwing an SQLException when called.
Definition at line 209 of file dbmetadata.cxx.
References m_pImpl.
DatabaseMetaData & dbtools::DatabaseMetaData::operator= | ( | const DatabaseMetaData & | _copyFrom | ) |
Definition at line 190 of file dbmetadata.cxx.
References m_pImpl.
|
noexcept |
Definition at line 199 of file dbmetadata.cxx.
References m_pImpl.
|
inline |
resets the instance so that it's based on a new connection
Definition at line 90 of file dbmetadata.hxx.
bool dbtools::DatabaseMetaData::restrictIdentifiersToSQL92 | ( | ) | const |
determines whether names in the database should be restricted to SQL-92 identifiers
Effectively, this method checks the EnableSQL92Check property of the data source settings, if present.
Definition at line 269 of file dbmetadata.cxx.
bool dbtools::DatabaseMetaData::shouldEscapeDateTime | ( | ) | const |
should date time be escaped like '2001-01-01' => {D '2001-01-01' }
Definition at line 292 of file dbmetadata.cxx.
References Any, m_pImpl, and SAL_WARN.
Referenced by connectivity::OSQLParseNode::addDateValue().
bool dbtools::DatabaseMetaData::shouldSubstituteParameterNames | ( | ) | const |
should named parameters (:foo, [foo]) be replaced by unnamed parameters (?)
Definition at line 302 of file dbmetadata.cxx.
References Any, m_pImpl, and SAL_WARN.
Referenced by connectivity::OSQLParseNode::impl_parseNodeToString_throw().
bool dbtools::DatabaseMetaData::supportsColumnAliasInOrderBy | ( | ) | const |
determines if column alias names can be used in the order by clause.
Definition at line 360 of file dbmetadata.cxx.
bool dbtools::DatabaseMetaData::supportsPrimaryKeys | ( | ) | const |
checks whether the database supports primary keys
Since there's no dedicated API to ask a database for this, a heuristics needs to be applied. First, the PrimaryKeySupport
settings of the data source is examined. If it is <TRUE> or <FALSE>, then value is returned. If it is <NULL>, then the database meta data are examined for support of core SQL grammar, and the result is returned. The assumption is that a database/driver which supports core SQL grammar usually also supports primary keys, and vice versa. At least, experience shows this is true most of the time.
Definition at line 235 of file dbmetadata.cxx.
References Any, DBG_UNHANDLED_EXCEPTION, Exception, and m_pImpl.
bool dbtools::DatabaseMetaData::supportsRelations | ( | ) | const |
determines in relations are supported.
Definition at line 332 of file dbmetadata.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, and m_pImpl.
bool dbtools::DatabaseMetaData::supportsSubqueriesInFrom | ( | ) | const |
determines whether the database supports sub queries in the FROM part of a SELECT clause are supported.
css::sdbc::SQLException | with SQLState 08003 (connection does not exist) if the instances was default-constructed and does not have a connection, yet. |
Definition at line 215 of file dbmetadata.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, and m_pImpl.
Referenced by connectivity::OSQLParseTreeIteratorImpl::OSQLParseTreeIteratorImpl(), and connectivity::OSQLParseNode::parseNodeToExecutableStatement().
bool dbtools::DatabaseMetaData::supportsThreads | ( | ) | const |
determines that threads are supported.
Definition at line 423 of file dbmetadata.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, and m_pImpl.
bool dbtools::DatabaseMetaData::supportsUserAdministration | ( | const css::uno::Reference< css::uno::XComponentContext > & | _rContext | ) | const |
determines whether user administration is supported for the database
User administration support is controlled by the availability of the XUsersSupplier interface, and it returning a non-NULL users container.
_rContext | the component context we operate in. Might be needed to create the css.sdbc.DriverManager instance. |
Definition at line 371 of file dbmetadata.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, and m_pImpl.
|
private |
Definition at line 52 of file dbmetadata.hxx.
Referenced by displayEmptyTableFolders(), generateASBeforeCorrelationName(), getBooleanComparisonMode(), getCatalogSeparator(), getIdentifierQuoteString(), isAutoIncrementPrimaryKey(), isConnected(), operator=(), restrictIdentifiersToSQL92(), shouldEscapeDateTime(), shouldSubstituteParameterNames(), supportsColumnAliasInOrderBy(), supportsPrimaryKeys(), supportsRelations(), supportsSubqueriesInFrom(), supportsThreads(), and supportsUserAdministration().