Correct firebird-sdbc version number, cleanup FDriver.
Change-Id: I9b9f13d312667ad2649ecd8f7288db5413d029a7
This commit is contained in:
@@ -48,14 +48,16 @@ using namespace com::sun::star::lang;
|
|||||||
using namespace com::sun::star::beans;
|
using namespace com::sun::star::beans;
|
||||||
using namespace com::sun::star::sdbc;
|
using namespace com::sun::star::sdbc;
|
||||||
|
|
||||||
|
using namespace ::osl;
|
||||||
|
|
||||||
using namespace connectivity::firebird;
|
using namespace connectivity::firebird;
|
||||||
|
|
||||||
namespace connectivity
|
namespace connectivity
|
||||||
{
|
{
|
||||||
namespace firebird
|
namespace firebird
|
||||||
{
|
{
|
||||||
//------------------------------------------------------------------
|
Reference< XInterface > SAL_CALL FirebirdDriver_CreateInstance(
|
||||||
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL FirebirdDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception )
|
const Reference< XMultiServiceFactory >& _rxFactory) throw( Exception )
|
||||||
{
|
{
|
||||||
SAL_INFO("connectivity.firebird", "=> ODriver_BASE::FirebirdDriver_CreateInstance()" );
|
SAL_INFO("connectivity.firebird", "=> ODriver_BASE::FirebirdDriver_CreateInstance()" );
|
||||||
(void) _rxFactory;
|
(void) _rxFactory;
|
||||||
@@ -63,15 +65,15 @@ namespace connectivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
FirebirdDriver::FirebirdDriver()
|
FirebirdDriver::FirebirdDriver()
|
||||||
: ODriver_BASE(m_aMutex)
|
: ODriver_BASE(m_aMutex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
void FirebirdDriver::disposing()
|
void FirebirdDriver::disposing()
|
||||||
{
|
{
|
||||||
::osl::MutexGuard aGuard(m_aMutex);
|
MutexGuard aGuard(m_aMutex);
|
||||||
|
|
||||||
// when driver will be destroied so all our connections have to be destroied as well
|
// when driver will be destroied so all our connections have to be destroied as well
|
||||||
for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
|
for (OWeakRefArray::iterator i = m_xConnections.begin(); m_xConnections.end() != i; ++i)
|
||||||
@@ -85,56 +87,53 @@ void FirebirdDriver::disposing()
|
|||||||
ODriver_BASE::disposing();
|
ODriver_BASE::disposing();
|
||||||
}
|
}
|
||||||
|
|
||||||
// static ServiceInfo
|
//----- static ServiceInfo ---------------------------------------------------
|
||||||
//------------------------------------------------------------------------------
|
rtl::OUString FirebirdDriver::getImplementationName_Static() throw(RuntimeException)
|
||||||
rtl::OUString FirebirdDriver::getImplementationName_Static( ) throw(RuntimeException)
|
|
||||||
{
|
{
|
||||||
return rtl::OUString("com.sun.star.comp.sdbc.firebird.Driver");
|
return rtl::OUString("com.sun.star.comp.sdbc.firebird.Driver");
|
||||||
// this name is referenced in the configuration and in the firebird.xml
|
|
||||||
// Please take care when changing it.
|
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
Sequence< ::rtl::OUString > FirebirdDriver::getSupportedServiceNames_Static( ) throw (RuntimeException)
|
Sequence< OUString > FirebirdDriver::getSupportedServiceNames_Static() throw (RuntimeException)
|
||||||
{
|
{
|
||||||
// which service is supported
|
// TODO: add com.sun.star.sdbcx.Driver once all sdbc functionality is implemented
|
||||||
// for more information @see com.sun.star.sdbc.Driver
|
Sequence< OUString > aSNS( 1 );
|
||||||
Sequence< ::rtl::OUString > aSNS( 1 );
|
aSNS[0] = OUString("com.sun.star.sdbc.Driver");
|
||||||
aSNS[0] = ::rtl::OUString("com.sun.star.sdbc.Driver");
|
|
||||||
return aSNS;
|
return aSNS;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
OUString SAL_CALL FirebirdDriver::getImplementationName() throw(RuntimeException)
|
||||||
::rtl::OUString SAL_CALL FirebirdDriver::getImplementationName( ) throw(RuntimeException)
|
|
||||||
{
|
{
|
||||||
return getImplementationName_Static();
|
return getImplementationName_Static();
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
sal_Bool SAL_CALL FirebirdDriver::supportsService(const OUString& _rServiceName)
|
||||||
sal_Bool SAL_CALL FirebirdDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException)
|
throw(RuntimeException)
|
||||||
{
|
{
|
||||||
Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames());
|
Sequence< OUString > aSupported(getSupportedServiceNames());
|
||||||
const ::rtl::OUString* pSupported = aSupported.getConstArray();
|
const OUString* pSupported = aSupported.getConstArray();
|
||||||
const ::rtl::OUString* pEnd = pSupported + aSupported.getLength();
|
const OUString* pEnd = pSupported + aSupported.getLength();
|
||||||
for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
|
for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported)
|
||||||
;
|
;
|
||||||
|
|
||||||
return pSupported != pEnd;
|
return pSupported != pEnd;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------
|
Sequence< OUString > SAL_CALL FirebirdDriver::getSupportedServiceNames()
|
||||||
Sequence< ::rtl::OUString > SAL_CALL FirebirdDriver::getSupportedServiceNames( ) throw(RuntimeException)
|
throw(RuntimeException)
|
||||||
{
|
{
|
||||||
return getSupportedServiceNames_Static();
|
return getSupportedServiceNames_Static();
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------------
|
// ---- XDriver -------------------------------------------------------------
|
||||||
Reference< XConnection > SAL_CALL FirebirdDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
|
Reference< XConnection > SAL_CALL FirebirdDriver::connect(
|
||||||
|
const OUString& url, const Sequence< PropertyValue >& info )
|
||||||
|
throw(SQLException, RuntimeException)
|
||||||
{
|
{
|
||||||
Reference< XConnection > xConnection;
|
Reference< XConnection > xConnection;
|
||||||
|
|
||||||
SAL_INFO("connectivity.firebird", "=> ODriver_BASE::connect(), URL: " << url );
|
SAL_INFO("connectivity.firebird", "=> ODriver_BASE::connect(), URL: " << url );
|
||||||
|
|
||||||
::osl::MutexGuard aGuard( m_aMutex );
|
MutexGuard aGuard( m_aMutex );
|
||||||
if (ODriver_BASE::rBHelper.bDisposed)
|
if (ODriver_BASE::rBHelper.bDisposed)
|
||||||
throw DisposedException();
|
throw DisposedException();
|
||||||
|
|
||||||
@@ -149,14 +148,16 @@ Reference< XConnection > SAL_CALL FirebirdDriver::connect( const ::rtl::OUString
|
|||||||
|
|
||||||
return xCon;
|
return xCon;
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
sal_Bool SAL_CALL FirebirdDriver::acceptsURL( const ::rtl::OUString& url )
|
sal_Bool SAL_CALL FirebirdDriver::acceptsURL( const OUString& url )
|
||||||
throw(SQLException, RuntimeException)
|
throw(SQLException, RuntimeException)
|
||||||
{
|
{
|
||||||
return url.equals("sdbc:embedded:firebird") || url.startsWith("sdbc:firebird:");
|
return url.equals("sdbc:embedded:firebird") || url.startsWith("sdbc:firebird:");
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
Sequence< DriverPropertyInfo > SAL_CALL FirebirdDriver::getPropertyInfo( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException)
|
Sequence< DriverPropertyInfo > SAL_CALL FirebirdDriver::getPropertyInfo(
|
||||||
|
const OUString& url, const Sequence< PropertyValue >& info )
|
||||||
|
throw(SQLException, RuntimeException)
|
||||||
{
|
{
|
||||||
(void) info;
|
(void) info;
|
||||||
if ( ! acceptsURL(url) )
|
if ( ! acceptsURL(url) )
|
||||||
@@ -164,34 +165,31 @@ Sequence< DriverPropertyInfo > SAL_CALL FirebirdDriver::getPropertyInfo( const :
|
|||||||
::connectivity::SharedResources aResources;
|
::connectivity::SharedResources aResources;
|
||||||
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
|
const OUString sMessage = aResources.getResourceString(STR_URI_SYNTAX_ERROR);
|
||||||
::dbtools::throwGenericSQLException(sMessage ,*this);
|
::dbtools::throwGenericSQLException(sMessage ,*this);
|
||||||
} // if ( ! acceptsURL(url) )
|
}
|
||||||
|
|
||||||
// if you have somthing special to say, return it here :-)
|
|
||||||
return Sequence< DriverPropertyInfo >();
|
return Sequence< DriverPropertyInfo >();
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
sal_Int32 SAL_CALL FirebirdDriver::getMajorVersion( ) throw(RuntimeException)
|
sal_Int32 SAL_CALL FirebirdDriver::getMajorVersion( ) throw(RuntimeException)
|
||||||
{
|
{
|
||||||
return 0; // depends on you
|
// The major and minor version are sdbc driver specific. Must begin with 1.0
|
||||||
|
// as per http://api.libreoffice.org/docs/common/ref/com/sun/star/sdbc/XDriver.html
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
sal_Int32 SAL_CALL FirebirdDriver::getMinorVersion( ) throw(RuntimeException)
|
sal_Int32 SAL_CALL FirebirdDriver::getMinorVersion( ) throw(RuntimeException)
|
||||||
{
|
{
|
||||||
return 1; // depends on you
|
return 0;
|
||||||
}
|
}
|
||||||
// --------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
//.........................................................................
|
|
||||||
namespace connectivity
|
namespace connectivity
|
||||||
{
|
{
|
||||||
namespace firebird
|
namespace firebird
|
||||||
{
|
{
|
||||||
//.........................................................................
|
|
||||||
|
|
||||||
void release(oslInterlockedCount& _refCount,
|
void release(oslInterlockedCount& _refCount, ::cppu::OBroadcastHelper& rBHelper,
|
||||||
::cppu::OBroadcastHelper& rBHelper,
|
Reference< XInterface >& _xInterface, XComponent* _pObject)
|
||||||
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _xInterface,
|
|
||||||
::com::sun::star::lang::XComponent* _pObject)
|
|
||||||
{
|
{
|
||||||
if (osl_atomic_decrement( &_refCount ) == 0)
|
if (osl_atomic_decrement( &_refCount ) == 0)
|
||||||
{
|
{
|
||||||
@@ -200,9 +198,9 @@ namespace connectivity
|
|||||||
if (!rBHelper.bDisposed && !rBHelper.bInDispose)
|
if (!rBHelper.bDisposed && !rBHelper.bInDispose)
|
||||||
{
|
{
|
||||||
// remember the parent
|
// remember the parent
|
||||||
::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xParent;
|
Reference< XInterface > xParent;
|
||||||
{
|
{
|
||||||
::osl::MutexGuard aGuard( rBHelper.rMutex );
|
MutexGuard aGuard( rBHelper.rMutex );
|
||||||
xParent = _xInterface;
|
xParent = _xInterface;
|
||||||
_xInterface = NULL;
|
_xInterface = NULL;
|
||||||
}
|
}
|
||||||
@@ -216,7 +214,7 @@ namespace connectivity
|
|||||||
// release the parent in the ~
|
// release the parent in the ~
|
||||||
if (xParent.is())
|
if (xParent.is())
|
||||||
{
|
{
|
||||||
::osl::MutexGuard aGuard( rBHelper.rMutex );
|
MutexGuard aGuard( rBHelper.rMutex );
|
||||||
_xInterface = xParent;
|
_xInterface = xParent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -231,9 +229,9 @@ namespace connectivity
|
|||||||
throw DisposedException();
|
throw DisposedException();
|
||||||
|
|
||||||
}
|
}
|
||||||
//.........................................................................
|
|
||||||
}
|
}
|
||||||
} // namespace connectivity
|
} // namespace connectivity
|
||||||
//.........................................................................
|
|
||||||
|
|
||||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
||||||
|
Reference in New Issue
Block a user