LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/connectivity - dbmetadata.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2013-07-09 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10