Kaydet (Commit) 196ee66d authored tarafından Miklos Vajna's avatar Miklos Vajna

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/40182Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 4073bc15
......@@ -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 \
......
......@@ -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 \
......
......@@ -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 \
......
......@@ -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));
......
......@@ -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: */
......@@ -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));
......
/* -*- 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: */
......@@ -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: */
/* -*- 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: */
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