Kaydet (Commit) 4073bc15 authored tarafından Miklos Vajna's avatar Miklos Vajna

connectivity: merge OCalcStatement and OWriterStatement

Into a single OComponentStatement, as both of them just provide statement
functionality based on a file loaded into an LO component, so they can share
code.

Change-Id: Iad2852f93783ec3c4a672f4b86424b4aa0ae8eaf
Reviewed-on: https://gerrit.libreoffice.org/40181Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst e473d49a
...@@ -39,7 +39,6 @@ $(eval $(call gb_Library_use_libraries,calc,\ ...@@ -39,7 +39,6 @@ $(eval $(call gb_Library_use_libraries,calc,\
)) ))
$(eval $(call gb_Library_add_exception_objects,calc,\ $(eval $(call gb_Library_add_exception_objects,calc,\
connectivity/source/drivers/calc/CStatement \
connectivity/source/drivers/calc/CPreparedStatement \ connectivity/source/drivers/calc/CPreparedStatement \
connectivity/source/drivers/calc/CDatabaseMetaData \ connectivity/source/drivers/calc/CDatabaseMetaData \
connectivity/source/drivers/calc/CCatalog \ connectivity/source/drivers/calc/CCatalog \
......
...@@ -42,6 +42,7 @@ $(eval $(call gb_Library_use_libraries,file,\ ...@@ -42,6 +42,7 @@ $(eval $(call gb_Library_use_libraries,file,\
$(eval $(call gb_Library_add_exception_objects,file,\ $(eval $(call gb_Library_add_exception_objects,file,\
connectivity/source/drivers/component/CResultSet \ connectivity/source/drivers/component/CResultSet \
connectivity/source/drivers/component/CStatement \
connectivity/source/drivers/file/FCatalog \ connectivity/source/drivers/file/FCatalog \
connectivity/source/drivers/file/FColumns \ connectivity/source/drivers/file/FColumns \
connectivity/source/drivers/file/FConnection \ connectivity/source/drivers/file/FConnection \
......
...@@ -43,7 +43,6 @@ $(eval $(call gb_Library_add_exception_objects,writer,\ ...@@ -43,7 +43,6 @@ $(eval $(call gb_Library_add_exception_objects,writer,\
connectivity/source/drivers/writer/WDatabaseMetaData \ connectivity/source/drivers/writer/WDatabaseMetaData \
connectivity/source/drivers/writer/WDriver \ connectivity/source/drivers/writer/WDriver \
connectivity/source/drivers/writer/WPreparedStatement \ connectivity/source/drivers/writer/WPreparedStatement \
connectivity/source/drivers/writer/WStatement \
connectivity/source/drivers/writer/WTable \ connectivity/source/drivers/writer/WTable \
connectivity/source/drivers/writer/WTables \ connectivity/source/drivers/writer/WTables \
connectivity/source/drivers/writer/Wservices \ connectivity/source/drivers/writer/Wservices \
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
#include "calc/CPreparedStatement.hxx" #include "calc/CPreparedStatement.hxx"
#include "calc/CStatement.hxx" #include "component/CStatement.hxx"
#include <unotools/pathoptions.hxx> #include <unotools/pathoptions.hxx>
#include <connectivity/dbexception.hxx> #include <connectivity/dbexception.hxx>
#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/exc_hlp.hxx>
...@@ -237,7 +237,7 @@ Reference< XStatement > SAL_CALL OCalcConnection::createStatement( ) ...@@ -237,7 +237,7 @@ Reference< XStatement > SAL_CALL OCalcConnection::createStatement( )
checkDisposed(OConnection_BASE::rBHelper.bDisposed); checkDisposed(OConnection_BASE::rBHelper.bDisposed);
Reference< XStatement > xReturn = new OCalcStatement(this); Reference< XStatement > xReturn = new connectivity::component::OComponentStatement(this);
m_aStatements.push_back(WeakReferenceHelper(xReturn)); m_aStatements.push_back(WeakReferenceHelper(xReturn));
return xReturn; return xReturn;
} }
......
...@@ -17,18 +17,18 @@ ...@@ -17,18 +17,18 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include "calc/CStatement.hxx" #include "component/CStatement.hxx"
#include "component/CResultSet.hxx" #include "component/CResultSet.hxx"
using namespace connectivity::calc; using namespace connectivity::component;
using namespace connectivity::file; using namespace connectivity::file;
using namespace com::sun::star::uno; using namespace com::sun::star::uno;
OResultSet* OCalcStatement::createResultSet() OResultSet* OComponentStatement::createResultSet()
{ {
return new connectivity::component::OComponentResultSet(this,m_aSQLIterator); return new connectivity::component::OComponentResultSet(this,m_aSQLIterator);
} }
IMPLEMENT_SERVICE_INFO(OCalcStatement,"com.sun.star.sdbc.driver.calc.Statement","com.sun.star.sdbc.Statement"); IMPLEMENT_SERVICE_INFO(OComponentStatement,"com.sun.star.sdbc.driver.component.Statement","com.sun.star.sdbc.Statement");
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -28,14 +28,12 @@ ...@@ -28,14 +28,12 @@
#include <com/sun/star/text/XTextDocument.hpp> #include <com/sun/star/text/XTextDocument.hpp>
#include <tools/urlobj.hxx> #include <tools/urlobj.hxx>
#include "writer/WPreparedStatement.hxx" #include "writer/WPreparedStatement.hxx"
#include "writer/WStatement.hxx" #include "component/CStatement.hxx"
#include <unotools/pathoptions.hxx> #include <unotools/pathoptions.hxx>
#include <connectivity/dbexception.hxx> #include <connectivity/dbexception.hxx>
#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/exc_hlp.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
using namespace connectivity::file;
typedef connectivity::file::OConnection OConnection_BASE; typedef connectivity::file::OConnection OConnection_BASE;
using namespace ::com::sun::star; using namespace ::com::sun::star;
...@@ -225,7 +223,7 @@ uno::Reference< sdbc::XStatement > SAL_CALL OWriterConnection::createStatement() ...@@ -225,7 +223,7 @@ uno::Reference< sdbc::XStatement > SAL_CALL OWriterConnection::createStatement()
::osl::MutexGuard aGuard(m_aMutex); ::osl::MutexGuard aGuard(m_aMutex);
checkDisposed(OConnection_BASE::rBHelper.bDisposed); checkDisposed(OConnection_BASE::rBHelper.bDisposed);
uno::Reference<sdbc::XStatement> xReturn = new OWriterStatement(this); uno::Reference<sdbc::XStatement> xReturn = new component::OComponentStatement(this);
m_aStatements.push_back(uno::WeakReferenceHelper(xReturn)); m_aStatements.push_back(uno::WeakReferenceHelper(xReturn));
return xReturn; return xReturn;
} }
......
/* -*- 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/WStatement.hxx"
#include "component/CResultSet.hxx"
using namespace com::sun::star;
namespace connectivity
{
namespace writer
{
file::OResultSet* OWriterStatement::createResultSet()
{
return new component::OComponentResultSet(this, m_aSQLIterator);
}
IMPLEMENT_SERVICE_INFO(OWriterStatement, "com.sun.star.sdbc.driver.writer.Statement", "com.sun.star.sdbc.Statement");
} // namespace writer
} // namespace connectivity
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -17,27 +17,28 @@ ...@@ -17,27 +17,28 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CSTATEMENT_HXX #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX
#define INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CSTATEMENT_HXX #define INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX
#include "file/FStatement.hxx" #include "file/FStatement.hxx"
namespace connectivity namespace connectivity
{ {
namespace calc namespace component
{ {
class OConnection; class OConnection;
class OCalcStatement : public file::OStatement /// Statement implementation for Writer tables and Calc sheets.
class OOO_DLLPUBLIC_FILE OComponentStatement : public file::OStatement
{ {
protected: protected:
virtual file::OResultSet* createResultSet() override; virtual file::OResultSet* createResultSet() override;
public: public:
OCalcStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){} OComponentStatement( file::OConnection* _pConnection) : file::OStatement( _pConnection){}
DECLARE_SERVICE_INFO(); DECLARE_SERVICE_INFO();
}; };
} }
} }
#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_CALC_CSTATEMENT_HXX #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_COMPONENT_CSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
/* -*- 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_WSTATEMENT_HXX
#define INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WSTATEMENT_HXX
#include "file/FStatement.hxx"
namespace connectivity
{
namespace writer
{
class OConnection;
class OWriterStatement : public file::OStatement
{
protected:
virtual file::OResultSet* createResultSet() override;
public:
OWriterStatement(file::OConnection* _pConnection) : file::OStatement(_pConnection) {}
DECLARE_SERVICE_INFO();
};
} // namespace writer
} // namespace connectivity
#endif // INCLUDED_CONNECTIVITY_SOURCE_INC_WRITER_WSTATEMENT_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment