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

Generated by: LCOV version 1.10