1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
3 * This file is part of the LibreOffice project.
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/.
10 #include "Catalog.hxx"
15 #include <com/sun/star/sdbc/XRow.hpp>
17 using namespace ::connectivity::firebird
;
18 using namespace ::com::sun::star
;
19 using namespace ::com::sun::star::sdbc
;
20 using namespace ::com::sun::star::uno
;
22 Catalog::Catalog(const uno::Reference
< XConnection
>& rConnection
):
23 OCatalog(rConnection
),
24 m_xConnection(rConnection
)
28 //----- OCatalog -------------------------------------------------------------
29 void Catalog::refreshTables()
31 Sequence
< OUString
> aTypes
{u
"TABLE"_ustr
, u
"VIEW"_ustr
};
33 uno::Reference
< XResultSet
> xTables
= m_xMetaData
->getTables(Any(),
41 ::std::vector
< OUString
> aTableNames
;
43 fillNames(xTables
, aTableNames
);
46 m_pTables
.reset( new Tables(m_xConnection
->getMetaData(),
51 m_pTables
->reFill(aTableNames
);
55 void Catalog::refreshViews()
57 css::uno::Reference
<css::sdbc::XResultSet
> xViews
58 = m_xMetaData
->getTables(css::uno::Any(), u
"%"_ustr
, u
"%"_ustr
, { u
"VIEW"_ustr
});
63 ::std::vector
<OUString
> aViewNames
;
65 fillNames(xViews
, aViewNames
);
68 m_pViews
.reset(new Views(m_xConnection
, *this, m_aMutex
, aViewNames
));
70 m_pViews
->reFill(aViewNames
);
73 //----- IRefreshableGroups ---------------------------------------------------
74 void Catalog::refreshGroups()
79 //----- IRefreshableUsers ----------------------------------------------------
80 void Catalog::refreshUsers()
82 Reference
<XStatement
> xStmt
= m_xMetaData
->getConnection()->createStatement();
83 uno::Reference
< XResultSet
> xUsers
= xStmt
->executeQuery(u
"SELECT DISTINCT RDB$USER FROM RDB$USER_PRIVILEGES"_ustr
);
88 ::std::vector
< OUString
> aUserNames
;
90 uno::Reference
< XRow
> xRow(xUsers
,UNO_QUERY
);
91 while (xUsers
->next())
93 aUserNames
.push_back(xRow
->getString(1));
97 m_pUsers
.reset( new Users(m_xConnection
->getMetaData(),
102 m_pUsers
->reFill(aUserNames
);
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */