LCOV - code coverage report
Current view: top level - connectivity/source/drivers/firebird - Catalog.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 35 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             : 
      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           0 : Catalog::Catalog(const uno::Reference< XConnection >& rConnection):
      23             :     OCatalog(rConnection),
      24           0 :     m_xConnection(rConnection)
      25             : {
      26           0 : }
      27             : 
      28             : //----- OCatalog -------------------------------------------------------------
      29           0 : void Catalog::refreshTables()
      30             : {
      31             :     // TODO: set type -- currenty we also get system tables...
      32           0 :     Sequence< OUString > aTypes(2);
      33           0 :     aTypes[0] = "TABLE";
      34           0 :     aTypes[1] = "VIEW";
      35             : 
      36           0 :     uno::Reference< XResultSet > xTables = m_xMetaData->getTables(Any(),
      37             :                                                             "%",
      38             :                                                             "%",
      39           0 :                                                             aTypes);
      40             : 
      41           0 :     if (!xTables.is())
      42           0 :         return;
      43             : 
      44           0 :     TStringVector aTableNames;
      45             : 
      46           0 :     fillNames(xTables, aTableNames);
      47             : 
      48           0 :     if (!m_pTables)
      49           0 :         m_pTables = new Tables(m_xConnection->getMetaData(),
      50             :                                *this,
      51             :                                m_aMutex,
      52           0 :                                aTableNames);
      53             :     else
      54           0 :         m_pTables->reFill(aTableNames);
      55             : 
      56             : }
      57             : 
      58           0 : void Catalog::refreshViews()
      59             : {
      60             :     // TODO: implement me.
      61             :     // Sets m_pViews (OCatalog)
      62           0 : }
      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