mirror of
https://github.com/LibreOffice/core.git
synced 2025-08-04 07:36:15 +00:00
improve type-safety in dbaccess::OConnection
Change-Id: I39ebd277431407b65c5c4a80698714399d39330f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182531 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
This commit is contained in:
@ -111,7 +111,7 @@ Reference< XStatement > OConnection::createStatement()
|
|||||||
MutexGuard aGuard(m_aMutex);
|
MutexGuard aGuard(m_aMutex);
|
||||||
checkDisposed();
|
checkDisposed();
|
||||||
|
|
||||||
Reference< XStatement > xStatement;
|
rtl::Reference< OStatement > xStatement;
|
||||||
Reference< XStatement > xMasterStatement = m_xMasterConnection->createStatement();
|
Reference< XStatement > xMasterStatement = m_xMasterConnection->createStatement();
|
||||||
if ( xMasterStatement.is() )
|
if ( xMasterStatement.is() )
|
||||||
{
|
{
|
||||||
@ -127,7 +127,7 @@ Reference< XPreparedStatement > OConnection::prepareStatement(const OUString& s
|
|||||||
checkDisposed();
|
checkDisposed();
|
||||||
|
|
||||||
// TODO convert the SQL to SQL the driver understands
|
// TODO convert the SQL to SQL the driver understands
|
||||||
Reference< XPreparedStatement > xStatement;
|
rtl::Reference< OPreparedStatement > xStatement;
|
||||||
Reference< XPreparedStatement > xMasterStatement = m_xMasterConnection->prepareStatement(sql);
|
Reference< XPreparedStatement > xMasterStatement = m_xMasterConnection->prepareStatement(sql);
|
||||||
if ( xMasterStatement.is() )
|
if ( xMasterStatement.is() )
|
||||||
{
|
{
|
||||||
@ -142,7 +142,7 @@ Reference< XPreparedStatement > OConnection::prepareCall(const OUString& sql)
|
|||||||
MutexGuard aGuard(m_aMutex);
|
MutexGuard aGuard(m_aMutex);
|
||||||
checkDisposed();
|
checkDisposed();
|
||||||
|
|
||||||
Reference< XPreparedStatement > xStatement;
|
rtl::Reference< OCallableStatement > xStatement;
|
||||||
Reference< XPreparedStatement > xMasterStatement = m_xMasterConnection->prepareCall(sql);
|
Reference< XPreparedStatement > xMasterStatement = m_xMasterConnection->prepareCall(sql);
|
||||||
if ( xMasterStatement.is() )
|
if ( xMasterStatement.is() )
|
||||||
{
|
{
|
||||||
@ -428,7 +428,7 @@ void OConnection::disposing()
|
|||||||
|
|
||||||
for (auto const& statement : m_aStatements)
|
for (auto const& statement : m_aStatements)
|
||||||
{
|
{
|
||||||
Reference<XComponent> xComp(statement.get(),UNO_QUERY);
|
rtl::Reference<OStatementBase> xComp(statement.get());
|
||||||
::comphelper::disposeComponent(xComp);
|
::comphelper::disposeComponent(xComp);
|
||||||
}
|
}
|
||||||
m_aStatements.clear();
|
m_aStatements.clear();
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
#include <connectivity/warningscontainer.hxx>
|
#include <connectivity/warningscontainer.hxx>
|
||||||
#include <unotools/weakref.hxx>
|
#include <unotools/weakref.hxx>
|
||||||
|
|
||||||
|
class OStatementBase;
|
||||||
|
|
||||||
namespace dbaccess
|
namespace dbaccess
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -76,7 +78,9 @@ class OConnection final :public OConnection_Base
|
|||||||
unotools::WeakReference<ODatabaseSource> m_xParent;
|
unotools::WeakReference<ODatabaseSource> m_xParent;
|
||||||
css::uno::Reference< css::sdbcx::XTablesSupplier >
|
css::uno::Reference< css::sdbcx::XTablesSupplier >
|
||||||
m_xMasterTables; // just to avoid the recreation of the catalog
|
m_xMasterTables; // just to avoid the recreation of the catalog
|
||||||
connectivity::OWeakRefArray m_aStatements;
|
// contains OStatement and OPreparedStatement
|
||||||
|
std::vector<unotools::WeakReference<OStatementBase>>
|
||||||
|
m_aStatements;
|
||||||
rtl::Reference< OQueryContainer > m_xQueries;
|
rtl::Reference< OQueryContainer > m_xQueries;
|
||||||
connectivity::OWeakRefArray m_aComposers;
|
connectivity::OWeakRefArray m_aComposers;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user