summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-07-19 15:25:04 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-07-19 19:51:47 +0200
commit196ee66d4aab62678a8cfb762379909bdda16051 (patch)
treeff603c22fe107c4344eeb7346486a79a6887550d /connectivity
parent4073bc15d1aa1b46b2e0953d6316f2ab6a23dc87 (diff)
connectivity: merge OCalcPreparedStatement and OWriterPreparedStatement
Into a single OComponentPreparedStatement, as both of them just provide prepared statement functionality based on a file loaded into an LO component, so they can share code. Change-Id: Ib1074871d63de83f16861081050e57442ebf0ffa Reviewed-on: https://gerrit.libreoffice.org/40182 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/Library_calc.mk1
-rw-r--r--connectivity/Library_file.mk1
-rw-r--r--connectivity/Library_writer.mk1
-rw-r--r--connectivity/source/drivers/calc/CConnection.cxx4
-rw-r--r--connectivity/source/drivers/component/CPreparedStatement.cxx (renamed from connectivity/source/drivers/calc/CPreparedStatement.cxx)8
-rw-r--r--connectivity/source/drivers/writer/WConnection.cxx4
-rw-r--r--connectivity/source/drivers/writer/WPreparedStatement.cxx41
-rw-r--r--connectivity/source/inc/component/CPreparedStatement.hxx (renamed from connectivity/source/inc/calc/CPreparedStatement.hxx)13
-rw-r--r--connectivity/source/inc/writer/WPreparedStatement.hxx43
9 files changed, 16 insertions, 100 deletions
diff --git a/connectivity/Library_calc.mk b/connectivity/Library_calc.mk
index 5a3a206b12b7..30e16d29a3d2 100644
--- a/connectivity/Library_calc.mk
+++ b/connectivity/Library_calc.mk
@@ -39,7 +39,6 @@ $(eval $(call gb_Library_use_libraries,calc,\
))
$(eval $(call gb_Library_add_exception_objects,calc,\
- connectivity/source/drivers/calc/CPreparedStatement \
connectivity/source/drivers/calc/CDatabaseMetaData \
connectivity/source/drivers/calc/CCatalog \
connectivity/source/drivers/calc/CColumns \
diff --git a/connectivity/Library_file.mk b/connectivity/Library_file.mk
index fec48e2e966c..30cd6ae6a97a 100644
--- a/connectivity/Library_file.mk
+++ b/connectivity/Library_file.mk
@@ -41,6 +41,7 @@ $(eval $(call gb_Library_use_libraries,file,\
))
$(eval $(call gb_Library_add_exception_objects,file,\
+ connectivity/source/drivers/component/CPreparedStatement \
connectivity/source/drivers/component/CResultSet \
connectivity/source/drivers/component/CStatement \
connectivity/source/drivers/file/FCatalog \
diff --git a/connectivity/Library_writer.mk b/connectivity/Library_writer.mk
index c5cd2ddf3979..4fab8bf043d9 100644
--- a/connectivity/Library_writer.mk
+++ b/connectivity/Library_writer.mk
@@ -42,7 +42,6 @@ $(eval $(call gb_Library_add_exception_objects,writer,\
connectivity/source/drivers/writer/WConnection \
connectivity/source/drivers/writer/WDatabaseMetaData \
connectivity/source/drivers/writer/WDriver \
- connectivity/source/drivers/writer/WPreparedStatement \
connectivity/source/drivers/writer/WTable \
connectivity/source/drivers/writer/WTables \
connectivity/source/drivers/writer/Wservices \
diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx
index 8ae8ca2be690..52177bff82ac 100644
--- a/connectivity/source/drivers/calc/CConnection.cxx
+++ b/connectivity/source/drivers/calc/CConnection.cxx
@@ -27,7 +27,7 @@
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <tools/urlobj.hxx>
-#include "calc/CPreparedStatement.hxx"
+#include "component/CPreparedStatement.hxx"
#include "component/CStatement.hxx"
#include <unotools/pathoptions.hxx>
#include <connectivity/dbexception.hxx>
@@ -249,7 +249,7 @@ Reference< XPreparedStatement > SAL_CALL OCalcConnection::prepareStatement( cons
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OCalcPreparedStatement* pStmt = new OCalcPreparedStatement(this);
+ auto pStmt = new connectivity::component::OComponentPreparedStatement(this);
Reference< XPreparedStatement > xHoldAlive = pStmt;
pStmt->construct(sql);
m_aStatements.push_back(WeakReferenceHelper(*pStmt));
diff --git a/connectivity/source/drivers/calc/CPreparedStatement.cxx b/connectivity/source/drivers/component/CPreparedStatement.cxx
index 387366ecdd73..a2b1161fb7cb 100644
--- a/connectivity/source/drivers/calc/CPreparedStatement.cxx
+++ b/connectivity/source/drivers/component/CPreparedStatement.cxx
@@ -17,18 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#include "calc/CPreparedStatement.hxx"
+#include "component/CPreparedStatement.hxx"
#include "component/CResultSet.hxx"
-using namespace connectivity::calc;
+using namespace connectivity::component;
using namespace connectivity::file;
using namespace com::sun::star::uno;
-OResultSet* OCalcPreparedStatement::createResultSet()
+OResultSet* OComponentPreparedStatement::createResultSet()
{
return new connectivity::component::OComponentResultSet(this,m_aSQLIterator);
}
-IMPLEMENT_SERVICE_INFO(OCalcPreparedStatement,"com.sun.star.sdbc.driver.calc.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
+IMPLEMENT_SERVICE_INFO(OComponentPreparedStatement,"com.sun.star.sdbc.driver.component.PreparedStatement","com.sun.star.sdbc.PreparedStatement");
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/drivers/writer/WConnection.cxx b/connectivity/source/drivers/writer/WConnection.cxx
index cede5fe96b93..24963cce7f32 100644
--- a/connectivity/source/drivers/writer/WConnection.cxx
+++ b/connectivity/source/drivers/writer/WConnection.cxx
@@ -27,7 +27,7 @@
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/text/XTextDocument.hpp>
#include <tools/urlobj.hxx>
-#include "writer/WPreparedStatement.hxx"
+#include "component/CPreparedStatement.hxx"
#include "component/CStatement.hxx"
#include <unotools/pathoptions.hxx>
#include <connectivity/dbexception.hxx>
@@ -234,7 +234,7 @@ uno::Reference< sdbc::XPreparedStatement > SAL_CALL OWriterConnection::prepareSt
::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OConnection_BASE::rBHelper.bDisposed);
- OWriterPreparedStatement* pStmt = new OWriterPreparedStatement(this);
+ auto pStmt = new component::OComponentPreparedStatement(this);
uno::Reference<sdbc::XPreparedStatement> xHoldAlive = pStmt;
pStmt->construct(sql);
m_aStatements.push_back(uno::WeakReferenceHelper(*pStmt));
diff --git a/connectivity/source/drivers/writer/WPreparedStatement.cxx b/connectivity/source/drivers/writer/WPreparedStatement.cxx
deleted file mode 100644
index c23a272d8241..000000000000
--- a/connectivity/source/drivers/writer/WPreparedStatement.cxx
+++ /dev/null
@@ -1,41 +0,0 @@
-/* -*- 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/WPreparedStatement.hxx"
-
-#include "component/CResultSet.hxx"
-
-using namespace com::sun::star;
-
-namespace connectivity
-{
-namespace writer
-{
-
-file::OResultSet* OWriterPreparedStatement::createResultSet()
-{
- return new component::OComponentResultSet(this, m_aSQLIterator);
-}
-
-IMPLEMENT_SERVICE_INFO(OWriterPreparedStatement,"com.sun.star.sdbc.driver.writer.PreparedStatement", "com.sun.star.sdbc.PreparedStatement");
-
-} // namespace writer
-} // namespace connectivity
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/calc/CPreparedStatement.hxx b/connectivity/source/inc/component/CPreparedStatement.hxx
index 91507792dc10..55f8bf9f84c0 100644
--- a/connectivity/source/inc/calc/CPreparedStatement.hxx
+++ b/connectivity/source/inc/component/CPreparedStatement.hxx
@@ -17,27 +17,28 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CPREPAREDSTATEMENT_HXX
+#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX
+#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX
#include "file/FPreparedStatement.hxx"
namespace connectivity
{
- namespace calc
+ namespace component
{
class OConnection;
- class OCalcPreparedStatement : public file::OPreparedStatement
+ /// Prepared statement implementation for Writer tables and Calc sheets.
+ class OOO_DLLPUBLIC_FILE OComponentPreparedStatement : public file::OPreparedStatement
{
protected:
virtual file::OResultSet* createResultSet() override;
public:
- OCalcPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){}
+ OComponentPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){}
DECLARE_SERVICE_INFO();
};
}
}
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CPREPAREDSTATEMENT_HXX
+#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/connectivity/source/inc/writer/WPreparedStatement.hxx b/connectivity/source/inc/writer/WPreparedStatement.hxx
deleted file mode 100644
index 00998cab04bb..000000000000
--- a/connectivity/source/inc/writer/WPreparedStatement.hxx
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- 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_WPREPAREDSTATEMENT_HXX
-#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WPREPAREDSTATEMENT_HXX
-
-#include "file/FPreparedStatement.hxx"
-
-namespace connectivity
-{
-namespace writer
-{
-class OConnection;
-class OWriterPreparedStatement : public file::OPreparedStatement
-{
-protected:
- virtual file::OResultSet* createResultSet() override;
-public:
- OWriterPreparedStatement(file::OConnection* _pConnection) : file::OPreparedStatement(_pConnection) {}
- DECLARE_SERVICE_INFO();
-};
-} // namespace writer
-} // namespace connectivity
-
-#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WPREPAREDSTATEMENT_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */