LCOV - code coverage report
Current view: top level - connectivity/source/drivers/dbase - DCode.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 48 0.0 %
Date: 2014-11-03 Functions: 0 9 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 "dbase/DCode.hxx"
      21             : #include <com/sun/star/sdbcx/XColumnsSupplier.hpp>
      22             : #include "dbase/DIndex.hxx"
      23             : #include "dbase/DIndexIter.hxx"
      24             : 
      25             : 
      26             : using namespace connectivity::dbase;
      27             : using namespace connectivity::file;
      28             : using namespace ::com::sun::star::uno;
      29             : using namespace ::com::sun::star::beans;
      30             : using namespace ::com::sun::star::sdbcx;
      31             : using namespace ::com::sun::star::lang;
      32             : using namespace ::com::sun::star::container;
      33             : 
      34           0 : TYPEINIT1(OFILEOperandAttr, OOperandAttr);
      35             : 
      36           0 : OOperandAttr* OFILEAnalyzer::createOperandAttr(sal_Int32 _nPos,
      37             :                                                const Reference< XPropertySet>& _xCol,
      38             :                                                const Reference< XNameAccess>& _xIndexes)
      39             : {
      40           0 :     return new OFILEOperandAttr((sal_uInt16)_nPos,_xCol,_xIndexes);
      41             : }
      42             : 
      43             : 
      44           0 : OFILEOperandAttr::OFILEOperandAttr(sal_uInt16 _nPos,
      45             :                                    const Reference< XPropertySet>& _xColumn,
      46             :                                    const Reference< XNameAccess>& _xIndexes)
      47           0 :     : OOperandAttr(_nPos,_xColumn)
      48             : {
      49           0 :     if(_xIndexes.is())
      50             :     {
      51           0 :         OUString sName;
      52           0 :         Reference<XPropertySetInfo> xColInfo = _xColumn->getPropertySetInfo();
      53           0 :         Reference<XPropertySet> xIndex;
      54             : 
      55           0 :         Sequence< OUString> aSeq = _xIndexes->getElementNames();
      56           0 :         const OUString* pBegin = aSeq.getConstArray();
      57           0 :         const OUString* pEnd   = pBegin + aSeq.getLength();
      58           0 :         for(;pBegin != pEnd;++pBegin)
      59             :         {
      60           0 :             _xIndexes->getByName(*pBegin) >>= xIndex;
      61           0 :             if(xIndex.is())
      62             :             {
      63           0 :                 Reference<XColumnsSupplier> xColsSup(xIndex,UNO_QUERY);
      64           0 :                 Reference<XNameAccess> xNameAccess = xColsSup->getColumns();
      65           0 :                 _xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_NAME)) >>= sName;
      66           0 :                 if(xNameAccess->hasByName(sName))
      67             :                 {
      68           0 :                     m_xIndex = xIndex;
      69           0 :                     break;
      70             :                 }
      71           0 :                 else if(xColInfo->hasPropertyByName(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME)))
      72             :                 {
      73           0 :                     _xColumn->getPropertyValue(OMetaConnection::getPropMap().getNameByIndex(PROPERTY_ID_REALNAME)) >>= sName;
      74           0 :                     if(xNameAccess->hasByName(sName))
      75             :                     {
      76           0 :                         m_xIndex = xIndex;
      77           0 :                         break;
      78             :                     }
      79           0 :                 }
      80             :             }
      81           0 :         }
      82             :     }
      83             : 
      84           0 : }
      85             : 
      86           0 : bool OFILEOperandAttr::isIndexed() const
      87             : {
      88           0 :     return m_xIndex.is();
      89             : }
      90             : 
      91           0 : OEvaluateSet* OFILEOperandAttr::preProcess(OBoolOperator* pOp, OOperand* pRight)
      92             : {
      93           0 :     OEvaluateSet* pEvaluateSet = NULL;
      94           0 :     if (isIndexed())
      95             :     {
      96           0 :         Reference<XUnoTunnel> xTunnel(m_xIndex,UNO_QUERY);
      97           0 :         if(xTunnel.is())
      98             :         {
      99           0 :             ODbaseIndex* pIndex = reinterpret_cast< ODbaseIndex* >( xTunnel->getSomething(ODbaseIndex::getUnoTunnelImplementationId()) );
     100           0 :             if(pIndex)
     101             :             {
     102           0 :                 OIndexIterator* pIter = pIndex->createIterator(pOp,pRight);
     103             : 
     104           0 :                 if (pIter)
     105             :                 {
     106           0 :                     pEvaluateSet = new OEvaluateSet();
     107           0 :                     sal_uIntPtr nRec = pIter->First();
     108           0 :                     while (nRec != NODE_NOTFOUND)
     109             :                     {
     110           0 :                         (*pEvaluateSet)[nRec] = nRec;
     111           0 :                         nRec = pIter->Next();
     112             :                     }
     113             :                 }
     114           0 :                 delete pIter;
     115             :             }
     116           0 :         }
     117             :     }
     118           0 :     return pEvaluateSet;
     119             : }
     120             : 
     121             : 
     122             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10