summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-07-17 13:56:16 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-07-18 09:01:40 +0200
commit6fb3e3a9c1dd1aec8a1ba90fea51e32048e609bf (patch)
tree931c2786fc43224baaf03c6e916064baf3828317 /connectivity
parent138269391a9ac8cdc0c00b55e1fbc84a94c84a77 (diff)
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>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/Library_writer.mk1
-rw-r--r--connectivity/source/drivers/writer/WCatalog.cxx62
-rw-r--r--connectivity/source/drivers/writer/WConnection.cxx9
-rw-r--r--connectivity/source/inc/writer/WCatalog.hxx45
4 files changed, 114 insertions, 3 deletions
diff --git a/connectivity/Library_writer.mk b/connectivity/Library_writer.mk
index 07304afebc3e..06f505a66cb9 100644
--- a/connectivity/Library_writer.mk
+++ b/connectivity/Library_writer.mk
@@ -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 \
diff --git a/connectivity/source/drivers/writer/WCatalog.cxx b/connectivity/source/drivers/writer/WCatalog.cxx
new file mode 100644
index 000000000000..c038d3d3ed77
--- /dev/null
+++ b/connectivity/source/drivers/writer/WCatalog.cxx
@@ -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: */
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx
index 836f664e5346..bec672575682 100644
--- a/connectivity/source/drivers/writer/WConnection.cxx
+++ b/connectivity/source/drivers/writer/WConnection.cxx
@@ -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;
}
diff --git a/connectivity/source/inc/writer/WCatalog.hxx b/connectivity/source/inc/writer/WCatalog.hxx
new file mode 100644
index 000000000000..b1ba9a582714
--- /dev/null
+++ b/connectivity/source/inc/writer/WCatalog.hxx
@@ -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: */