LCOV - code coverage report
Current view: top level - connectivity/source/drivers/firebird - Catalog.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 19 35 54.3 %
Date: 2014-04-11 Functions: 3 5 60.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             : 
      10             : #include "Catalog.hxx"
      11             : #include "Tables.hxx"
      12             : #include "Users.hxx"
      13             : 
      14             : using namespace ::connectivity::firebird;
      15             : 
      16             : using namespace ::rtl;
      17             : 
      18             : using namespace ::com::sun::star;
      19             : using namespace ::com::sun::star::sdbc;
      20             : using namespace ::com::sun::star::uno;
      21             : 
      22           2 : Catalog::Catalog(const uno::Reference< XConnection >& rConnection):
      23             :     OCatalog(rConnection),
      24           2 :     m_xConnection(rConnection)
      25             : {
      26           2 : }
      27             : 
      28             : //----- OCatalog -------------------------------------------------------------
      29           2 : void Catalog::refreshTables()
      30             : {
      31             :     // TODO: set type -- currenty we also get system tables...
      32           2 :     Sequence< OUString > aTypes(2);
      33           2 :     aTypes[0] = "TABLE";
      34           2 :     aTypes[1] = "VIEW";
      35             : 
      36           2 :     uno::Reference< XResultSet > xTables = m_xMetaData->getTables(Any(),
      37             :                                                             "%",
      38             :                                                             "%",
      39           4 :                                                             aTypes);
      40             : 
      41           2 :     if (!xTables.is())
      42           2 :         return;
      43             : 
      44           4 :     TStringVector aTableNames;
      45             : 
      46           2 :     fillNames(xTables, aTableNames);
      47             : 
      48           2 :     if (!m_pTables)
      49           2 :         m_pTables = new Tables(m_xConnection->getMetaData(),
      50             :                                *this,
      51             :                                m_aMutex,
      52           2 :                                aTableNames);
      53             :     else
      54           2 :         m_pTables->reFill(aTableNames);
      55             : 
      56             : }
      57             : 
      58           2 : void Catalog::refreshViews()
      59             : {
      60             :     // TODO: implement me.
      61             :     // Sets m_pViews (OCatalog)
      62           2 : }
      63             : 
      64             : //----- IRefreshableGroups ---------------------------------------------------
      65           0 : void Catalog::refreshGroups()
      66             : {
      67             :     // TODO: implement me
      68           0 : }
      69             : 
      70             : //----- IRefreshableUsers ----------------------------------------------------
      71           0 : void Catalog::refreshUsers()
      72             : {
      73           0 :     OUString sSql("SELECT DISTINCT RDB$USER FROM RDB$USER_PRIVILEGES");
      74             : 
      75           0 :     uno::Reference< XResultSet > xUsers = m_xMetaData->getConnection()
      76           0 :                                             ->createStatement()->executeQuery(sSql);
      77             : 
      78           0 :     if (!xUsers.is())
      79           0 :         return;
      80             : 
      81           0 :     TStringVector aUserNames;
      82             : 
      83           0 :     uno::Reference< XRow > xRow(xUsers,UNO_QUERY);
      84           0 :     while (xUsers->next())
      85             :     {
      86           0 :         aUserNames.push_back(xRow->getString(1));
      87             :     }
      88             : 
      89           0 :     if (!m_pUsers)
      90           0 :         m_pUsers = new Users(m_xConnection->getMetaData(),
      91             :                              *this,
      92             :                              m_aMutex,
      93           0 :                              aUserNames);
      94             :     else
      95           0 :         m_pUsers->reFill(aUserNames);
      96             : }
      97             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10