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

Generated by: LCOV version 1.10