30#include <osl/file.hxx>
31#include <osl/process.h>
32#include <rtl/bootstrap.hxx>
48constexpr OUStringLiteral our_sFirebirdTmpVar =
u"FIREBIRD_TMP";
49constexpr OUStringLiteral our_sFirebirdLockVar =
u"FIREBIRD_LOCK";
50constexpr OUStringLiteral our_sFirebirdMsgVar =
u"FIREBIRD_MSG";
52constexpr OUStringLiteral our_sFirebirdLibVar =
u"LIBREOFFICE_FIREBIRD_LIB";
56FirebirdDriver::FirebirdDriver(
const css::uno::Reference< css::uno::XComponentContext >& _rxContext)
59 , m_firebirdTMPDirectory(nullptr, true)
60 , m_firebirdLockDirectory(nullptr, true)
74#ifndef SYSTEM_FIREBIRD
77 OUString sMsgURL(
"$BRAND_BASE_DIR/$BRAND_SHARE_SUBDIR/firebird");
78 ::rtl::Bootstrap::expandMacros(sMsgURL);
80 ::osl::FileBase::getSystemPathFromFileURL(sMsgURL, sMsgPath);
81 osl_setEnvironment(OUString(our_sFirebirdMsgVar).
pData, sMsgPath.pData);
85 OUString sLibURL(
"$LO_LIB_DIR");
86 ::rtl::Bootstrap::expandMacros(sLibURL);
88 ::osl::FileBase::getSystemPathFromFileURL(sLibURL, sLibPath);
89 osl_setEnvironment(OUString(our_sFirebirdLibVar).
pData, sLibPath.pData);
108 osl_clearEnvironment(OUString(our_sFirebirdTmpVar).
pData);
109 osl_clearEnvironment(OUString(our_sFirebirdLockVar).
pData);
111#ifndef SYSTEM_FIREBIRD
112 osl_clearEnvironment(OUString(our_sFirebirdMsgVar).
pData);
114 osl_clearEnvironment(OUString(our_sFirebirdLibVar).
pData);
118 OSL_VERIFY(fb_shutdown(0, 1));
120 ODriver_BASE::disposing();
125 return "com.sun.star.comp.sdbc.firebird.Driver";
135 return {
"com.sun.star.sdbc.Driver",
"com.sun.star.sdbcx.Driver" };
142 SAL_INFO(
"connectivity.firebird",
"connect(), URL: " << url );
145 if (ODriver_BASE::rBHelper.bDisposed)
146 throw DisposedException();
152 pCon->construct(url, info);
161 return (url ==
"sdbc:embedded:firebird" || url.startsWith(
"sdbc:firebird:"));
191 const uno::Reference< XConnection >& rConnection)
193 if (
Connection* pConnection = comphelper::getFromUnoTunnel<Connection>(rConnection))
194 return pConnection->createCatalog();
199 const OUString& rURL,
200 const uno::Sequence< PropertyValue >& rInfo)
202 uno::Reference< XConnection > xConnection =
connect(rURL, rInfo);
211 throw DisposedException();
217extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
219 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any>
const&)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * connectivity_FirebirdDriver_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
helper class for accessing resources shared by different libraries in the connectivity module
OUString getResourceString(TranslateId pResId) const
loads a string from the shared resource file
virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL disposing() override
::utl::TempFileNamed m_firebirdTMPDirectory
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByURL(const OUString &rsURL, const css::uno::Sequence< css::beans::PropertyValue > &rInfo) override
virtual sal_Bool SAL_CALL acceptsURL(const OUString &url) override
virtual ~FirebirdDriver() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual sal_Int32 SAL_CALL getMajorVersion() override
::utl::TempFileNamed m_firebirdLockDirectory
virtual css::uno::Reference< css::sdbcx::XTablesSupplier > SAL_CALL getDataDefinitionByConnection(const css::uno::Reference< css::sdbc::XConnection > &rxConnection) override
virtual sal_Int32 SAL_CALL getMinorVersion() override
OWeakRefArray m_xConnections
void EnableKillingFile(bool bEnable=true)
OUString GetFileName() const
Reference< XComponentContext > m_aContext
#define SAL_INFO(area, stream)
std::unique_ptr< sal_Int32[]> pData
void checkDisposed(bool _bThrow)
::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::sdbcx::XDataDefinitionSupplier, css::lang::XServiceInfo > ODriver_BASE
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)