summaryrefslogtreecommitdiff
path: root/dbaccess
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-12-03 13:16:26 +0200
committerNoel Grandin <noel@peralex.com>2012-12-10 08:05:31 +0200
commitd01fba6afc39092ae3ae85c38ac21bb7d26d63e2 (patch)
tree7f33e692f5adbe75a2192bf2f573be5be124d604 /dbaccess
parentb8a403467e6209437c3c113ff2df95df6ffec61a (diff)
fdo#46808, Adapt sdbc::ConnectionPool UNO service to new style
ConnectionPool was already a new-style service, but since it was not exposing all of it's interfaces properly I had to create a unified interface XConnectionPool. Change-Id: Idfa3fa3335173ceeab1785b4049422874b6c9d5a
Diffstat (limited to 'dbaccess')
-rw-r--r--dbaccess/source/core/dataaccess/datasource.cxx2
-rw-r--r--dbaccess/source/inc/stringconstants.hrc1
-rw-r--r--dbaccess/source/inc/stringconstants.inc1
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx13
-rw-r--r--dbaccess/source/ui/uno/copytablewizard.cxx3
5 files changed, 9 insertions, 11 deletions
diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx
index 7d7bc995cf16..926c118482a3 100644
--- a/dbaccess/source/core/dataaccess/datasource.cxx
+++ b/dbaccess/source/core/dataaccess/datasource.cxx
@@ -641,7 +641,7 @@ Reference< XConnection > ODatabaseSource::buildLowLevelConnection(const ::rtl::O
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dataaccess", "Ocke.Janssen@sun.com", "ODatabaseSource::buildLowLevelConnection" );
Reference< XConnection > xReturn;
- Reference< XDriverManager > xManager;
+ Reference< XConnectionPool > xManager;
try {
xManager.set( ConnectionPool::create( m_pImpl->m_aContext.getUNOContext() ) );
} catch( const Exception& ) { }
diff --git a/dbaccess/source/inc/stringconstants.hrc b/dbaccess/source/inc/stringconstants.hrc
index 6926f607788e..902eba94abc4 100644
--- a/dbaccess/source/inc/stringconstants.hrc
+++ b/dbaccess/source/inc/stringconstants.hrc
@@ -370,7 +370,6 @@ DECLARE_CONSTASCII_USTRING(SERVICE_SDBCX_COLUMNS);
DECLARE_CONSTASCII_USTRING(SERVICE_SDBCX_TABLES);
DECLARE_CONSTASCII_USTRING(SERVICE_SDB_QUERIES);
DECLARE_CONSTASCII_USTRING(SERVICE_SDBC_DRIVERMANAGER);
-DECLARE_CONSTASCII_USTRING(SERVICE_SDBC_CONNECTIONPOOL);
DECLARE_CONSTASCII_USTRING(SERVICE_FRAME_DESKTOP);
DECLARE_CONSTASCII_USTRING(SERVICE_UI_FOLDERPICKER);
DECLARE_CONSTASCII_USTRING(SERVICE_I18N_COLLATOR);
diff --git a/dbaccess/source/inc/stringconstants.inc b/dbaccess/source/inc/stringconstants.inc
index 010fd637e952..4b1434de4309 100644
--- a/dbaccess/source/inc/stringconstants.inc
+++ b/dbaccess/source/inc/stringconstants.inc
@@ -207,7 +207,6 @@ IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_COLUMNS, "com.sun.star.sdbcx.Columns"
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_TABLES, "com.sun.star.sdbcx.Tables");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDB_QUERIES, "com.sun.star.sdb.Queries");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBC_DRIVERMANAGER, "com.sun.star.sdbc.DriverManager");
-IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBC_CONNECTIONPOOL, "com.sun.star.sdbc.ConnectionPool");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_INDEXCOLUMN, "com.sun.star.sdbcx.IndexColumn");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_SDBCX_KEYCOLUMN, "com.sun.star.sdbcx.KeyColumn");
IMPLEMENT_CONSTASCII_USTRING(SERVICE_FRAME_DESKTOP, "com.sun.star.frame.Desktop");
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 80f6051b010e..a548f2f4dec6 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/sdb/DatabaseContext.hpp>
#include <com/sun/star/sdb/SQLContext.hpp>
+#include <com/sun/star/sdbc/ConnectionPool.hpp>
#include <com/sun/star/sdbc/XDriver.hpp>
#include <com/sun/star/sdbc/XDriverAccess.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
@@ -388,14 +389,14 @@ Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver()
Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver(const ::rtl::OUString& _sURL)
{
// get the global DriverManager
- Reference< XDriverAccess > xDriverManager;
+ Reference< XConnectionPool > xDriverManager;
+
String sCurrentActionError = String(ModuleRes(STR_COULDNOTCREATE_DRIVERMANAGER));
- // in case an error occures
- sCurrentActionError.SearchAndReplaceAscii("#servicename#", (::rtl::OUString)SERVICE_SDBC_CONNECTIONPOOL);
+ sCurrentActionError.SearchAndReplaceAscii("#servicename#", OUString("com.sun.star.sdbc.ConnectionPool"));
+
try
{
- xDriverManager = Reference< XDriverAccess >(getORB()->createInstance(SERVICE_SDBC_CONNECTIONPOOL), UNO_QUERY);
- OSL_ENSURE(xDriverManager.is(), "ODbDataSourceAdministrationHelper::getDriver: could not instantiate the driver manager, or it does not provide the necessary interface!");
+ xDriverManager.set( ConnectionPool::create( comphelper::getComponentContext(getORB()) ) );
}
catch (const Exception& e)
{
@@ -403,8 +404,6 @@ Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver(const ::rtl::O
SQLException aSQLWrapper(e.Message, getORB(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")), 0, Any());
throw SQLException(sCurrentActionError, getORB(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")), 0, makeAny(aSQLWrapper));
}
- if (!xDriverManager.is())
- throw SQLException(sCurrentActionError, getORB(), ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("S1000")), 0, Any());
Reference< XDriver > xDriver = xDriverManager->getDriverByURL(_sURL);
diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx
index 7618f336e35c..15e9cde96d0b 100644
--- a/dbaccess/source/ui/uno/copytablewizard.cxx
+++ b/dbaccess/source/ui/uno/copytablewizard.cxx
@@ -129,6 +129,7 @@ namespace dbaui
using ::com::sun::star::sdbc::SQLException;
using ::com::sun::star::sdb::SQLContext;
using ::com::sun::star::sdbc::ConnectionPool;
+ using ::com::sun::star::sdbc::XConnectionPool;
using ::com::sun::star::sdbc::XDriverManager;
using ::com::sun::star::beans::PropertyValue;
/** === end UNO using === **/
@@ -953,7 +954,7 @@ SharedConnection CopyTableWizard::impl_extractConnection_throw( const Reference<
if ( xPSI->hasPropertyByName( PROPERTY_CONNECTION_INFO ) )
OSL_VERIFY( _rxDataSourceDescriptor->getPropertyValue( PROPERTY_CONNECTION_INFO ) >>= aConnectionInfo );
- Reference< XDriverManager > xDriverManager;
+ Reference< XConnectionPool > xDriverManager;
try {
xDriverManager.set( ConnectionPool::create( m_aContext.getUNOContext() ) );
} catch( const Exception& ) { }