Skip to content
Permalink
Browse files

Remove meaningless conditional and improve user input handling

(cherry picked from commit 4ab377b)
  • Loading branch information
bjornharrtell authored and jef-n committed Oct 31, 2018
1 parent 247c77d commit f9476fc5297ee6d6f30a6a4bdc45d899573131e1
Showing with 23 additions and 25 deletions.
  1. +23 −25 src/providers/oracle/ocispatial/qsql_ocispatial.cpp
@@ -490,29 +490,23 @@ void QOCISpatialResultPrivate::setStatementAttributes()

int r = OCI_SUCCESS;

if ( prefetchRows >= 0 )
{
r = OCIAttrSet( sql,
OCI_HTYPE_STMT,
&prefetchRows,
0,
OCI_ATTR_PREFETCH_ROWS,
err );
if ( r != OCI_SUCCESS )
qOraWarning( "Couldn't set OCI_ATTR_PREFETCH_ROWS: ", err );
}
if ( prefetchMem >= 0 )
{
r = OCIAttrSet( sql,
OCI_HTYPE_STMT,
&prefetchMem,
0,
OCI_ATTR_PREFETCH_MEMORY,
err );
if ( r != OCI_SUCCESS )
qOraWarning( "QOCISpatialResultPrivate::setStatementAttributes:"
" Couldn't set OCI_ATTR_PREFETCH_MEMORY: ", err );
}
r = OCIAttrSet( sql,
OCI_HTYPE_STMT,
&prefetchRows,
0,
OCI_ATTR_PREFETCH_ROWS,
err );
if ( r != OCI_SUCCESS )
qOraWarning( "Couldn't set OCI_ATTR_PREFETCH_ROWS: ", err );
r = OCIAttrSet( sql,
OCI_HTYPE_STMT,
&prefetchMem,
0,
OCI_ATTR_PREFETCH_MEMORY,
err );
if ( r != OCI_SUCCESS )
qOraWarning( "QOCISpatialResultPrivate::setStatementAttributes:"
" Couldn't set OCI_ATTR_PREFETCH_MEMORY: ", err );
}

int QOCISpatialResultPrivate::bindValue( OCIStmt *sql, OCIBind **hbnd, OCIError *err, int pos,
@@ -3832,15 +3826,19 @@ static void qParseOpts( const QString &options, QOCISpatialDriverPrivate *d )
bool ok;
if ( opt == QLatin1String( "OCI_ATTR_PREFETCH_ROWS" ) )
{
d->prefetchRows = val.toInt( &ok );
int intVal = val.toInt( &ok );
if ( !ok )
d->prefetchRows = QOCISPATIAL_PREFETCH_ROWS;
else if ( intVal >= 0 )
d->prefetchRows = static_cast<ub4>( intVal );
}
else if ( opt == QLatin1String( "OCI_ATTR_PREFETCH_MEMORY" ) )
{
d->prefetchMem = val.toInt( &ok );
int intVal = val.toInt( &ok );
if ( !ok )
d->prefetchMem = QOCISPATIAL_PREFETCH_MEM;
else if ( intVal >= 0 )
d->prefetchMem = static_cast<ub4>( intVal );
}
else
{

0 comments on commit f9476fc

Please sign in to comment.
You can’t perform that action at this time.