summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'connectivity/source/drivers/postgresql/pq_preparedstatement.cxx')
-rw-r--r--connectivity/source/drivers/postgresql/pq_preparedstatement.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
index 344c27175850..e616e9b22966 100644
--- a/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
+++ b/connectivity/source/drivers/postgresql/pq_preparedstatement.cxx
@@ -40,7 +40,7 @@
#include "pq_statics.hxx"
#include "pq_statement.hxx"
-#include <o3tl/deleter.hxx>
+#include <o3tl/safeint.hxx>
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
@@ -57,6 +57,7 @@
#include <string_view>
#include <connectivity/dbconversion.hxx>
+#include <utility>
using osl::MutexGuard;
@@ -149,12 +150,12 @@ PreparedStatement::PreparedStatement(
const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex,
const Reference< XConnection > & conn,
struct ConnectionSettings *pSettings,
- const OString & stmt )
+ OString stmt )
: PreparedStatement_BASE(refMutex->GetMutex())
, OPropertySetHelper(PreparedStatement_BASE::rBHelper)
, m_connection(conn)
, m_pSettings(pSettings)
- , m_stmt(stmt)
+ , m_stmt(std::move(stmt))
, m_xMutex(refMutex)
, m_multipleResultAvailable(false)
, m_multipleResultUpdateCount(0)
@@ -198,7 +199,7 @@ PreparedStatement::~PreparedStatement()
void PreparedStatement::checkColumnIndex( sal_Int32 parameterIndex )
{
- if( parameterIndex < 1 || parameterIndex > static_cast<sal_Int32>(m_vars.size()) )
+ if( parameterIndex < 1 || o3tl::make_unsigned(parameterIndex) > m_vars.size() )
{
throw SQLException(
"pq_preparedstatement: parameter index out of range (expected 1 to "
@@ -262,10 +263,9 @@ void PreparedStatement::close( )
void PreparedStatement::raiseSQLException( const char * errorMsg )
{
OUStringBuffer buf(128);
- buf.append( "pq_driver: ");
- buf.append(
- OUString( errorMsg, strlen(errorMsg) , ConnectionSettings::encoding ) );
- buf.append( " (caused by statement '" );
+ buf.append( "pq_driver: "
+ + OUString( errorMsg, strlen(errorMsg) , ConnectionSettings::encoding )
+ + " (caused by statement '" );
buf.appendAscii( m_executedStatement.getStr() );
buf.append( "')" );
OUString error = buf.makeStringAndClear();
@@ -390,7 +390,7 @@ void PreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 )
MutexGuard guard( m_xMutex->GetMutex() );
checkClosed();
checkColumnIndex( parameterIndex );
- m_vars[parameterIndex-1] = OString( "NULL" );
+ m_vars[parameterIndex-1] = "NULL"_ostr;
}
void PreparedStatement::setObjectNull(
@@ -399,7 +399,7 @@ void PreparedStatement::setObjectNull(
MutexGuard guard( m_xMutex->GetMutex() );
checkClosed();
checkColumnIndex( parameterIndex );
- m_vars[parameterIndex-1] = OString( "NULL" );
+ m_vars[parameterIndex-1] = "NULL"_ostr;
}
@@ -409,9 +409,9 @@ void PreparedStatement::setBoolean( sal_Int32 parameterIndex, sal_Bool x )
checkClosed();
checkColumnIndex( parameterIndex );
if( x )
- m_vars[parameterIndex-1] = OString( "'t'" );
+ m_vars[parameterIndex-1] = "'t'"_ostr;
else
- m_vars[parameterIndex-1] = OString( "'f'" );
+ m_vars[parameterIndex-1] = "'f'"_ostr;
}
void PreparedStatement::setByte( sal_Int32 parameterIndex, sal_Int8 x )