connectivity writer driver: add Catalog implementation

But leave OWriterCatalog::refreshTables() as a stub for now.

Change-Id: Ica5eb9d45937c826501b666d565019e2e04df6bf
Reviewed-on: https://gerrit.libreoffice.org/40071
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Miklos Vajna
2017-07-17 13:56:16 +02:00
parent 138269391a
commit 6fb3e3a9c1
4 changed files with 114 additions and 3 deletions

View File

@@ -37,6 +37,7 @@ $(eval $(call gb_Library_use_libraries,writer,\
))
$(eval $(call gb_Library_add_exception_objects,writer,\
connectivity/source/drivers/writer/WCatalog \
connectivity/source/drivers/writer/WConnection \
connectivity/source/drivers/writer/WDatabaseMetaData \
connectivity/source/drivers/writer/WDriver \

View File

@@ -0,0 +1,62 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include "writer/WCatalog.hxx"
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <connectivity/sdbcx/VCollection.hxx>
#include "writer/WConnection.hxx"
using namespace ::com::sun::star;
namespace connectivity
{
namespace writer
{
OWriterCatalog::OWriterCatalog(OWriterConnection* pConnection) : file::OFileCatalog(pConnection)
{
}
void OWriterCatalog::refreshTables()
{
TStringVector aVector;
uno::Sequence<OUString> aTypes;
OWriterConnection::ODocHolder aDocHolder(static_cast<OWriterConnection*>(m_pConnection));
uno::Reference< sdbc::XResultSet > xResult = m_xMetaData->getTables(uno::Any(), "%", "%", aTypes);
if (xResult.is())
{
uno::Reference< sdbc::XRow > xRow(xResult, uno::UNO_QUERY);
while (xResult->next())
aVector.push_back(xRow->getString(3));
}
if (m_pTables)
m_pTables->reFill(aVector);
else
SAL_WARN("connectivity.writer", "TODO implement OWriterCatalog::refreshTables()");
}
} // namespace writer
} // namespace connectivity
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@@ -19,6 +19,7 @@
#include "writer/WConnection.hxx"
#include "writer/WDatabaseMetaData.hxx"
#include "writer/WCatalog.hxx"
#include "writer/WDriver.hxx"
#include "resource/sharedresources.hxx"
#include "resource/common_res.hrc"
@@ -203,13 +204,15 @@ uno::Reference< sdbc::XDatabaseMetaData > SAL_CALL OWriterConnection::getMetaDat
}
css::uno::Reference< sdbcx::XTablesSupplier > OWriterConnection::createCatalog()
css::uno::Reference< css::sdbcx::XTablesSupplier > OWriterConnection::createCatalog()
{
::osl::MutexGuard aGuard(m_aMutex);
uno::Reference< sdbcx::XTablesSupplier > xTab = m_xCatalog;
uno::Reference< css::sdbcx::XTablesSupplier > xTab = m_xCatalog;
if (!xTab.is())
{
SAL_WARN("connectivity.writer", "TODO implement OWriterConnection::createCatalog()");
OWriterCatalog* pCat = new OWriterCatalog(this);
xTab = pCat;
m_xCatalog = xTab;
}
return xTab;
}

View File

@@ -0,0 +1,45 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCATALOG_HXX
#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCATALOG_HXX
#include "file/FCatalog.hxx"
namespace connectivity
{
namespace writer
{
class OWriterConnection;
class OWriterCatalog : public file::OFileCatalog
{
public:
void refreshTables() override;
public:
OWriterCatalog(OWriterConnection* _pCon);
};
} // namespace writer
} // namespace connectivity
#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WCATALOG_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */