LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/connectivity - dbmetadata.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 3 0.0 %
Date: 2012-12-27 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             : 
      25             : #include <memory>
      26             : #include "connectivity/dbtoolsdllapi.hxx"
      27             : 
      28             : namespace comphelper
      29             : {
      30             :     class ComponentContext;
      31             : }
      32             : 
      33             : //........................................................................
      34             : namespace dbtools
      35             : {
      36             : //........................................................................
      37             : 
      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.
      44             : 
      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.
      48             : 
      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.
      52             :     */
      53             :     class OOO_DLLPUBLIC_DBTOOLS DatabaseMetaData
      54             :     {
      55             :     private:
      56             :         ::std::auto_ptr< DatabaseMetaData_Impl >    m_pImpl;
      57             : 
      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.
      66             : 
      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
      74             :         */
      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 );
      79             : 
      80             :         ~DatabaseMetaData();
      81             : 
      82             :     public:
      83             :         /** determines whether or not the instances is based on a valid connection
      84             : 
      85             :             As long as this method returns true<TRUE/>, you should expect all other
      86             :             methods throwing an SQLException when called.
      87             :         */
      88             :         bool    isConnected() const;
      89             : 
      90             :         /** resets the instance so that it's based on a new connection
      91             :         */
      92           0 :         inline  void    reset( const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _connection )
      93             :         {
      94           0 :             *this = DatabaseMetaData( _connection );
      95           0 :         }
      96             : 
      97             :         /// wraps XDatabaseMetaData::getIdentifierQuoteString
      98             :         const ::rtl::OUString&  getIdentifierQuoteString() const;
      99             : 
     100             :         /// wraps XDatabaseMetaData::getCatalogSeparator
     101             :         const ::rtl::OUString&  getCatalogSeparator() const;
     102             : 
     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.
     108             :         */
     109             :         bool supportsSubqueriesInFrom() const;
     110             : 
     111             :         /** checks whether the database supports primary keys
     112             : 
     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.
     119             :         */
     120             :         bool supportsPrimaryKeys() const;
     121             : 
     122             :         /** determines whether names in the database should be restricted to SQL-92 identifiers
     123             : 
     124             :             Effectively, this method checks the EnableSQL92Check property of the data source settings,
     125             :             if present.
     126             :         */
     127             :         bool restrictIdentifiersToSQL92() const;
     128             : 
     129             :         /** determines whether when generating SQL statements, an AS keyword should be generated
     130             :             before a correlation name.
     131             : 
     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.
     134             :         */
     135             :         bool generateASBeforeCorrelationName() const;
     136             : 
     137             :         /** should date time be escaped like '2001-01-01' => {D '2001-01-01' }
     138             :         */
     139             :         bool shouldEscapeDateTime() const;
     140             : 
     141             :         /** auto increment columns should be automaticly used as primary key.
     142             :         */
     143             :         bool isAutoIncrementPrimaryKey() const;
     144             : 
     145             :         /** determines the syntax to use for boolean comparison predicates
     146             : 
     147             :             @see ::com::sun::star::sdb::BooleanComparisonMode
     148             :         */
     149             :         sal_Int32
     150             :             getBooleanComparisonMode() const;
     151             : 
     152             :         /** determines in relations are supported.
     153             :         *
     154             :         * \return <TRUE/> when relations are supported, otherwise <FALSE/>
     155             :         */
     156             :         bool supportsRelations() const;
     157             : 
     158             :         /** determines if column alias names can be used in the order by clause.
     159             :         *
     160             :         * \return <TRUE/> when relations are supported, otherwise <FALSE/>
     161             :         */
     162             :         bool supportsColumnAliasInOrderBy() const;
     163             : 
     164             :         /** determines whether user administration is supported for the database
     165             : 
     166             :             User administration support is controlled by the availability of the XUsersSupplier
     167             :             interface, and it returning a non-NULL users container.
     168             : 
     169             :             @param _rContext
     170             :                 the component context we operate in. Might be needed to create the
     171             :                 css.sdbc.DriverManager instance.
     172             :         */
     173             :         bool    supportsUserAdministration( const ::comphelper::ComponentContext& _rContext ) const;
     174             : 
     175             :         /** determines whether in the application UI, empty table folders (aka catalogs/schemas) should be displayed
     176             :         */
     177             :         bool displayEmptyTableFolders() const;
     178             : 
     179             :         /** determines that threads are supported.
     180             :         *
     181             :         * \return <TRUE/> when threads are supported, otherwise <FALSE/>
     182             :         */
     183             :         bool supportsThreads() const;
     184             :     };
     185             : 
     186             : //........................................................................
     187             : } // namespace dbtools
     188             : //........................................................................
     189             : 
     190             : #endif // CONNECTIVITY_INC_CONNECTIVITY_DBMETADATA_HXX
     191             : 
     192             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10