summaryrefslogtreecommitdiff
path: root/connectivity/source/drivers/postgresql
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-03-08 16:46:00 +0200
committerNoel Grandin <noel@peralex.com>2016-03-09 10:07:47 +0200
commit1dc23829b9a38d4c6be4a0649dee28a5693ac87a (patch)
tree2df8f61e308bd2b1507745ed61a151ae8f30cb65 /connectivity/source/drivers/postgresql
parent978cfb856b013580921dc2c262565438692d4221 (diff)
loplugin:constantparam in connectivity
Change-Id: I5e71b3de15e043066cd4177dd42b231527eb71e4
Diffstat (limited to 'connectivity/source/drivers/postgresql')
-rw-r--r--connectivity/source/drivers/postgresql/pq_baseresultset.cxx48
-rw-r--r--connectivity/source/drivers/postgresql/pq_baseresultset.hxx2
2 files changed, 18 insertions, 32 deletions
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
index f8ce6ce78694..acb92e15c4b5 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.cxx
@@ -386,7 +386,7 @@ sal_Bool BaseResultSet::getBoolean( sal_Int32 columnIndex ) throw (SQLException,
MutexGuard guard( m_refMutex->mutex );
checkClosed();
checkColumnIndex( columnIndex );
- checkRowIndex( true /* must be on row */ );
+ checkRowIndex();
OUString str = getString( columnIndex );
@@ -412,7 +412,7 @@ sal_Int8 BaseResultSet::getByte( sal_Int32 columnIndex )
MutexGuard guard( m_refMutex->mutex );
checkClosed();
checkColumnIndex( columnIndex );
- checkRowIndex( true /* must be on row */ );
+ checkRowIndex();
sal_Int8 b = 0;
convertTo( getValue( columnIndex ), cppu::UnoType<decltype(b)>::get()) >>= b;
return b;
@@ -424,7 +424,7 @@ sal_Int16 BaseResultSet::getShort( sal_Int32 columnIndex )
MutexGuard guard( m_refMutex->mutex );
checkClosed();
checkColumnIndex( columnIndex );
- checkRowIndex( true /* must be on row */ );
+ checkRowIndex();
sal_Int16 i = 0;
convertTo( getValue( columnIndex ), cppu::UnoType<decltype(i)>::get()) >>= i;
return i;
@@ -435,7 +435,7 @@ OUString BaseResultSet::getString( sal_Int32 columnIndex ) throw (SQLException,
MutexGuard guard(m_refMutex->mutex);
checkClosed();
checkColumnIndex( columnIndex );
- checkRowIndex( true /* must be on row */ );
+ checkRowIndex();
OUString ret;
convertTo( getValue( columnIndex ), cppu::UnoType<decltype(ret)>::get() ) >>= ret;
// printf( "BaseResultSet::getString() %s\n" , OUStringToOString( ret, RTL_TEXTENCODING_ASCII_US ).getStr() );
@@ -448,7 +448,7 @@ sal_Int32 BaseResultSet::getInt( sal_Int32 columnIndex )
MutexGuard guard( m_refMutex->mutex );
checkClosed();
checkColumnIndex( columnIndex );
- checkRowIndex( true /* must be on row */ );
+ checkRowIndex();
sal_Int32 i = 0;
convertTo( getValue( columnIndex ), cppu::UnoType<decltype(i)>::get()) >>= i;
return i;
@@ -460,7 +460,7 @@ sal_Int64 BaseResultSet::getLong( sal_Int32 columnIndex )
MutexGuard guard( m_refMutex->mutex );
checkClosed();
checkColumnIndex( columnIndex );
- checkRowIndex( true /* must be on row */ );
+ checkRowIndex();
sal_Int64 i = 0;
convertTo( getValue( columnIndex ), cppu::UnoType<decltype(i)>::get()) >>= i;
return i;
@@ -472,7 +472,7 @@ float BaseResultSet::getFloat( sal_Int32 columnIndex )
MutexGuard guard( m_refMutex->mutex );
checkClosed();
checkColumnIndex( columnIndex );
- checkRowIndex( true /* must be on row */ );
+ checkRowIndex();
float f = 0.;
convertTo( getValue( columnIndex ), cppu::UnoType<decltype(f)>::get()) >>= f;
return f;
@@ -495,7 +495,7 @@ Sequence< sal_Int8 > BaseResultSet::getBytes( sal_Int32 columnIndex )
MutexGuard guard( m_refMutex->mutex );
checkClosed();
checkColumnIndex( columnIndex );
- checkRowIndex( true /* must be on row */ );
+ checkRowIndex();
Sequence< sal_Int8 > ret;
OUString ustr;
@@ -666,31 +666,17 @@ void BaseResultSet::checkColumnIndex(sal_Int32 index ) throw ( SQLException, Run
}
-void BaseResultSet::checkRowIndex( bool mustBeOnValidRow )
+void BaseResultSet::checkRowIndex()
{
- OUStringBuffer buf( 128 );
- buf.append( "pq_baseresultset: row index out of range, allowed is " );
- if( mustBeOnValidRow )
+ if( m_row < 0 || m_row >= m_rowCount )
{
- if( m_row < 0 || m_row >= m_rowCount )
- {
- buf.append( "0 to " );
- buf.append( ((sal_Int32)(m_rowCount -1)) );
- buf.append( ", got " );
- buf.append( m_row );
- throw SQLException( buf.makeStringAndClear(), *this, OUString(),1, Any() );
- }
- }
- else
- {
- if( m_row < -1 || m_row > m_rowCount )
- {
- buf.append( "-1 to " );
- buf.append( m_rowCount );
- buf.append( ", got " );
- buf.append( m_row );
- throw SQLException( buf.makeStringAndClear(), *this, OUString(),1, Any() );
- }
+ OUStringBuffer buf( 128 );
+ buf.append( "pq_baseresultset: row index out of range, allowed is " );
+ buf.append( "0 to " );
+ buf.append( ((sal_Int32)(m_rowCount -1)) );
+ buf.append( ", got " );
+ buf.append( m_row );
+ throw SQLException( buf.makeStringAndClear(), *this, OUString(),1, Any() );
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_baseresultset.hxx b/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
index 340126b009f6..ad3a6e6a7b0e 100644
--- a/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
+++ b/connectivity/source/drivers/postgresql/pq_baseresultset.hxx
@@ -85,7 +85,7 @@ protected:
throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException ) = 0;
void checkColumnIndex( sal_Int32 index )
throw ( com::sun::star::sdbc::SQLException, com::sun::star::uno::RuntimeException );
- void checkRowIndex( bool mustBeOnValidRow );
+ void checkRowIndex();
virtual ::com::sun::star::uno::Any getValue( sal_Int32 columnIndex ) = 0;
com::sun::star::uno::Any convertTo(