summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity')
-rw-r--r--connectivity/source/commontools/dbexception.cxx20
-rw-r--r--connectivity/source/commontools/paramwrapper.cxx6
-rw-r--r--connectivity/source/drivers/calc/CConnection.cxx11
-rw-r--r--connectivity/source/drivers/file/FConnection.cxx16
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx8
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtable.cxx3
-rw-r--r--connectivity/source/drivers/postgresql/pq_xview.cxx3
7 files changed, 21 insertions, 46 deletions
diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx
index 0f6fec238129..bc5a9be80804 100644
--- a/connectivity/source/commontools/dbexception.cxx
+++ b/connectivity/source/commontools/dbexception.cxx
@@ -66,8 +66,7 @@ SQLExceptionInfo::SQLExceptionInfo(const css::sdb::SQLContext& _rError)
SQLExceptionInfo::SQLExceptionInfo( const OUString& _rSimpleErrorMessage )
{
- SQLException aError;
- aError.Message = _rSimpleErrorMessage;
+ SQLException aError(_rSimpleErrorMessage, {}, {}, 0, {});
m_aContent <<= aError;
implDetermineType();
}
@@ -177,11 +176,7 @@ SQLExceptionInfo::operator const css::sdb::SQLContext*() const
void SQLExceptionInfo::prepend( const OUString& _rErrorMessage )
{
- SQLException aException;
- aException.Message = _rErrorMessage;
- aException.ErrorCode = 0;
- aException.SQLState = "S1000";
- aException.NextException = m_aContent;
+ SQLException aException(_rErrorMessage, {}, "S1000", 0, m_aContent);
m_aContent <<= aException;
m_eType = TYPE::SQLException;
@@ -194,24 +189,19 @@ Any SQLExceptionInfo::createException(TYPE eType, const OUString& rErrorMessage,
switch (eType)
{
case TYPE::SQLException:
- aAppend <<= SQLException();
+ aAppend <<= SQLException(rErrorMessage, {}, rSQLState, nErrorCode, {});
break;
case TYPE::SQLWarning:
- aAppend <<= SQLWarning();
+ aAppend <<= SQLWarning(rErrorMessage, {}, rSQLState, nErrorCode, {});
break;
case TYPE::SQLContext:
- aAppend <<= SQLContext();
+ aAppend <<= SQLContext(rErrorMessage, {}, rSQLState, nErrorCode, {}, {});
break;
default:
TOOLS_WARN_EXCEPTION("connectivity.commontools", "SQLExceptionInfo::createException: invalid exception type: this will crash!");
break;
}
- SQLException& pAppendException = const_cast<SQLException &>(*o3tl::forceAccess<SQLException>(aAppend));
- pAppendException.Message = rErrorMessage;
- pAppendException.SQLState = rSQLState;
- pAppendException.ErrorCode = nErrorCode;
-
return aAppend;
}
diff --git a/connectivity/source/commontools/paramwrapper.cxx b/connectivity/source/commontools/paramwrapper.cxx
index 9ab5293c2057..e25a3e7b4905 100644
--- a/connectivity/source/commontools/paramwrapper.cxx
+++ b/connectivity/source/commontools/paramwrapper.cxx
@@ -215,11 +215,7 @@ namespace dbtools::param
}
catch( SQLException& e )
{
- WrappedTargetException aExceptionWrapper;
- aExceptionWrapper.Context = e.Context;
- aExceptionWrapper.Message = e.Message;
- aExceptionWrapper.TargetException <<= e;
- throw aExceptionWrapper;
+ throw WrappedTargetException(e.Message, e.Context, css::uno::Any(e));
}
}
else
diff --git a/connectivity/source/drivers/calc/CConnection.cxx b/connectivity/source/drivers/calc/CConnection.cxx
index 8d4a0c01ebc1..f4f1b409e2f5 100644
--- a/connectivity/source/drivers/calc/CConnection.cxx
+++ b/connectivity/source/drivers/calc/CConnection.cxx
@@ -142,12 +142,11 @@ Reference< XSpreadsheetDocument> const & OCalcConnection::acquireDoc()
Exception aLoaderError;
OSL_VERIFY( aLoaderException >>= aLoaderError );
- SQLException aDetailException;
- aDetailException.Message = m_aResources.getResourceStringWithSubstitution(
- STR_LOAD_FILE_ERROR_MESSAGE,
- "$exception_type$", aLoaderException.getValueTypeName(),
- "$error_message$", aLoaderError.Message
- );
+ SQLException aDetailException(m_aResources.getResourceStringWithSubstitution(
+ STR_LOAD_FILE_ERROR_MESSAGE, "$exception_type$",
+ aLoaderException.getValueTypeName(),
+ "$error_message$", aLoaderError.Message),
+ {}, {}, 0, {});
aErrorDetails <<= aDetailException;
}
diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx
index 90030abb51db..de93df897b23 100644
--- a/connectivity/source/drivers/file/FConnection.cxx
+++ b/connectivity/source/drivers/file/FConnection.cxx
@@ -413,17 +413,13 @@ const Sequence< sal_Int8 > & OConnection::getUnoTunnelId()
void OConnection::throwUrlNotValid(const OUString & _rsUrl,const OUString & _rsMessage)
{
- SQLException aError;
- aError.Message = getResources().getResourceStringWithSubstitution(
- STR_NO_VALID_FILE_URL,
- "$URL$", _rsUrl
- );
-
- aError.SQLState = "S1000";
- aError.ErrorCode = 0;
- aError.Context = static_cast< XConnection* >(this);
+ XConnection* context = this;
+ css::uno::Any next;
if (!_rsMessage.isEmpty())
- aError.NextException <<= SQLException(_rsMessage, aError.Context, OUString(), 0, Any());
+ next <<= SQLException(_rsMessage, context, OUString(), 0, Any());
+ SQLException aError(
+ getResources().getResourceStringWithSubstitution(STR_NO_VALID_FILE_URL, "$URL$", _rsUrl),
+ context, "S1000", 0, next);
throw aError;
}
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index cff6f8f4e45b..77d0ff38799b 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -524,12 +524,8 @@ Any SAL_CALL java_sql_Connection::getWarnings( )
SQLException aAsException( java_sql_SQLWarning( warn_base, *this ) );
// translate to warning
- SQLWarning aWarning;
- aWarning.Context = aAsException.Context;
- aWarning.Message = aAsException.Message;
- aWarning.SQLState = aAsException.SQLState;
- aWarning.ErrorCode = aAsException.ErrorCode;
- aWarning.NextException = aAsException.NextException;
+ SQLWarning aWarning(aAsException.Message, aAsException.Context, aAsException.SQLState,
+ aAsException.ErrorCode, aAsException.NextException);
return Any( aWarning );
}
diff --git a/connectivity/source/drivers/postgresql/pq_xtable.cxx b/connectivity/source/drivers/postgresql/pq_xtable.cxx
index 4a659ffb9941..de8196f9fecd 100644
--- a/connectivity/source/drivers/postgresql/pq_xtable.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtable.cxx
@@ -190,8 +190,7 @@ void Table::rename( const OUString& newName )
}
catch( css::sdbc::SQLException &e )
{
- OUString buf( e.Message + "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)" );
- e.Message = buf;
+ e.Message += "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)";
throw;
}
diff --git a/connectivity/source/drivers/postgresql/pq_xview.cxx b/connectivity/source/drivers/postgresql/pq_xview.cxx
index 2b8f61be708d..c2e936e9a314 100644
--- a/connectivity/source/drivers/postgresql/pq_xview.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xview.cxx
@@ -126,8 +126,7 @@ void View::rename( const OUString& newName )
}
catch( css::sdbc::SQLException &e )
{
- OUString buf( e.Message + "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)" );
- e.Message = buf;
+ e.Message += "(NOTE: Only postgresql server >= V8.1 support changing a table's schema)";
throw;
}