LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - table.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 171 0.0 %
Date: 2012-08-25 Functions: 0 28 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 564 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                 :            : 
      21                 :            : #include "table.hxx"
      22                 :            : #include <definitioncolumn.hxx>
      23                 :            : #include "dbastrings.hrc"
      24                 :            : #include "core_resource.hxx"
      25                 :            : #include "core_resource.hrc"
      26                 :            : #include "CIndexes.hxx"
      27                 :            : 
      28                 :            : #include <tools/debug.hxx>
      29                 :            : #include <osl/diagnose.h>
      30                 :            : #include <cppuhelper/typeprovider.hxx>
      31                 :            : #include <comphelper/enumhelper.hxx>
      32                 :            : #include <comphelper/container.hxx>
      33                 :            : #include <comphelper/sequence.hxx>
      34                 :            : #include <comphelper/types.hxx>
      35                 :            : #include <com/sun/star/util/XRefreshListener.hpp>
      36                 :            : #include <com/sun/star/sdbc/XConnection.hpp>
      37                 :            : #include <com/sun/star/sdbc/XRow.hpp>
      38                 :            : #include <com/sun/star/sdbcx/Privilege.hpp>
      39                 :            : #include <com/sun/star/sdbc/XResultSetMetaData.hpp>
      40                 :            : #include <com/sun/star/sdbc/XResultSetMetaDataSupplier.hpp>
      41                 :            : 
      42                 :            : #include <connectivity/TKeys.hxx>
      43                 :            : #include <connectivity/dbtools.hxx>
      44                 :            : #include <connectivity/dbexception.hxx>
      45                 :            : 
      46                 :            : #include "sdbcoretools.hxx"
      47                 :            : #include "ContainerMediator.hxx"
      48                 :            : #include <rtl/logfile.hxx>
      49                 :            : 
      50                 :            : using namespace dbaccess;
      51                 :            : using namespace connectivity;
      52                 :            : using namespace ::com::sun::star::uno;
      53                 :            : using namespace ::com::sun::star::util;
      54                 :            : using namespace ::com::sun::star::lang;
      55                 :            : using namespace ::com::sun::star::beans;
      56                 :            : using namespace ::com::sun::star::sdbc;
      57                 :            : using namespace ::com::sun::star::sdbcx;
      58                 :            : using namespace ::com::sun::star::container;
      59                 :            : using namespace ::osl;
      60                 :            : using namespace ::comphelper;
      61                 :            : using namespace ::cppu;
      62                 :            : 
      63                 :            : //==========================================================================
      64                 :            : //= ODBTable
      65                 :            : //==========================================================================
      66                 :            : DBG_NAME(ODBTable)
      67                 :            : 
      68                 :          0 : ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables
      69                 :            :         ,const Reference< XConnection >& _rxConn
      70                 :            :         ,const ::rtl::OUString& _rCatalog
      71                 :            :         ,const ::rtl::OUString& _rSchema
      72                 :            :         ,const ::rtl::OUString& _rName
      73                 :            :         ,const ::rtl::OUString& _rType
      74                 :            :         ,const ::rtl::OUString& _rDesc
      75                 :            :         ,const Reference< XNameAccess >& _xColumnDefinitions) throw(SQLException)
      76 [ #  # ][ #  # ]:          0 :     :OTable_Base(_pTables,_rxConn,_rxConn->getMetaData().is() && _rxConn->getMetaData()->supportsMixedCaseQuotedIdentifiers(), _rName, _rType, _rDesc, _rSchema, _rCatalog )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
      77                 :            :     ,m_xColumnDefinitions(_xColumnDefinitions)
      78   [ #  #  #  # ]:          0 :     ,m_nPrivileges(0)
         [ #  # ][ #  # ]
      79                 :            : {
      80                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" );
      81                 :            :     DBG_CTOR(ODBTable, NULL);
      82                 :            :     OSL_ENSURE(getMetaData().is(), "ODBTable::ODBTable : invalid conn !");
      83                 :            :     OSL_ENSURE(!_rName.isEmpty(), "ODBTable::ODBTable : name !");
      84                 :            :     // TODO : think about collecting the privileges here, as we can't ensure that in getFastPropertyValue, where
      85                 :            :     // we do this at the moment, the statement needed can be supplied by the connection (for example the SQL-Server
      86                 :            :     // ODBC driver does not allow more than one statement per connection, and in getFastPropertyValue it's more
      87                 :            :     // likely that it's already used up than it's here.)
      88                 :          0 : }
      89                 :            : 
      90                 :          0 : ODBTable::ODBTable(connectivity::sdbcx::OCollection* _pTables
      91                 :            :                    ,const Reference< XConnection >& _rxConn)
      92                 :            :                 throw(SQLException)
      93 [ #  # ][ #  # ]:          0 :     :OTable_Base(_pTables,_rxConn, _rxConn->getMetaData().is() && _rxConn->getMetaData()->supportsMixedCaseQuotedIdentifiers())
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  # ]
      94   [ #  #  #  # ]:          0 :     ,m_nPrivileges(-1)
         [ #  # ][ #  # ]
      95                 :            : {
      96                 :            :     DBG_CTOR(ODBTable, NULL);
      97                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::ODBTable" );
      98                 :          0 : }
      99                 :            : 
     100 [ #  # ][ #  # ]:          0 : ODBTable::~ODBTable()
     101                 :            : {
     102                 :            :     DBG_DTOR(ODBTable, NULL);
     103         [ #  # ]:          0 : }
     104                 :            : 
     105                 :          0 : IMPLEMENT_FORWARD_REFCOUNT(ODBTable,OTable_Base)
     106                 :            : 
     107                 :          0 : OColumn* ODBTable::createColumn(const ::rtl::OUString& _rName) const
     108                 :            : {
     109                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumn" );
     110                 :          0 :     OColumn* pReturn = NULL;
     111                 :            : 
     112                 :          0 :     Reference<XPropertySet> xProp;
     113 [ #  # ][ #  # ]:          0 :     if ( m_xDriverColumns.is() && m_xDriverColumns->hasByName(_rName) )
         [ #  # ][ #  # ]
                 [ #  # ]
     114                 :            :     {
     115 [ #  # ][ #  # ]:          0 :         xProp.set(m_xDriverColumns->getByName(_rName),UNO_QUERY);
                 [ #  # ]
     116                 :            :     }
     117                 :            :     else
     118                 :            :     {
     119                 :          0 :         OColumns* pColumns = static_cast<OColumns*>(m_pColumns);
     120 [ #  # ][ #  # ]:          0 :         xProp.set(pColumns->createBaseObject(_rName),UNO_QUERY);
     121                 :            :     }
     122                 :            : 
     123                 :          0 :     Reference<XPropertySet> xColumnDefintion;
     124 [ #  # ][ #  # ]:          0 :     if ( m_xColumnDefinitions.is() && m_xColumnDefinitions->hasByName(_rName) )
         [ #  # ][ #  # ]
                 [ #  # ]
     125 [ #  # ][ #  # ]:          0 :         xColumnDefintion.set(m_xColumnDefinitions->getByName(_rName),UNO_QUERY);
                 [ #  # ]
     126         [ #  # ]:          0 :     pReturn = new OTableColumnWrapper( xProp, xColumnDefintion, false );
     127                 :            : 
     128                 :          0 :     return pReturn;
     129                 :            : }
     130                 :            : 
     131                 :          0 : void ODBTable::columnAppended( const Reference< XPropertySet >& /*_rxSourceDescriptor*/ )
     132                 :            : {
     133                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnAppended" );
     134                 :            :     // not interested in
     135                 :          0 : }
     136                 :            : 
     137                 :          0 : void ODBTable::columnDropped(const ::rtl::OUString& _sName)
     138                 :            : {
     139                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::columnDropped" );
     140         [ #  # ]:          0 :     Reference<XDrop> xDrop(m_xColumnDefinitions,UNO_QUERY);
     141 [ #  # ][ #  # ]:          0 :     if ( xDrop.is() && m_xColumnDefinitions->hasByName(_sName) )
         [ #  # ][ #  # ]
                 [ #  # ]
     142                 :            :     {
     143 [ #  # ][ #  # ]:          0 :         xDrop->dropByName(_sName);
     144                 :          0 :     }
     145                 :          0 : }
     146                 :            : 
     147                 :          0 : Sequence< sal_Int8 > ODBTable::getImplementationId() throw (RuntimeException)
     148                 :            : {
     149                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getImplementationId" );
     150                 :            :     static OImplementationId * pId = 0;
     151         [ #  # ]:          0 :     if (! pId)
     152                 :            :     {
     153 [ #  # ][ #  # ]:          0 :         MutexGuard aGuard( Mutex::getGlobalMutex() );
     154         [ #  # ]:          0 :         if (! pId)
     155                 :            :         {
     156 [ #  # ][ #  # ]:          0 :             static OImplementationId aId;
     157                 :          0 :             pId = &aId;
     158         [ #  # ]:          0 :         }
     159                 :            :     }
     160                 :          0 :     return pId->getImplementationId();
     161                 :            : }
     162                 :            : 
     163                 :            : // OComponentHelper
     164                 :          0 : void SAL_CALL ODBTable::disposing()
     165                 :            : {
     166                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::disposing" );
     167                 :          0 :     OPropertySetHelper::disposing();
     168                 :          0 :     OTable_Base::disposing();
     169                 :          0 :     m_xColumnDefinitions = NULL;
     170                 :          0 :     m_xDriverColumns = NULL;
     171                 :          0 :     m_pColumnMediator = NULL;
     172                 :          0 : }
     173                 :            : 
     174                 :          0 : void ODBTable::getFastPropertyValue(Any& _rValue, sal_Int32 _nHandle) const
     175                 :            : {
     176                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getFastPropertyValue" );
     177 [ #  # ][ #  # ]:          0 :     if ((PROPERTY_ID_PRIVILEGES == _nHandle) && (-1 == m_nPrivileges))
     178                 :            :     {   // somebody is asking for the privileges an we do not know them, yet
     179         [ #  # ]:          0 :         const_cast<ODBTable*>(this)->m_nPrivileges = ::dbtools::getTablePrivileges(getMetaData(),m_CatalogName,m_SchemaName, m_Name);
     180                 :            :     }
     181                 :            : 
     182                 :          0 :     OTable_Base::getFastPropertyValue(_rValue, _nHandle);
     183                 :          0 : }
     184                 :            : 
     185                 :          0 : void ODBTable::construct()
     186                 :            : {
     187                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::construct" );
     188         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
     189                 :            : 
     190                 :            :     // we don't collect the privileges here, this is potentially expensive. Instead we determine them on request.
     191                 :            :     // (see getFastPropertyValue)
     192                 :          0 :     m_nPrivileges = -1;
     193                 :            : 
     194         [ #  # ]:          0 :     OTable_Base::construct();
     195                 :            : 
     196                 :            :     registerProperty(PROPERTY_FILTER, PROPERTY_ID_FILTER, PropertyAttribute::BOUND,
     197 [ #  # ][ #  # ]:          0 :                     &m_sFilter, ::getCppuType(&m_sFilter));
                 [ #  # ]
     198                 :            : 
     199                 :            :     registerProperty(PROPERTY_ORDER, PROPERTY_ID_ORDER, PropertyAttribute::BOUND,
     200 [ #  # ][ #  # ]:          0 :                     &m_sOrder, ::getCppuType(&m_sOrder));
                 [ #  # ]
     201                 :            : 
     202                 :            :     registerProperty(PROPERTY_APPLYFILTER, PROPERTY_ID_APPLYFILTER, PropertyAttribute::BOUND,
     203 [ #  # ][ #  # ]:          0 :                     &m_bApplyFilter, ::getBooleanCppuType());
                 [ #  # ]
     204                 :            : 
     205                 :            :     registerProperty(PROPERTY_FONT, PROPERTY_ID_FONT, PropertyAttribute::BOUND,
     206 [ #  # ][ #  # ]:          0 :                     &m_aFont, ::getCppuType(&m_aFont));
                 [ #  # ]
     207                 :            : 
     208                 :            :     registerMayBeVoidProperty(PROPERTY_ROW_HEIGHT, PROPERTY_ID_ROW_HEIGHT, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
     209 [ #  # ][ #  # ]:          0 :                     &m_aRowHeight, ::getCppuType(static_cast<sal_Int32*>(NULL)));
                 [ #  # ]
     210                 :            : 
     211                 :            :     registerMayBeVoidProperty(PROPERTY_TEXTCOLOR, PROPERTY_ID_TEXTCOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
     212 [ #  # ][ #  # ]:          0 :                     &m_aTextColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
                 [ #  # ]
     213                 :            : 
     214                 :            :     registerProperty(PROPERTY_PRIVILEGES, PROPERTY_ID_PRIVILEGES, PropertyAttribute::BOUND | PropertyAttribute::READONLY,
     215 [ #  # ][ #  # ]:          0 :                     &m_nPrivileges, ::getCppuType(static_cast<sal_Int32*>(NULL)));
                 [ #  # ]
     216                 :            : 
     217                 :            :     registerMayBeVoidProperty(PROPERTY_TEXTLINECOLOR, PROPERTY_ID_TEXTLINECOLOR, PropertyAttribute::BOUND | PropertyAttribute::MAYBEVOID,
     218 [ #  # ][ #  # ]:          0 :                     &m_aTextLineColor, ::getCppuType(static_cast<sal_Int32*>(NULL)));
                 [ #  # ]
     219                 :            : 
     220                 :            :     registerProperty(PROPERTY_TEXTEMPHASIS, PROPERTY_ID_TEXTEMPHASIS, PropertyAttribute::BOUND,
     221 [ #  # ][ #  # ]:          0 :                     &m_nFontEmphasis, ::getCppuType(&m_nFontEmphasis));
                 [ #  # ]
     222                 :            : 
     223                 :            :     registerProperty(PROPERTY_TEXTRELIEF, PROPERTY_ID_TEXTRELIEF, PropertyAttribute::BOUND,
     224 [ #  # ][ #  # ]:          0 :                     &m_nFontRelief, ::getCppuType(&m_nFontRelief));
                 [ #  # ]
     225                 :            : 
     226 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTNAME,         PROPERTY_ID_FONTNAME,        PropertyAttribute::BOUND,&m_aFont.Name,            ::getCppuType(&m_aFont.Name));
                 [ #  # ]
     227 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTHEIGHT,       PROPERTY_ID_FONTHEIGHT,      PropertyAttribute::BOUND,&m_aFont.Height,          ::getCppuType(&m_aFont.Height));
                 [ #  # ]
     228 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTWIDTH,        PROPERTY_ID_FONTWIDTH,       PropertyAttribute::BOUND,&m_aFont.Width,           ::getCppuType(&m_aFont.Width));
                 [ #  # ]
     229 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTSTYLENAME,    PROPERTY_ID_FONTSTYLENAME,   PropertyAttribute::BOUND,&m_aFont.StyleName,       ::getCppuType(&m_aFont.StyleName));
                 [ #  # ]
     230 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTFAMILY,       PROPERTY_ID_FONTFAMILY,      PropertyAttribute::BOUND,&m_aFont.Family,          ::getCppuType(&m_aFont.Family));
                 [ #  # ]
     231 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTCHARSET,      PROPERTY_ID_FONTCHARSET,     PropertyAttribute::BOUND,&m_aFont.CharSet,         ::getCppuType(&m_aFont.CharSet));
                 [ #  # ]
     232 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTPITCH,        PROPERTY_ID_FONTPITCH,       PropertyAttribute::BOUND,&m_aFont.Pitch,           ::getCppuType(&m_aFont.Pitch));
                 [ #  # ]
     233 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTCHARWIDTH,    PROPERTY_ID_FONTCHARWIDTH,   PropertyAttribute::BOUND,&m_aFont.CharacterWidth,  ::getCppuType(&m_aFont.CharacterWidth));
                 [ #  # ]
     234 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTWEIGHT,       PROPERTY_ID_FONTWEIGHT,      PropertyAttribute::BOUND,&m_aFont.Weight,          ::getCppuType(&m_aFont.Weight));
                 [ #  # ]
     235 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTSLANT,        PROPERTY_ID_FONTSLANT,       PropertyAttribute::BOUND,&m_aFont.Slant,           ::getCppuType(&m_aFont.Slant));
                 [ #  # ]
     236 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTUNDERLINE,    PROPERTY_ID_FONTUNDERLINE,   PropertyAttribute::BOUND,&m_aFont.Underline,       ::getCppuType(&m_aFont.Underline));
                 [ #  # ]
     237 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTSTRIKEOUT,    PROPERTY_ID_FONTSTRIKEOUT,   PropertyAttribute::BOUND,&m_aFont.Strikeout,       ::getCppuType(&m_aFont.Strikeout));
                 [ #  # ]
     238 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTORIENTATION,  PROPERTY_ID_FONTORIENTATION, PropertyAttribute::BOUND,&m_aFont.Orientation,     ::getCppuType(&m_aFont.Orientation));
                 [ #  # ]
     239 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTKERNING,      PROPERTY_ID_FONTKERNING,     PropertyAttribute::BOUND,&m_aFont.Kerning,         ::getCppuType(&m_aFont.Kerning));
                 [ #  # ]
     240 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTWORDLINEMODE, PROPERTY_ID_FONTWORDLINEMODE,PropertyAttribute::BOUND,&m_aFont.WordLineMode,    ::getCppuType(&m_aFont.WordLineMode));
                 [ #  # ]
     241 [ #  # ][ #  # ]:          0 :     registerProperty(PROPERTY_FONTTYPE,         PROPERTY_ID_FONTTYPE,        PropertyAttribute::BOUND,&m_aFont.Type,            ::getCppuType(&m_aFont.Type));
                 [ #  # ]
     242                 :            : 
     243 [ #  # ][ #  # ]:          0 :     refreshColumns();
     244                 :          0 : }
     245                 :            : 
     246                 :          0 : ::cppu::IPropertyArrayHelper* ODBTable::createArrayHelper( sal_Int32 _nId) const
     247                 :            : {
     248                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createArrayHelper" );
     249         [ #  # ]:          0 :     Sequence< Property > aProps;
     250         [ #  # ]:          0 :     describeProperties(aProps);
     251         [ #  # ]:          0 :     if(!_nId)
     252                 :            :     {
     253         [ #  # ]:          0 :         Property* pIter = aProps.getArray();
     254                 :          0 :         Property* pEnd  = pIter + aProps.getLength();
     255         [ #  # ]:          0 :         for(;pIter != pEnd;++pIter)
     256                 :            :         {
     257         [ #  # ]:          0 :             if (pIter->Name.equalsAsciiL(PROPERTY_CATALOGNAME.ascii, PROPERTY_CATALOGNAME.length))
     258                 :          0 :                 pIter->Attributes = PropertyAttribute::READONLY;
     259         [ #  # ]:          0 :             else if (pIter->Name.equalsAsciiL(PROPERTY_SCHEMANAME.ascii, PROPERTY_SCHEMANAME.length))
     260                 :          0 :                 pIter->Attributes = PropertyAttribute::READONLY;
     261         [ #  # ]:          0 :             else if (pIter->Name.equalsAsciiL(PROPERTY_DESCRIPTION.ascii, PROPERTY_DESCRIPTION.length))
     262                 :          0 :                 pIter->Attributes = PropertyAttribute::READONLY;
     263         [ #  # ]:          0 :             else if (pIter->Name.equalsAsciiL(PROPERTY_NAME.ascii, PROPERTY_NAME.length))
     264                 :          0 :                 pIter->Attributes = PropertyAttribute::READONLY;
     265                 :            :         }
     266                 :            :     }
     267                 :            : 
     268 [ #  # ][ #  # ]:          0 :     return new ::cppu::OPropertyArrayHelper(aProps);
     269                 :            : }
     270                 :            : 
     271                 :          0 : ::cppu::IPropertyArrayHelper & SAL_CALL ODBTable::getInfoHelper()
     272                 :            : {
     273         [ #  # ]:          0 :     return *ODBTable_PROP::getArrayHelper(isNew() ? 1 : 0);
     274                 :            : }
     275                 :            : 
     276                 :            : // XServiceInfo
     277 [ #  # ][ #  # ]:          0 : IMPLEMENT_SERVICE_INFO1(ODBTable, "com.sun.star.sdb.dbaccess.ODBTable", SERVICE_SDBCX_TABLE.ascii)
         [ #  # ][ #  # ]
                 [ #  # ]
     278                 :            : 
     279                 :          0 : Any SAL_CALL ODBTable::queryInterface( const Type & rType ) throw(RuntimeException)
     280                 :            : {
     281                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getInfoHelper" );
     282 [ #  # ][ #  # ]:          0 :     if(rType == getCppuType( (Reference<XRename>*)0) && !getRenameService().is() )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     283                 :          0 :         return Any();
     284 [ #  # ][ #  # ]:          0 :     if(rType == getCppuType( (Reference<XAlterTable>*)0) && !getAlterService().is() )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     285                 :          0 :         return Any();
     286                 :          0 :     return OTable_Base::queryInterface( rType);
     287                 :            : }
     288                 :            : 
     289                 :          0 : Sequence< Type > SAL_CALL ODBTable::getTypes(  ) throw(RuntimeException)
     290                 :            : {
     291                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getTypes" );
     292         [ #  # ]:          0 :     Type aRenameType = getCppuType( (Reference<XRename>*)0);
     293         [ #  # ]:          0 :     Type aAlterType = getCppuType( (Reference<XAlterTable>*)0);
     294                 :            : 
     295         [ #  # ]:          0 :     Sequence< Type > aTypes(OTable_Base::getTypes());
     296         [ #  # ]:          0 :     ::std::vector<Type> aOwnTypes;
     297         [ #  # ]:          0 :     aOwnTypes.reserve(aTypes.getLength());
     298                 :            : 
     299                 :          0 :     const Type* pIter = aTypes.getConstArray();
     300                 :          0 :     const Type* pEnd = pIter + aTypes.getLength();
     301         [ #  # ]:          0 :     for(;pIter != pEnd ;++pIter)
     302                 :            :     {
     303 [ #  # ][ #  # ]:          0 :         if( (*pIter != aRenameType || getRenameService().is()) && (*pIter != aAlterType || getAlterService().is()))
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
           [ #  #  #  #  
                   #  # ]
     304         [ #  # ]:          0 :             aOwnTypes.push_back(*pIter);
     305                 :            :     }
     306                 :            : 
     307         [ #  # ]:          0 :     Type* pTypes = aOwnTypes.empty() ? 0 : &aOwnTypes[0];
     308 [ #  # ][ #  # ]:          0 :     return Sequence< Type >(pTypes, aOwnTypes.size());
     309                 :            : }
     310                 :            : 
     311                 :            : // XRename,
     312                 :          0 : void SAL_CALL ODBTable::rename( const ::rtl::OUString& _rNewName ) throw(SQLException, ElementExistException, RuntimeException)
     313                 :            : {
     314                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::rename" );
     315         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
     316         [ #  # ]:          0 :     checkDisposed(connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed);
     317 [ #  # ][ #  # ]:          0 :     if ( !getRenameService().is() )
     318 [ #  # ][ #  # ]:          0 :         throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() );
         [ #  # ][ #  # ]
     319                 :            : 
     320         [ #  # ]:          0 :     Reference<XPropertySet> xTable(this);
     321 [ #  # ][ #  # ]:          0 :     getRenameService()->rename(xTable,_rNewName);
                 [ #  # ]
     322 [ #  # ][ #  # ]:          0 :     ::connectivity::OTable_TYPEDEF::rename(_rNewName);
     323                 :          0 : }
     324                 :            : 
     325                 :            : // XAlterTable,
     326                 :          0 : void SAL_CALL ODBTable::alterColumnByName( const ::rtl::OUString& _rName, const Reference< XPropertySet >& _rxDescriptor ) throw(SQLException, NoSuchElementException, RuntimeException)
     327                 :            : {
     328                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::alterColumnByName" );
     329         [ #  # ]:          0 :     ::osl::MutexGuard aGuard(m_aMutex);
     330         [ #  # ]:          0 :     checkDisposed(connectivity::sdbcx::OTableDescriptor_BASE::rBHelper.bDisposed);
     331 [ #  # ][ #  # ]:          0 :     if ( !getAlterService().is() )
     332 [ #  # ][ #  # ]:          0 :         throw SQLException(DBACORE_RESSTRING(RID_STR_NO_TABLE_RENAME),*this,SQLSTATE_GENERAL,1000,Any() );
         [ #  # ][ #  # ]
     333                 :            : 
     334 [ #  # ][ #  # ]:          0 :     if ( !m_pColumns->hasByName(_rName) )
     335 [ #  # ][ #  # ]:          0 :         throw SQLException(DBACORE_RESSTRING(RID_STR_COLUMN_NOT_VALID),*this,SQLSTATE_GENERAL,1000,Any() );
         [ #  # ][ #  # ]
     336                 :            : 
     337         [ #  # ]:          0 :     Reference<XPropertySet> xTable(this);
     338 [ #  # ][ #  # ]:          0 :     getAlterService()->alterColumnByName(xTable,_rName,_rxDescriptor);
                 [ #  # ]
     339 [ #  # ][ #  # ]:          0 :     m_pColumns->refresh();
     340                 :          0 : }
     341                 :            : 
     342                 :          0 : sal_Int64 SAL_CALL ODBTable::getSomething( const Sequence< sal_Int8 >& rId ) throw(RuntimeException)
     343                 :            : {
     344                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getSomething" );
     345                 :          0 :     sal_Int64 nRet(0);
     346 [ #  # ][ #  # ]:          0 :     if (rId.getLength() == 16 && 0 == rtl_compareMemory(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     347                 :          0 :         nRet = reinterpret_cast<sal_Int64>(this);
     348                 :            :     else
     349                 :          0 :         nRet = OTable_Base::getSomething(rId);
     350                 :            : 
     351                 :          0 :     return nRet;
     352                 :            : }
     353                 :            : 
     354                 :          0 : Sequence< sal_Int8 > ODBTable::getUnoTunnelImplementationId()
     355                 :            : {
     356                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::getUnoTunnelImplementationId" );
     357                 :            :     static ::cppu::OImplementationId * pId = 0;
     358         [ #  # ]:          0 :     if (! pId)
     359                 :            :     {
     360 [ #  # ][ #  # ]:          0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     361         [ #  # ]:          0 :         if (! pId)
     362                 :            :         {
     363 [ #  # ][ #  # ]:          0 :             static ::cppu::OImplementationId aId;
     364                 :          0 :             pId = &aId;
     365         [ #  # ]:          0 :         }
     366                 :            :     }
     367                 :          0 :     return pId->getImplementationId();
     368                 :            : }
     369                 :            : 
     370                 :          0 : Reference< XPropertySet > ODBTable::createColumnDescriptor()
     371                 :            : {
     372                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumnDescriptor" );
     373 [ #  # ][ #  # ]:          0 :     return new OTableColumnDescriptor( true );
     374                 :            : }
     375                 :            : 
     376                 :          0 : sdbcx::OCollection* ODBTable::createColumns(const TStringVector& _rNames)
     377                 :            : {
     378                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createColumns" );
     379         [ #  # ]:          0 :     Reference<XDatabaseMetaData> xMeta = getMetaData();
     380                 :          0 :     OColumns* pCol = new OColumns(*this, m_aMutex, NULL, isCaseSensitive(), _rNames, this,this,
     381 [ #  # ][ #  # ]:          0 :                                     getAlterService().is() || (xMeta.is() && xMeta->supportsAlterTableWithAddColumn()),
         [ #  # ][ #  # ]
                 [ #  # ]
     382   [ #  #  #  #  :          0 :                                     getAlterService().is() || (xMeta.is() && xMeta->supportsAlterTableWithDropColumn()));
           #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     383                 :          0 :     static_cast<OColumnsHelper*>(pCol)->setParent(this);
     384 [ #  # ][ #  # ]:          0 :     pCol->setParent(*this);
     385 [ #  # ][ #  # ]:          0 :     m_pColumnMediator = new OContainerMediator( pCol, m_xColumnDefinitions, getConnection(), OContainerMediator::eColumns );
         [ #  # ][ #  # ]
                 [ #  # ]
     386                 :          0 :     pCol->setMediator( m_pColumnMediator.get() );
     387                 :          0 :     return pCol;
     388                 :            : }
     389                 :            : 
     390                 :          0 : sdbcx::OCollection* ODBTable::createKeys(const TStringVector& _rNames)
     391                 :            : {
     392                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createKeys" );
     393         [ #  # ]:          0 :     return new connectivity::OKeysHelper(this,m_aMutex,_rNames);
     394                 :            : }
     395                 :            : 
     396                 :          0 : sdbcx::OCollection* ODBTable::createIndexes(const TStringVector& _rNames)
     397                 :            : {
     398                 :            :     RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbaccess", "Ocke.Janssen@sun.com", "ODBTable::createIndexes" );
     399 [ #  # ][ #  # ]:          0 :     return new OIndexes(this,m_aMutex,_rNames,NULL);
     400                 :            : }
     401                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10