summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/jdbc/JConnection.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/jdbc/JConnection.cxx')
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index 5553b1195d29..5844df568ba3 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -43,6 +43,7 @@
#include <unotools/confignode.hxx>
#include <strings.hxx>
+#include <utility>
#include <vector>
#include <memory>
@@ -58,8 +59,8 @@ namespace {
struct ClassMapEntry {
ClassMapEntry(
- OUString const & theClassPath, OUString const & theClassName):
- classPath(theClassPath), className(theClassName), classLoader(nullptr),
+ OUString theClassPath, OUString theClassName):
+ classPath(std::move(theClassPath)), className(std::move(theClassName)), classLoader(nullptr),
classObject(nullptr) {}
OUString classPath;
@@ -165,7 +166,7 @@ bool loadClass(
// JVM that are not easily undone). If the pushed ClassMapEntry is
// not used after all (return false, etc.) it will be pruned on next
// call because its classLoader/classObject are null:
- classMapData.map.push_back( ClassMapEntry( classPath, name ) );
+ classMapData.map.emplace_back(classPath, name);
i = std::prev(classMapData.map.end());
}
@@ -436,7 +437,7 @@ Reference< XStatement > SAL_CALL java_sql_Connection::createStatement( )
SDBThreadAttach t;
rtl::Reference<java_sql_Statement> pStatement = new java_sql_Statement( t.pEnv, *this );
Reference< XStatement > xStmt = pStatement;
- m_aStatements.push_back( WeakReferenceHelper( xStmt ) );
+ m_aStatements.emplace_back(xStmt);
m_aLogger.log( LogLevel::FINE, STR_LOG_CREATED_STATEMENT_ID, pStatement->getStatementObjectID() );
return xStmt;
@@ -452,7 +453,7 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareStatement(
rtl::Reference<java_sql_PreparedStatement> pStatement = new java_sql_PreparedStatement( t.pEnv, *this, sql );
Reference< XPreparedStatement > xReturn( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xReturn));
+ m_aStatements.emplace_back(xReturn);
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_STATEMENT_ID, pStatement->getStatementObjectID() );
return xReturn;
@@ -468,7 +469,7 @@ Reference< XPreparedStatement > SAL_CALL java_sql_Connection::prepareCall( const
rtl::Reference<java_sql_CallableStatement> pStatement = new java_sql_CallableStatement( t.pEnv, *this, sql );
Reference< XPreparedStatement > xStmt( pStatement );
- m_aStatements.push_back(WeakReferenceHelper(xStmt));
+ m_aStatements.emplace_back(xStmt);
m_aLogger.log( LogLevel::FINE, STR_LOG_PREPARED_CALL_ID, pStatement->getStatementObjectID() );
return xStmt;
@@ -523,14 +524,10 @@ 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;
-
- return makeAny( aWarning );
+ SQLWarning aWarning(aAsException.Message, aAsException.Context, aAsException.SQLState,
+ aAsException.ErrorCode, aAsException.NextException);
+
+ return Any( aWarning );
}
return Any();