LCOV - code coverage report
Current view: top level - connectivity/source/drivers/file - FTable.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 90 0.0 %
Date: 2014-04-14 Functions: 0 21 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             : 
      21             : #include <stdio.h>
      22             : #include "file/FTable.hxx"
      23             : #include "file/FColumns.hxx"
      24             : #include <com/sun/star/sdbc/XRow.hpp>
      25             : #include <com/sun/star/sdbc/XResultSet.hpp>
      26             : #include <cppuhelper/typeprovider.hxx>
      27             : #include <com/sun/star/lang/DisposedException.hpp>
      28             : #include <com/sun/star/sdbc/ColumnValue.hpp>
      29             : #include <unotools/ucbstreamhelper.hxx>
      30             : #include <tools/debug.hxx>
      31             : 
      32             : using namespace connectivity;
      33             : using namespace connectivity::file;
      34             : using namespace ::com::sun::star::uno;
      35             : using namespace ::com::sun::star::beans;
      36             : using namespace ::com::sun::star::sdbcx;
      37             : using namespace ::com::sun::star::sdbc;
      38             : using namespace ::com::sun::star::container;
      39             : 
      40           0 : OFileTable::OFileTable(sdbcx::OCollection* _pTables,OConnection* _pConnection)
      41           0 : : OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers())
      42             :                 ,m_pConnection(_pConnection)
      43             :                 ,m_pFileStream(NULL)
      44             :                 ,m_nFilePos(0)
      45             :                 ,m_pBuffer(NULL)
      46             :                 ,m_nBufferSize(0)
      47           0 :                 ,m_bWriteable(sal_False)
      48             : {
      49             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::OFileTable" );
      50           0 :     construct();
      51           0 :     m_aColumns = new OSQLColumns();
      52           0 : }
      53             : 
      54           0 : OFileTable::OFileTable( sdbcx::OCollection* _pTables,OConnection* _pConnection,
      55             :                         const OUString& _Name,
      56             :                         const OUString& _Type,
      57             :                         const OUString& _Description ,
      58             :                         const OUString& _SchemaName,
      59             :                         const OUString& _CatalogName )
      60           0 :     : OTable_TYPEDEF(_pTables,_pConnection->getMetaData()->supportsMixedCaseQuotedIdentifiers(),
      61             :                      _Name,
      62             :                      _Type,
      63             :                      _Description,
      64             :                      _SchemaName,
      65             :                      _CatalogName)
      66             :     , m_pConnection(_pConnection)
      67             :     , m_pFileStream(NULL)
      68             :     , m_nFilePos(0)
      69             :     , m_pBuffer(NULL)
      70             :     , m_nBufferSize(0)
      71           0 :     , m_bWriteable(sal_False)
      72             : {
      73             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::OFileTable" );
      74           0 :     m_aColumns = new OSQLColumns();
      75           0 :     construct();
      76             :     //  refreshColumns();
      77           0 : }
      78             : 
      79           0 : OFileTable::~OFileTable( )
      80             : {
      81           0 : }
      82             : 
      83           0 : void OFileTable::refreshColumns()
      84             : {
      85             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::refreshColumns" );
      86           0 :     TStringVector aVector;
      87           0 :     Reference< XResultSet > xResult = m_pConnection->getMetaData()->getColumns(Any(),
      88           0 :                                                                                m_SchemaName,m_Name, OUString("%"));
      89             : 
      90           0 :     if(xResult.is())
      91             :     {
      92           0 :         Reference< XRow > xRow(xResult,UNO_QUERY);
      93           0 :         while(xResult->next())
      94           0 :             aVector.push_back(xRow->getString(4));
      95             :     }
      96             : 
      97           0 :     if(m_pColumns)
      98           0 :         m_pColumns->reFill(aVector);
      99             :     else
     100           0 :         m_pColumns  = new OColumns(this,m_aMutex,aVector);
     101           0 : }
     102             : 
     103           0 : void OFileTable::refreshKeys()
     104             : {
     105             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::refreshKeys" );
     106           0 : }
     107             : 
     108           0 : void OFileTable::refreshIndexes()
     109             : {
     110             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::refreshIndexes" );
     111           0 : }
     112             : 
     113           0 : Any SAL_CALL OFileTable::queryInterface( const Type & rType ) throw(RuntimeException, std::exception)
     114             : {
     115             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::queryInterface" );
     116           0 :     if( rType == ::getCppuType((const Reference<XKeysSupplier>*)0) ||
     117           0 :         rType == ::getCppuType((const Reference<XRename>*)0) ||
     118           0 :         rType == ::getCppuType((const Reference<XAlterTable>*)0) ||
     119           0 :         rType == ::getCppuType((const Reference<XIndexesSupplier>*)0) ||
     120           0 :         rType == ::getCppuType((const Reference<XDataDescriptorFactory>*)0))
     121           0 :         return Any();
     122             : 
     123           0 :     return OTable_TYPEDEF::queryInterface(rType);
     124             : }
     125             : 
     126           0 : void SAL_CALL OFileTable::disposing(void)
     127             : {
     128             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::disposing" );
     129           0 :     OTable::disposing();
     130             : 
     131           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     132             : 
     133           0 :     FileClose();
     134           0 : }
     135             : 
     136           0 : Sequence< sal_Int8 > OFileTable::getUnoTunnelImplementationId()
     137             : {
     138             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::getUnoTunnelImplementationId" );
     139             :     static ::cppu::OImplementationId * pId = 0;
     140           0 :     if (! pId)
     141             :     {
     142           0 :         ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
     143           0 :         if (! pId)
     144             :         {
     145           0 :             static ::cppu::OImplementationId aId;
     146           0 :             pId = &aId;
     147           0 :         }
     148             :     }
     149           0 :     return pId->getImplementationId();
     150             : }
     151             : 
     152             : // com::sun::star::lang::XUnoTunnel
     153             : 
     154           0 : sal_Int64 OFileTable::getSomething( const Sequence< sal_Int8 > & rId ) throw (RuntimeException, std::exception)
     155             : {
     156             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::getSomething" );
     157           0 :     return (rId.getLength() == 16 && 0 == memcmp(getUnoTunnelImplementationId().getConstArray(),  rId.getConstArray(), 16 ) )
     158             :                 ? reinterpret_cast< sal_Int64 >( this )
     159           0 :                 : OTable_TYPEDEF::getSomething(rId);
     160             : }
     161             : 
     162           0 : void OFileTable::FileClose()
     163             : {
     164             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::FileClose" );
     165           0 :     ::osl::MutexGuard aGuard(m_aMutex);
     166             : 
     167           0 :     if (m_pFileStream && m_pFileStream->IsWritable())
     168           0 :         m_pFileStream->Flush();
     169             : 
     170           0 :     delete m_pFileStream;
     171           0 :     m_pFileStream = NULL;
     172             : 
     173           0 :     if (m_pBuffer)
     174             :     {
     175           0 :         delete[] m_pBuffer;
     176           0 :         m_pBuffer = NULL;
     177           0 :     }
     178           0 : }
     179             : 
     180           0 : void SAL_CALL OFileTable::acquire() throw()
     181             : {
     182           0 :     OTable_TYPEDEF::acquire();
     183           0 : }
     184             : 
     185           0 : void SAL_CALL OFileTable::release() throw()
     186             : {
     187           0 :     OTable_TYPEDEF::release();
     188           0 : }
     189             : 
     190           0 : sal_Bool OFileTable::InsertRow(OValueRefVector& /*rRow*/, sal_Bool /*bFlush*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/)
     191             : {
     192             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::InsertRow" );
     193           0 :     return sal_False;
     194             : }
     195             : 
     196           0 : sal_Bool OFileTable::DeleteRow(const OSQLColumns& /*_rCols*/)
     197             : {
     198             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::DeleteRow" );
     199           0 :     return sal_False;
     200             : }
     201             : 
     202           0 : sal_Bool OFileTable::UpdateRow(OValueRefVector& /*rRow*/, OValueRefRow& /*pOrgRow*/,const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess>& /*_xCols*/)
     203             : {
     204             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::UpdateRow" );
     205           0 :     return sal_False;
     206             : }
     207             : 
     208           0 : void OFileTable::addColumn(const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& /*descriptor*/)
     209             : {
     210             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::addColumn" );
     211             :     OSL_FAIL( "OFileTable::addColumn: not implemented!" );
     212           0 : }
     213             : 
     214           0 : void OFileTable::dropColumn(sal_Int32 /*_nPos*/)
     215             : {
     216             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::dropColumn" );
     217             :     OSL_FAIL( "OFileTable::addColumn: not implemented!" );
     218           0 : }
     219             : 
     220             : 
     221           0 : SvStream* OFileTable::createStream_simpleError( const OUString& _rFileName, StreamMode _eOpenMode)
     222             : {
     223             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::createStream_simpleError" );
     224           0 :     utl::UcbLockBytesHandler* p_null_dummy = NULL;
     225           0 :     SvStream* pReturn = ::utl::UcbStreamHelper::CreateStream( _rFileName, _eOpenMode, (_eOpenMode & STREAM_NOCREATE) == STREAM_NOCREATE, p_null_dummy);
     226           0 :     if (pReturn && (ERRCODE_NONE != pReturn->GetErrorCode()))
     227             :     {
     228           0 :         delete pReturn;
     229           0 :         pReturn = NULL;
     230             :     }
     231           0 :     return pReturn;
     232             : }
     233             : 
     234             : 
     235           0 : void OFileTable::refreshHeader()
     236             : {
     237             :     SAL_INFO( "connectivity.drivers", "file Ocke.Janssen@sun.com OFileTable::refreshHeader" );
     238           0 : }
     239             : 
     240             : 
     241             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10