From 196ee66d4aab62678a8cfb762379909bdda16051 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Wed, 19 Jul 2017 15:25:04 +0200 Subject: 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 Reviewed-by: Miklos Vajna --- connectivity/Library_calc.mk | 1 - connectivity/Library_file.mk | 1 + connectivity/Library_writer.mk | 1 - connectivity/source/drivers/calc/CConnection.cxx | 4 +- .../source/drivers/calc/CPreparedStatement.cxx | 34 ----------------- .../drivers/component/CPreparedStatement.cxx | 34 +++++++++++++++++ connectivity/source/drivers/writer/WConnection.cxx | 4 +- .../source/drivers/writer/WPreparedStatement.cxx | 41 -------------------- .../source/inc/calc/CPreparedStatement.hxx | 43 --------------------- .../source/inc/component/CPreparedStatement.hxx | 44 ++++++++++++++++++++++ .../source/inc/writer/WPreparedStatement.hxx | 43 --------------------- 11 files changed, 83 insertions(+), 167 deletions(-) delete mode 100644 connectivity/source/drivers/calc/CPreparedStatement.cxx create mode 100644 connectivity/source/drivers/component/CPreparedStatement.cxx delete mode 100644 connectivity/source/drivers/writer/WPreparedStatement.cxx delete mode 100644 connectivity/source/inc/calc/CPreparedStatement.hxx create mode 100644 connectivity/source/inc/component/CPreparedStatement.hxx delete mode 100644 connectivity/source/inc/writer/WPreparedStatement.hxx (limited to 'connectivity') 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 #include #include -#include "calc/CPreparedStatement.hxx" +#include "component/CPreparedStatement.hxx" #include "component/CStatement.hxx" #include #include @@ -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/calc/CPreparedStatement.cxx deleted file mode 100644 index 387366ecdd73..000000000000 --- a/connectivity/source/drivers/calc/CPreparedStatement.cxx +++ /dev/null @@ -1,34 +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 "calc/CPreparedStatement.hxx" -#include "component/CResultSet.hxx" - -using namespace connectivity::calc; -using namespace connectivity::file; -using namespace com::sun::star::uno; - -OResultSet* OCalcPreparedStatement::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"); - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/drivers/component/CPreparedStatement.cxx b/connectivity/source/drivers/component/CPreparedStatement.cxx new file mode 100644 index 000000000000..a2b1161fb7cb --- /dev/null +++ b/connectivity/source/drivers/component/CPreparedStatement.cxx @@ -0,0 +1,34 @@ +/* -*- 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 "component/CPreparedStatement.hxx" +#include "component/CResultSet.hxx" + +using namespace connectivity::component; +using namespace connectivity::file; +using namespace com::sun::star::uno; + +OResultSet* OComponentPreparedStatement::createResultSet() +{ + return new connectivity::component::OComponentResultSet(this,m_aSQLIterator); +} + +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 #include #include -#include "writer/WPreparedStatement.hxx" +#include "component/CPreparedStatement.hxx" #include "component/CStatement.hxx" #include #include @@ -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 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/calc/CPreparedStatement.hxx deleted file mode 100644 index 91507792dc10..000000000000 --- a/connectivity/source/inc/calc/CPreparedStatement.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_CALC_CPREPAREDSTATEMENT_HXX -#define INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CPREPAREDSTATEMENT_HXX - -#include "file/FPreparedStatement.hxx" - -namespace connectivity -{ - namespace calc - { - class OConnection; - class OCalcPreparedStatement : public file::OPreparedStatement - { - protected: - virtual file::OResultSet* createResultSet() override; - public: - OCalcPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} - DECLARE_SERVICE_INFO(); - }; - } -} - -#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CPREPAREDSTATEMENT_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/connectivity/source/inc/component/CPreparedStatement.hxx b/connectivity/source/inc/component/CPreparedStatement.hxx new file mode 100644 index 000000000000..55f8bf9f84c0 --- /dev/null +++ b/connectivity/source/inc/component/CPreparedStatement.hxx @@ -0,0 +1,44 @@ +/* -*- 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_COMPONENT_CPREPAREDSTATEMENT_HXX +#define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CPREPAREDSTATEMENT_HXX + +#include "file/FPreparedStatement.hxx" + +namespace connectivity +{ + namespace component + { + class OConnection; + /// Prepared statement implementation for Writer tables and Calc sheets. + class OOO_DLLPUBLIC_FILE OComponentPreparedStatement : public file::OPreparedStatement + { + protected: + virtual file::OResultSet* createResultSet() override; + public: + OComponentPreparedStatement( file::OConnection* _pConnection) : file::OPreparedStatement( _pConnection){} + DECLARE_SERVICE_INFO(); + }; + } +} + +#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: */ -- cgit