LCOV - code coverage report
Current view: top level - connectivity/source/commontools - TIndex.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-08-25 Functions: 0 3 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 74 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                 :            : #include "connectivity/TIndex.hxx"
      21                 :            : #include "connectivity/TIndexColumns.hxx"
      22                 :            : #include <com/sun/star/sdbc/XRow.hpp>
      23                 :            : #include <com/sun/star/sdbc/XResultSet.hpp>
      24                 :            : #include "connectivity/TTableHelper.hxx"
      25                 :            : #include "TConnection.hxx"
      26                 :            : 
      27                 :            : using namespace connectivity;
      28                 :            : using namespace connectivity::sdbcx;
      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::container;
      33                 :            : using namespace ::com::sun::star::lang;
      34                 :            : // -------------------------------------------------------------------------
      35                 :          0 : OIndexHelper::OIndexHelper( OTableHelper* _pTable) : connectivity::sdbcx::OIndex(sal_True)
      36                 :          0 :                  , m_pTable(_pTable)
      37                 :            : {
      38         [ #  # ]:          0 :     construct();
      39         [ #  # ]:          0 :     ::std::vector< ::rtl::OUString> aVector;
      40 [ #  # ][ #  # ]:          0 :     m_pColumns  = new OIndexColumns(this,m_aMutex,aVector);
      41                 :          0 : }
      42                 :            : // -------------------------------------------------------------------------
      43                 :          0 : OIndexHelper::OIndexHelper( OTableHelper* _pTable,
      44                 :            :                 const ::rtl::OUString& _Name,
      45                 :            :                 const ::rtl::OUString& _Catalog,
      46                 :            :                 sal_Bool _isUnique,
      47                 :            :                 sal_Bool _isPrimaryKeyIndex,
      48                 :            :                 sal_Bool _isClustered
      49                 :            :                 ) : connectivity::sdbcx::OIndex(_Name,
      50                 :            :                                   _Catalog,
      51                 :            :                                   _isUnique,
      52                 :            :                                   _isPrimaryKeyIndex,
      53                 :            :                                   _isClustered,sal_True)
      54                 :          0 :                 ,m_pTable(_pTable)
      55                 :            : {
      56         [ #  # ]:          0 :     construct();
      57         [ #  # ]:          0 :     refreshColumns();
      58                 :          0 : }
      59                 :            : // -------------------------------------------------------------------------
      60                 :            : 
      61                 :          0 : void OIndexHelper::refreshColumns()
      62                 :            : {
      63         [ #  # ]:          0 :     if ( !m_pTable )
      64                 :          0 :         return;
      65                 :            : 
      66         [ #  # ]:          0 :     ::std::vector< ::rtl::OUString> aVector;
      67         [ #  # ]:          0 :     if ( !isNew() )
      68                 :            :     {
      69         [ #  # ]:          0 :         ::dbtools::OPropertyMap& rPropMap = OMetaConnection::getPropMap();
      70                 :          0 :         ::rtl::OUString aSchema,aTable;
      71 [ #  # ][ #  # ]:          0 :         m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_SCHEMANAME)) >>= aSchema;
      72 [ #  # ][ #  # ]:          0 :         m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_NAME))       >>= aTable;
      73                 :            : 
      74 [ #  # ][ #  # ]:          0 :         Reference< XResultSet > xResult = m_pTable->getMetaData()->getIndexInfo(
      75                 :          0 :             m_pTable->getPropertyValue(rPropMap.getNameByIndex(PROPERTY_ID_CATALOGNAME)),
      76 [ #  # ][ #  # ]:          0 :             aSchema,aTable,sal_False,sal_False);
                 [ #  # ]
      77                 :            : 
      78         [ #  # ]:          0 :         if ( xResult.is() )
      79                 :            :         {
      80         [ #  # ]:          0 :             Reference< XRow > xRow(xResult,UNO_QUERY);
      81                 :          0 :             ::rtl::OUString aColName;
      82 [ #  # ][ #  # ]:          0 :             while( xResult->next() )
                 [ #  # ]
      83                 :            :             {
      84 [ #  # ][ #  # ]:          0 :                 if ( xRow->getString(6) == m_Name )
                 [ #  # ]
      85                 :            :                 {
      86 [ #  # ][ #  # ]:          0 :                     aColName = xRow->getString(9);
      87 [ #  # ][ #  # ]:          0 :                     if ( !xRow->wasNull() )
                 [ #  # ]
      88         [ #  # ]:          0 :                         aVector.push_back(aColName);
      89                 :            :                 }
      90                 :          0 :             }
      91                 :          0 :         }
      92                 :            :     }
      93         [ #  # ]:          0 :     if(m_pColumns)
      94         [ #  # ]:          0 :         m_pColumns->reFill(aVector);
      95                 :            :     else
      96 [ #  # ][ #  # ]:          0 :         m_pColumns  = new OIndexColumns(this,m_aMutex,aVector);
      97                 :            : }
      98                 :            : // -----------------------------------------------------------------------------
      99                 :            : 
     100                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10