diff options
author | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-07-20 11:57:35 +0200 |
---|---|---|
committer | Andrzej J.R. Hunt <andrzej@ahunt.org> | 2013-07-21 18:47:11 +0200 |
commit | a815e1384dd47164aa0fcb17020293382d53adf0 (patch) | |
tree | a8cc9b91631c2d08f22d00342fcbdc1e4cd0dd55 /connectivity | |
parent | c9321851a4de1d67037ea83bcbd29ca30701d5b3 (diff) |
Parse external file url and create new db as needed (firebird-sdbc).
Change-Id: I9dd13540242f6f641f64c44a7121547e0c75c32c
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/drivers/firebird/FConnection.cxx | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/connectivity/source/drivers/firebird/FConnection.cxx b/connectivity/source/drivers/firebird/FConnection.cxx index 1381dfe44e4a..9e6c2612921e 100644 --- a/connectivity/source/drivers/firebird/FConnection.cxx +++ b/connectivity/source/drivers/firebird/FConnection.cxx @@ -203,27 +203,29 @@ void OConnection::construct(const ::rtl::OUString& url, const Sequence< Property uno::UNO_QUERY ); if ( !xFileAccess.is() ) { - // TODO: Error ::connectivity::SharedResources aResources; const OUString sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION); ::dbtools::throwGenericSQLException(sMessage ,*this); } - try { - xFileAccess->writeFile(m_sURL,xDBStream->getInputStream()); - } - catch (...) - { - // TODO - } + + xFileAccess->writeFile(m_sURL,xDBStream->getInputStream()); } + // TOOO: Get DB properties from XML - if (bIsNewDatabase) + } + // External file AND/OR remote connection + else if (url.startsWith("sdbc:firebird:")) + { + m_sURL = url.copy(OUString("sdbc:firebird:").getLength()); + if (m_sURL.startsWith("file://")) // TODO: are file urls really like this? { + uno::Reference< ucb::XSimpleFileAccess > xFileAccess( + ucb::SimpleFileAccess::create(comphelper::getProcessComponentContext()), + uno::UNO_QUERY); + if (!xFileAccess->exists(m_sURL)) + bIsNewDatabase = true; } - // Get DB properties from XML - } - // else if url.begins(sdbc:firebird...) ISC_STATUS_ARRAY status; /* status vector */ |