summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-25 16:18:18 +0200
committerAndrzej J.R. Hunt <andrzej@ahunt.org>2013-07-25 19:41:17 +0200
commitb17392f85d143c44d109702ebfd8802533b4e682 (patch)
tree3c2cee50cf3909156e208d850bf3da7d7d459e02
parente43a151549b7f87cb1c1c1165b9777697fd9c1d7 (diff)
Upgrade the last bit of pr_error to use exceptions. (firebird-sdbc)
Change-Id: I066cd519158c6d28ed410e4f62d9418dcf95a6c3
-rw-r--r--connectivity/source/drivers/firebird/FConnection.cxx67
1 files changed, 29 insertions, 38 deletions
diff --git a/connectivity/source/drivers/firebird/FConnection.cxx b/connectivity/source/drivers/firebird/FConnection.cxx
index 6407dadfd51c..d33f9fa96975 100644
--- a/connectivity/source/drivers/firebird/FConnection.cxx
+++ b/connectivity/source/drivers/firebird/FConnection.cxx
@@ -122,24 +122,6 @@ void SAL_CALL OConnection::release() throw()
{
relase_ChildImpl();
}
-// -----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-
-/* Print the status, the SQLCODE, and exit.
- * Also, indicate which operation the error occured on.
- */
-static int pr_error(const ISC_STATUS* status, const char* operation)
-{
- SAL_WARN("connectivity.firebird", "=> OConnection static pr_error().");
-
- isc_print_status(status);
-
- SAL_WARN("connectivity.firebird", "=> OConnection static pr_error(). "
- "PROBLEM ON " << operation << ". "
- "SQLCODE: " << isc_sqlcode(status) << ".");
-
- return 1;
-}
void OConnection::construct(const ::rtl::OUString& url, const Sequence< PropertyValue >& info)
throw(SQLException)
@@ -267,31 +249,37 @@ void OConnection::construct(const ::rtl::OUString& url, const Sequence< Property
}
ISC_STATUS_ARRAY status; /* status vector */
-
+ ISC_STATUS aErr;
if (bIsNewDatabase)
{
- if (isc_create_database(status,
- m_sURL.getLength(),
- OUStringToOString(m_sURL,RTL_TEXTENCODING_UTF8).getStr(),
- &m_DBHandler,
- dpbLength,
- dpbBuffer,
- 0))
+ aErr = isc_create_database(status,
+ m_sURL.getLength(),
+ OUStringToOString(m_sURL,RTL_TEXTENCODING_UTF8).getStr(),
+ &m_DBHandler,
+ dpbLength,
+ dpbBuffer,
+ 0);
+ if (aErr)
{
- if(pr_error(status, "create new database"))
- return;
+ evaluateStatusVector(status,
+ "isc_create_database",
+ *this);
}
}
else
{
- if (isc_attach_database(status,
- m_sURL.getLength(),
- OUStringToOString(m_sURL, RTL_TEXTENCODING_UTF8).getStr(),
- &m_DBHandler,
- dpbLength,
- dpbBuffer))
- if (pr_error(status, "attach database"))
- return;
+ aErr = isc_attach_database(status,
+ m_sURL.getLength(),
+ OUStringToOString(m_sURL, RTL_TEXTENCODING_UTF8).getStr(),
+ &m_DBHandler,
+ dpbLength,
+ dpbBuffer);
+ if (aErr)
+ {
+ evaluateStatusVector(status,
+ "isc_attach_database",
+ *this);
+ }
}
if (m_bIsEmbedded) // Add DocumentEventListener to save the .fdb as needed
@@ -742,8 +730,11 @@ void OConnection::disposing()
}
if (isc_detach_database(status, &m_DBHandler))
- if (pr_error(status, "dattach database"))
- return;
+ {
+ evaluateStatusVector(status,
+ "isc_detach_database",
+ *this);
+ }
// TODO: write to storage again?
if (m_bIsEmbedded)
{