LCOV - code coverage report
Current view: top level - include/connectivity - TTableHelper.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 4 0.0 %
Date: 2014-04-14 Functions: 0 4 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 INCLUDED_CONNECTIVITY_TTABLEHELPER_HXX
      21             : #define INCLUDED_CONNECTIVITY_TTABLEHELPER_HXX
      22             : 
      23             : #include <sal/config.h>
      24             : 
      25             : #include <map>
      26             : 
      27             : #include <connectivity/dbtoolsdllapi.hxx>
      28             : #include <connectivity/sdbcx/VTable.hxx>
      29             : #include <connectivity/sdbcx/VKey.hxx>
      30             : #include <connectivity/StdTypeDefs.hxx>
      31             : #include <com/sun/star/sdb/tools/XTableRename.hpp>
      32             : #include <com/sun/star/sdb/tools/XTableAlteration.hpp>
      33             : #include <com/sun/star/sdb/tools/XKeyAlteration.hpp>
      34             : #include <com/sun/star/sdb/tools/XIndexAlteration.hpp>
      35             : 
      36             : namespace connectivity
      37             : {
      38             :     typedef sal_Int32   OrdinalPosition;
      39           0 :     struct ColumnDesc
      40             :     {
      41             :         OUString sName;
      42             :         OUString aField6;
      43             :         OUString sField12; // REMARKS
      44             :         OUString sField13;
      45             :         sal_Int32       nField5
      46             :                     ,   nField7
      47             :                     ,   nField9
      48             :                     ,   nField11;
      49             : 
      50             :         OrdinalPosition nOrdinalPosition;
      51             : 
      52             :         ColumnDesc() {}
      53           0 :         ColumnDesc( const OUString& _rName
      54             :             , sal_Int32     _nField5
      55             :             , const OUString& _aField6
      56             :             , sal_Int32     _nField7
      57             :             , sal_Int32     _nField9
      58             :             , sal_Int32     _nField11
      59             :             , const OUString& _sField12
      60             :             , const OUString& _sField13
      61             :             ,OrdinalPosition _nPosition )
      62             :             :sName( _rName )
      63             :             ,aField6(_aField6)
      64             :             ,sField12(_sField12)
      65             :             ,sField13(_sField13)
      66             :             ,nField5(_nField5)
      67             :             ,nField7(_nField7)
      68             :             ,nField9(_nField9)
      69             :             ,nField11(_nField11)
      70           0 :             ,nOrdinalPosition( _nPosition )
      71             :         {
      72           0 :         }
      73             :     };
      74             :     typedef connectivity::sdbcx::OTable OTable_TYPEDEF;
      75             : 
      76             :     OOO_DLLPUBLIC_DBTOOLS OUString getTypeString(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xColProp);
      77             : 
      78             :     typedef std::map<OUString, sdbcx::TKeyProperties> TKeyMap;
      79             : 
      80             :     struct OTableHelperImpl;
      81             : 
      82             :     class OOO_DLLPUBLIC_DBTOOLS OTableHelper : public OTable_TYPEDEF
      83             :     {
      84             :         ::std::auto_ptr<OTableHelperImpl> m_pImpl;
      85             : 
      86             :         void refreshPrimaryKeys(TStringVector& _rKeys);
      87             :         void refreshForeignKeys(TStringVector& _rKeys);
      88             : 
      89             :     protected:
      90             :         /** creates the column collection for the table
      91             :             @param  _rNames
      92             :                 The column names.
      93             :         */
      94             :         virtual sdbcx::OCollection* createColumns(const TStringVector& _rNames) = 0;
      95             : 
      96             :         /** creates the key collection for the table
      97             :             @param  _rNames
      98             :                 The key names.
      99             :         */
     100             :         virtual sdbcx::OCollection* createKeys(const TStringVector& _rNames) = 0;
     101             : 
     102             :         /** creates the index collection for the table
     103             :             @param  _rNames
     104             :                 The index names.
     105             :         */
     106             :         virtual sdbcx::OCollection* createIndexes(const TStringVector& _rNames) = 0;
     107             : 
     108             :         /** this function is called upon disposing the component
     109             :         */
     110             :         virtual void SAL_CALL disposing() SAL_OVERRIDE;
     111             : 
     112             :         /** The default returns "RENAME TABLE " or "RENAME VIEW " depending on the type.
     113             :         *
     114             :         * \return The start of the rename statement.
     115             :         */
     116             :         virtual OUString getRenameStart() const;
     117             : 
     118             :         virtual ~OTableHelper();
     119             : 
     120             :     public:
     121             :         virtual void refreshColumns() SAL_OVERRIDE;
     122             :         virtual void refreshKeys() SAL_OVERRIDE;
     123             :         virtual void refreshIndexes() SAL_OVERRIDE;
     124             : 
     125             :         const ColumnDesc* getColumnDescription(const OUString& _sName) const;
     126             : 
     127             :     public:
     128             :         OTableHelper(   sdbcx::OCollection* _pTables,
     129             :                         const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
     130             :                         bool _bCase);
     131             :         OTableHelper(   sdbcx::OCollection* _pTables,
     132             :                         const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _xConnection,
     133             :                         bool _bCase,
     134             :                         const OUString& _Name,
     135             :                         const OUString& _Type,
     136             :                         const OUString& _Description = OUString(),
     137             :                         const OUString& _SchemaName = OUString(),
     138             :                         const OUString& _CatalogName = OUString()
     139             :             );
     140             : 
     141             :         virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> getMetaData() const SAL_OVERRIDE;
     142             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection> getConnection() const;
     143             : 
     144             :         virtual void SAL_CALL acquire() throw() SAL_OVERRIDE;
     145             :         virtual void SAL_CALL release() throw() SAL_OVERRIDE;
     146             : 
     147             :         // XRename
     148             :         virtual void SAL_CALL rename( const OUString& newName ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::container::ElementExistException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     149             : 
     150             :         // XAlterTable
     151             :         virtual void SAL_CALL alterColumnByIndex( sal_Int32 index, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& descriptor ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     152             :         // XNamed
     153             :         virtual OUString SAL_CALL getName() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     154             : 
     155             :         // helper method to get key properties
     156             :         sdbcx::TKeyProperties getKeyProperties(const OUString& _sName) const;
     157             :         void addKey(const OUString& _sName,const sdbcx::TKeyProperties& _aKeyProperties);
     158             : 
     159             :         virtual OUString getTypeCreatePattern() const;
     160             : 
     161             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableRename>      getRenameService() const;
     162             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XTableAlteration>  getAlterService() const;
     163             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XKeyAlteration>    getKeyService() const;
     164             :         ::com::sun::star::uno::Reference< ::com::sun::star::sdb::tools::XIndexAlteration>  getIndexService() const;
     165             :     };
     166             : }
     167             : #endif // INCLUDED_CONNECTIVITY_TTABLEHELPER_HXX
     168             : 
     169             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10