24#include <com/sun/star/sdbc/SQLException.hpp>
25#include <com/sun/star/sdbc/XRow.hpp>
26#include <com/sun/star/sdbc/XResultSet.hpp>
39OHCatalog::OHCatalog(
const Reference< XConnection >& _xConnection) : sdbcx::
OCatalog(_xConnection)
55 ::std::vector< OUString> aVector;
57 Sequence< OUString > sTableTypes {
"VIEW",
"TABLE"};
69 Sequence< OUString >
aTypes {
"VIEW" };
71 bool bSupportsViews =
false;
74 Reference<XResultSet> xRes =
m_xMetaData->getTableTypes();
75 Reference<XRow> xRow(xRes,UNO_QUERY);
76 while ( xRow.is() && xRes->next() )
78 if ( (bSupportsViews = xRow->getString(1).equalsIgnoreAsciiCase(
aTypes[0])) )
84 catch(
const SQLException&)
88 ::std::vector< OUString> aVector;
104 ::std::vector< OUString> aVector;
105 Reference< XStatement > xStmt =
m_xConnection->createStatement( );
106 Reference< XResultSet > xResult = xStmt->executeQuery(
"select User from hsqldb.user group by User");
109 Reference< XRow > xRow(xResult,UNO_QUERY);
110 while( xResult->next() )
111 aVector.push_back(xRow->getString(1));
112 ::comphelper::disposeComponent(xResult);
114 ::comphelper::disposeComponent(xStmt);
127 return OCatalog::queryInterface(rType);
132 Sequence< Type >
aTypes = OCatalog::getTypes();
133 std::vector<Type> aOwnTypes;
134 aOwnTypes.reserve(
aTypes.getLength());
136 const Type* pEnd = pBegin +
aTypes.getLength();
137 for(;pBegin != pEnd;++pBegin)
141 aOwnTypes.push_back(*pBegin);
144 return Sequence< Type >(aOwnTypes.data(), aOwnTypes.size());
virtual void refreshUsers() override
virtual void refreshTables() override
void refreshObjects(const css::uno::Sequence< OUString > &_sKindOfObject,::std::vector< OUString > &_rNames)
calls XDatabaseMetaData::getTables.
virtual void refreshGroups() override
virtual css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
virtual void refreshViews() override
virtual css::uno::Sequence< css::uno::Type > SAL_CALL getTypes() override
css::uno::Reference< css::sdbc::XConnection > m_xConnection
void fillNames(css::uno::Reference< css::sdbc::XResultSet > &_xResult,::std::vector< OUString > &_rNames)
fills a vector with the necessary names which can be used in combination with the collections.
css::uno::Reference< css::sdbc::XDatabaseMetaData > m_xMetaData
std::unique_ptr< OCollection > m_pTables
std::unique_ptr< OCollection > m_pViews
std::unique_ptr< OCollection > m_pUsers
Reference< XConnection > m_xConnection