LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/connectivity - virtualdbtools.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 6 12 50.0 %
Date: 2012-08-25 Functions: 6 12 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     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_VIRTUAL_DBTOOLS_HXX
      21                 :            : #define CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
      22                 :            : 
      23                 :            : #include <rtl/ref.hxx>
      24                 :            : #include <rtl/ustring.hxx>
      25                 :            : #include <com/sun/star/uno/Reference.hxx>
      26                 :            : #include <com/sun/star/util/Date.hpp>
      27                 :            : #include <com/sun/star/sdbc/SQLException.hpp>
      28                 :            : #include <com/sun/star/uno/Sequence.hxx>
      29                 :            : 
      30                 :            : #include <vector>
      31                 :            : #include <memory>
      32                 :            : #include "connectivity/dbtoolsdllapi.hxx"
      33                 :            : 
      34                 :            : //========================================================================
      35                 :            : //= forward declarations
      36                 :            : //========================================================================
      37                 :            : namespace com {
      38                 :            :     namespace sun {
      39                 :            :         namespace star {
      40                 :            :             namespace util {
      41                 :            :                 class XNumberFormatter;
      42                 :            :                 class XNumberFormatTypes;
      43                 :            :                 class XNumberFormatsSupplier;
      44                 :            :             }
      45                 :            :             namespace beans {
      46                 :            :                 class XPropertySet;
      47                 :            :             }
      48                 :            :             namespace lang {
      49                 :            :                 class XMultiServiceFactory;
      50                 :            :                 class XComponent;
      51                 :            :                 class WrappedTargetException;
      52                 :            :                 struct Locale;
      53                 :            :             }
      54                 :            :             namespace sdbc {
      55                 :            :                 class XDatabaseMetaData;
      56                 :            :                 class XConnection;
      57                 :            :                 class XRowSet;
      58                 :            :                 class XDataSource;
      59                 :            :             }
      60                 :            :             namespace sdb {
      61                 :            :                 class XColumn;
      62                 :            :                 class SQLContext;
      63                 :            :             }
      64                 :            :             namespace container {
      65                 :            :                 class XNameAccess;
      66                 :            :             }
      67                 :            :         }
      68                 :            :     }
      69                 :            : }
      70                 :            : 
      71                 :            : namespace dbtools {
      72                 :            :     class SQLExceptionInfo;
      73                 :            :     class FormattedColumnValue;
      74                 :            : }
      75                 :            : 
      76                 :            : namespace comphelper {
      77                 :            :     class ComponentContext;
      78                 :            : }
      79                 :            : 
      80                 :            : //========================================================================
      81                 :            : //= entry into this library
      82                 :            : //========================================================================
      83                 :            : /** this is the entry point for the load-on-call usage of the DBTOOLS
      84                 :            :     library.
      85                 :            :     <p>When you need one of the simple objects in this library, load the lib
      86                 :            :     and call this method. The returned pointer is a pointer to an IDataAccessToolsFactory
      87                 :            :     instance, which is acquired <em>once</em>.</p>
      88                 :            :     @return
      89                 :            :         a pointer to an object implementing the IDataAccessToolsFactory interface,
      90                 :            :         aquired exactly <em>once</em>.
      91                 :            : */
      92                 :            : extern "C" OOO_DLLPUBLIC_DBTOOLS void* SAL_CALL createDataAccessToolsFactory();
      93                 :            : 
      94                 :            : //========================================================================
      95                 :            : //=
      96                 :            : //========================================================================
      97                 :            : //........................................................................
      98                 :            : namespace connectivity
      99                 :            : {
     100                 :            : //........................................................................
     101                 :            : 
     102                 :            :     class IParseContext;
     103                 :            :     //....................................................................
     104                 :            :     namespace simple
     105                 :            :     {
     106                 :            :     //....................................................................
     107                 :            : 
     108                 :            :         typedef void* (SAL_CALL * createDataAccessToolsFactoryFunction)( );
     109                 :            : 
     110                 :            :         //================================================================
     111                 :            :         //= IDataAccessTools
     112                 :            :         //================================================================
     113                 :        395 :         class OOO_DLLPUBLIC_DBTOOLS IDataAccessTools : public ::rtl::IReference
     114                 :            :         {
     115                 :            :         public:
     116                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection_withFeedback(
     117                 :            :                 const ::rtl::OUString& _rDataSourceName,
     118                 :            :                 const ::rtl::OUString& _rUser,
     119                 :            :                 const ::rtl::OUString& _rPwd,
     120                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
     121                 :            :             ) const SAL_THROW ( (::com::sun::star::sdbc::SQLException) ) = 0;
     122                 :            : 
     123                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> connectRowset(
     124                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet,
     125                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory,
     126                 :            :                 sal_Bool _bSetAsActiveConnection
     127                 :            :             ) const SAL_THROW ( ( ::com::sun::star::sdbc::SQLException
     128                 :            :                                 , ::com::sun::star::lang::WrappedTargetException
     129                 :            :                                 , ::com::sun::star::uno::RuntimeException ) ) = 0;
     130                 :            : 
     131                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getRowSetConnection(
     132                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet>& _rxRowSet)
     133                 :            :                 const SAL_THROW ( (::com::sun::star::uno::RuntimeException) ) = 0;
     134                 :            : 
     135                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier> getNumberFormats(
     136                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection>& _rxConn,
     137                 :            :                 sal_Bool _bAllowDefault
     138                 :            :             ) const = 0;
     139                 :            : 
     140                 :            :             virtual sal_Int32 getDefaultNumberFormat(
     141                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn,
     142                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatTypes >& _rxTypes,
     143                 :            :                 const ::com::sun::star::lang::Locale& _rLocale
     144                 :            :             ) const = 0;
     145                 :            : 
     146                 :            :             virtual void TransferFormComponentProperties(
     147                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxOld,
     148                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxNew,
     149                 :            :                 const ::com::sun::star::lang::Locale& _rLocale
     150                 :            :             ) const = 0;
     151                 :            : 
     152                 :            :             virtual ::rtl::OUString quoteName(
     153                 :            :                 const ::rtl::OUString& _rQuote,
     154                 :            :                 const ::rtl::OUString& _rName
     155                 :            :             ) const = 0;
     156                 :            : 
     157                 :            :             virtual ::rtl::OUString composeTableNameForSelect(
     158                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     159                 :            :                 const ::rtl::OUString& _rCatalog,
     160                 :            :                 const ::rtl::OUString& _rSchema,
     161                 :            :                 const ::rtl::OUString& _rName
     162                 :            :             ) const = 0;
     163                 :            : 
     164                 :            :             virtual ::rtl::OUString composeTableNameForSelect(
     165                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     166                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xTable
     167                 :            :             ) const = 0;
     168                 :            : 
     169                 :            :             virtual ::com::sun::star::sdb::SQLContext prependContextInfo(
     170                 :            :                 ::com::sun::star::sdbc::SQLException& _rException,
     171                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxContext,
     172                 :            :                 const ::rtl::OUString& _rContextDescription,
     173                 :            :                 const ::rtl::OUString& _rContextDetails
     174                 :            :             ) const = 0;
     175                 :            : 
     176                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDataSource > getDataSource(
     177                 :            :                 const ::rtl::OUString& _rsRegisteredName,
     178                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory>& _rxFactory
     179                 :            :             ) const = 0;
     180                 :            : 
     181                 :            :             virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >
     182                 :            :                 getFieldsByCommandDescriptor(
     183                 :            :                     const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     184                 :            :                     const sal_Int32 _nCommandType,
     185                 :            :                     const ::rtl::OUString& _rCommand,
     186                 :            :                     ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& _rxKeepFieldsAlive,
     187                 :            :                     ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
     188                 :            :                 )   SAL_THROW( ( ) ) = 0;
     189                 :            : 
     190                 :            :             virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
     191                 :            :                 getFieldNamesByCommandDescriptor(
     192                 :            :                     const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     193                 :            :                     const sal_Int32 _nCommandType,
     194                 :            :                     const ::rtl::OUString& _rCommand,
     195                 :            :                     ::dbtools::SQLExceptionInfo* _pErrorInfo = NULL
     196                 :            :                 )   SAL_THROW( ( ) ) = 0;
     197                 :            : 
     198                 :            :             /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::INSERT
     199                 :            :                 @param      _rxCursorSet    the property set
     200                 :            :             */
     201                 :            :             virtual sal_Bool canInsert(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
     202                 :            : 
     203                 :            :             /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::UPDATE
     204                 :            :                 @param      _rxCursorSet    the property set
     205                 :            :             */
     206                 :            :             virtual sal_Bool canUpdate(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
     207                 :            : 
     208                 :            :             /** check if the property "Privileges" supports ::com::sun::star::sdbcx::Privilege::DELETE
     209                 :            :                 @param      _rxCursorSet    the property set
     210                 :            :             */
     211                 :            :             virtual sal_Bool canDelete(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxCursorSet) const = 0;
     212                 :            : 
     213                 :            :             /** determines whether the given component is part of a document which is an embedded database
     214                 :            :                 document (such as a form)
     215                 :            :             */
     216                 :            :             virtual bool isEmbeddedInDatabase(
     217                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxComponent,
     218                 :            :                 ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxActualConnection
     219                 :            :             ) = 0;
     220                 :            : 
     221                 :            :         protected:
     222                 :        395 :             ~IDataAccessTools() {}
     223                 :            :         };
     224                 :            : 
     225                 :            :         //================================================================
     226                 :            :         //= IDataAccessCharSet
     227                 :            :         //================================================================
     228                 :            :         /** simple wrapper for the <type>OCharsetMap</type>
     229                 :            :         */
     230                 :          0 :         class OOO_DLLPUBLIC_DBTOOLS IDataAccessCharSet :
     231                 :            :             public ::rtl::IReference
     232                 :            :         {
     233                 :            :             // to be extended if necessary ....
     234                 :            :         public:
     235                 :            :             /** enumerates all supported char sets
     236                 :            :             @return the number of charsets supported
     237                 :            :             */
     238                 :            :             virtual sal_Int32   getSupportedTextEncodings(
     239                 :            :                 ::std::vector< rtl_TextEncoding >& /* [out] */ _rEncs
     240                 :            :             ) const = 0;
     241                 :            : 
     242                 :            :         protected:
     243                 :          0 :             ~IDataAccessCharSet() {}
     244                 :            :         };
     245                 :            : 
     246                 :            :         //================================================================
     247                 :            :         //= IDataAccessTypeConversion
     248                 :            :         //================================================================
     249                 :        395 :         class OOO_DLLPUBLIC_DBTOOLS IDataAccessTypeConversion :
     250                 :            :             public ::rtl::IReference
     251                 :            :         {
     252                 :            :         public:
     253                 :            :             virtual ::com::sun::star::util::Date getStandardDate() const = 0;
     254                 :            : 
     255                 :            :             virtual double getValue(
     256                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn>& _rxVariant,
     257                 :            :                 const ::com::sun::star::util::Date& rNullDate ) const = 0;
     258                 :            : 
     259                 :            :             virtual ::rtl::OUString getFormattedValue(
     260                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdb::XColumn >& _rxColumn,
     261                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
     262                 :            :                 const ::com::sun::star::util::Date& _rNullDate,
     263                 :            :                 sal_Int32 _nKey,
     264                 :            :                 sal_Int16 _nKeyType) const = 0;
     265                 :            : 
     266                 :            :             virtual ::rtl::OUString getFormattedValue(
     267                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _rxColumn,
     268                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter>& _rxFormatter,
     269                 :            :                 const ::com::sun::star::lang::Locale& _rLocale,
     270                 :            :                 const ::com::sun::star::util::Date& _rNullDate
     271                 :            :             ) const = 0;
     272                 :            : 
     273                 :            :         protected:
     274                 :        395 :             ~IDataAccessTypeConversion() {}
     275                 :            :         };
     276                 :            : 
     277                 :            :         //================================================================
     278                 :            :         //= ISQLParseNode
     279                 :            :         //================================================================
     280                 :            :         /** a simple version of the OSQLParseNode, with all methods beeing virtual
     281                 :            :         */
     282                 :          0 :         class OOO_DLLPUBLIC_DBTOOLS ISQLParseNode : public ::rtl::IReference
     283                 :            :         {
     284                 :            :         public:
     285                 :            :             virtual void parseNodeToStr(::rtl::OUString& _rString,
     286                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     287                 :            :                 const IParseContext* _pContext
     288                 :            :             ) const = 0;
     289                 :            : 
     290                 :            :             virtual void parseNodeToPredicateStr(::rtl::OUString& _rString,
     291                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection,
     292                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
     293                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField,
     294                 :            :                 const ::com::sun::star::lang::Locale& _rIntl,
     295                 :            :                 const sal_Char _cDecSeparator,
     296                 :            :                 const IParseContext* _pContext
     297                 :            :             ) const = 0;
     298                 :            : 
     299                 :            :         protected:
     300                 :          0 :             ~ISQLParseNode() {}
     301                 :            :         };
     302                 :            : 
     303                 :            :         //================================================================
     304                 :            :         //= ISQLParser
     305                 :            :         //================================================================
     306                 :            :         /** a simple version of the OSQLParser, with all methods beeing virtual
     307                 :            :         */
     308                 :          0 :         class OOO_DLLPUBLIC_DBTOOLS ISQLParser : public ::rtl::IReference
     309                 :            :         {
     310                 :            :         public:
     311                 :            :             virtual ::rtl::Reference< ISQLParseNode > predicateTree(
     312                 :            :                 ::rtl::OUString& rErrorMessage,
     313                 :            :                 const ::rtl::OUString& rStatement,
     314                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& _rxFormatter,
     315                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxField
     316                 :            :             ) const = 0;
     317                 :            : 
     318                 :            :             virtual const IParseContext& getContext() const = 0;
     319                 :            : 
     320                 :            :         protected:
     321                 :          0 :             ~ISQLParser() {}
     322                 :            :         };
     323                 :            : 
     324                 :            :         //================================================================
     325                 :            :         //= IDataAccessToolsFactory
     326                 :            :         //================================================================
     327                 :            :         /** the main factory for runtime-loadable tools in the DBTOOLS library
     328                 :            :         */
     329                 :        395 :         class OOO_DLLPUBLIC_DBTOOLS IDataAccessToolsFactory :
     330                 :            :             public ::rtl::IReference
     331                 :            :         {
     332                 :            :         public:
     333                 :            :             /// creates a simple version of the class OSQLParser
     334                 :            :             virtual ::rtl::Reference< ISQLParser > createSQLParser(
     335                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxServiceFactory,
     336                 :            :                 const IParseContext* _pContext
     337                 :            :                 ) const = 0;
     338                 :            : 
     339                 :            :             /// creates a helper for charset related functionality (<type>OCharsetMap</type>)
     340                 :            :             virtual ::rtl::Reference< IDataAccessCharSet > createCharsetHelper( ) const = 0;
     341                 :            : 
     342                 :            :             /// creates a simple version of the DBTypeConversion helper
     343                 :            :             virtual ::rtl::Reference< IDataAccessTypeConversion > getTypeConversionHelper() = 0;
     344                 :            : 
     345                 :            :             /// creates a helper which can be used to access the static methods in dbtools.hxx
     346                 :            :             virtual ::rtl::Reference< IDataAccessTools > getDataAccessTools() = 0;
     347                 :            : 
     348                 :            :             virtual ::std::auto_ptr< ::dbtools::FormattedColumnValue >  createFormattedColumnValue(
     349                 :            :                 const ::comphelper::ComponentContext& _rContext,
     350                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XRowSet >& _rxRowSet,
     351                 :            :                 const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rxColumn
     352                 :            :             ) = 0;
     353                 :            : 
     354                 :            :         protected:
     355                 :        395 :             ~IDataAccessToolsFactory() {}
     356                 :            :         };
     357                 :            : 
     358                 :            :     //....................................................................
     359                 :            :     }   //  namespace simple
     360                 :            :     //....................................................................
     361                 :            : 
     362                 :            : //........................................................................
     363                 :            : }   // namespace connectivity
     364                 :            : //........................................................................
     365                 :            : 
     366                 :            : #endif // CONNECTIVITY_VIRTUAL_DBTOOLS_HXX
     367                 :            : 
     368                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10