Skip to content
Permalink
Browse files

[oracle] Remove meaningless conditional and improve user input handling

(cherry-pick from commit 4ab377b)

Author :     Björn Harrtell <bjorn@wololo.org>
Date :       Wed Oct 31 14:45:37 2018 +0100
  • Loading branch information
bjornharrtell authored and rldhont committed Oct 31, 2018
1 parent 8a8a741 commit 0e066db97b939f809a352c661724057b63f0178a
Showing with 23 additions and 24 deletions.
  1. +23 −24 src/providers/oracle/ocispatial/qsql_ocispatial.cpp
@@ -415,28 +415,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( "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,
@@ -3379,15 +3374,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 0e066db

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