LCOV - code coverage report
Current view: top level - dbaccess/source/core/api - HelperCollections.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 31 0.0 %
Date: 2014-04-14 Functions: 0 5 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             : #include "HelperCollections.hxx"
      21             : 
      22             : #include "dbastrings.hrc"
      23             : 
      24             : namespace dbaccess
      25             : {
      26             :     using namespace dbtools;
      27             :     using namespace comphelper;
      28             :     using namespace connectivity;
      29             :     using namespace ::com::sun::star::uno;
      30             :     using namespace ::com::sun::star::beans;
      31             :     using namespace ::com::sun::star::sdbc;
      32             :     using namespace ::com::sun::star::sdb;
      33             :     using namespace ::com::sun::star::sdbcx;
      34             :     using namespace ::com::sun::star::container;
      35             :     using namespace ::com::sun::star::lang;
      36             :     using namespace ::com::sun::star::script;
      37             :     using namespace ::cppu;
      38             :     using namespace ::osl;
      39             : 
      40           0 :     OPrivateColumns::OPrivateColumns(const ::rtl::Reference< ::connectivity::OSQLColumns>& _rColumns,
      41             :                         sal_Bool _bCase,
      42             :                         ::cppu::OWeakObject& _rParent,
      43             :                         ::osl::Mutex& _rMutex,
      44             :                         const ::std::vector< OUString> &_rVector,
      45             :                         sal_Bool _bUseAsIndex
      46             :                     ) : sdbcx::OCollection(_rParent,_bCase,_rMutex,_rVector,_bUseAsIndex)
      47           0 :                         ,m_aColumns(_rColumns)
      48             :     {
      49           0 :     }
      50             : 
      51           0 :     OPrivateColumns* OPrivateColumns::createWithIntrinsicNames( const ::rtl::Reference< ::connectivity::OSQLColumns >& _rColumns,
      52             :         sal_Bool _bCase, ::cppu::OWeakObject& _rParent, ::osl::Mutex& _rMutex )
      53             :     {
      54           0 :         ::std::vector< OUString > aNames; aNames.reserve( _rColumns->get().size() );
      55             : 
      56           0 :         OUString sColumName;
      57           0 :         for (   ::connectivity::OSQLColumns::Vector::const_iterator column = _rColumns->get().begin();
      58           0 :                 column != _rColumns->get().end();
      59             :                 ++column
      60             :             )
      61             :         {
      62           0 :             Reference< XPropertySet > xColumn( *column, UNO_QUERY_THROW );
      63           0 :             xColumn->getPropertyValue( PROPERTY_NAME ) >>= sColumName;
      64           0 :             aNames.push_back( sColumName );
      65           0 :         }
      66           0 :         return new OPrivateColumns( _rColumns, _bCase, _rParent, _rMutex, aNames, sal_False );
      67             :     }
      68             : 
      69           0 :     void SAL_CALL OPrivateColumns::disposing(void)
      70             :     {
      71           0 :         m_aColumns = NULL;
      72           0 :         clear_NoDispose();
      73             :             // we're not owner of the objects we're holding, instead the object we got in our ctor is
      74             :             // So we're not allowed to dispose our elements.
      75           0 :         OPrivateColumns_Base::disposing();
      76           0 :     }
      77             : 
      78           0 :     connectivity::sdbcx::ObjectType OPrivateColumns::createObject(const OUString& _rName)
      79             :     {
      80           0 :         if ( m_aColumns.is() )
      81             :         {
      82           0 :             ::connectivity::OSQLColumns::Vector::const_iterator aIter = find(m_aColumns->get().begin(),m_aColumns->get().end(),_rName,isCaseSensitive());
      83           0 :             if(aIter == m_aColumns->get().end())
      84           0 :                 aIter = findRealName(m_aColumns->get().begin(),m_aColumns->get().end(),_rName,isCaseSensitive());
      85             : 
      86           0 :             if(aIter != m_aColumns->get().end())
      87           0 :                 return connectivity::sdbcx::ObjectType(*aIter,UNO_QUERY);
      88             : 
      89             :             OSL_FAIL("Column not found in collection!");
      90             :         }
      91           0 :         return NULL;
      92             :     }
      93             : 
      94           0 :     connectivity::sdbcx::ObjectType OPrivateTables::createObject(const OUString& _rName)
      95             :     {
      96           0 :         if ( !m_aTables.empty() )
      97             :         {
      98           0 :             OSQLTables::iterator aIter = m_aTables.find(_rName);
      99             :             OSL_ENSURE(aIter != m_aTables.end(),"Table not found!");
     100             :             OSL_ENSURE(aIter->second.is(),"Table is null!");
     101             :             (void)aIter;
     102           0 :             return connectivity::sdbcx::ObjectType(m_aTables.find(_rName)->second,UNO_QUERY);
     103             :         }
     104           0 :         return NULL;
     105             :     }
     106             : }
     107             : 
     108             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10