Skip to content

Commit

Permalink
oracle provider: replace rownum=0 with 1=0 to retrieve columns (fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Feb 24, 2014
1 parent 1c3699e commit 122f6cc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/providers/oracle/qgsoracleprovider.cpp
Expand Up @@ -706,7 +706,7 @@ bool QgsOracleProvider::loadFields()
mEnabledCapabilities |= QgsVectorDataProvider::CreateSpatialIndex;
}

if ( !exec( qry, QString( "SELECT * FROM %1 WHERE rownum=0" ).arg( mQuery ) ) )
if ( !exec( qry, QString( "SELECT * FROM %1 WHERE 1=0" ).arg( mQuery ) ) )
{
QgsMessageLog::logMessage( tr( "Retrieving fields from '%1' failed [%2]" ).arg( mQuery ).arg( qry.lastError().text() ), tr( "Oracle" ) );
return false;
Expand Down Expand Up @@ -835,7 +835,7 @@ bool QgsOracleProvider::hasSufficientPermsAndCapabilities()
.arg( mQuery )
.arg( quotedIdentifier( alias ) );

if ( !exec( qry, QString( "SELECT * FROM %1 WHERE rownum=0" ).arg( mQuery ) ) )
if ( !exec( qry, QString( "SELECT * FROM %1 WHERE 1=0" ).arg( mQuery ) ) )
{
QgsMessageLog::logMessage( tr( "Unable to execute the query.\nThe error message from the database was:\n%1.\nSQL: %2" )
.arg( qry.lastError().text() )
Expand Down Expand Up @@ -1906,7 +1906,7 @@ bool QgsOracleProvider::setSubsetString( QString theSQL, bool updateFeatureCount
sql += "(" + mSqlWhereClause + ") AND ";
}

sql += "rownum=0";
sql += "1=0";

QSqlQuery qry( *mConnection );
if ( !exec( qry, sql ) )
Expand Down Expand Up @@ -2074,7 +2074,7 @@ bool QgsOracleProvider::getGeometryDetails()
QSqlQuery qry( *mConnection );
if ( mIsQuery )
{
if ( !exec( qry, QString( "SELECT %1 FROM %2 WHERE rownum=0" ).arg( quotedIdentifier( mGeometryColumn ) ).arg( mQuery ) ) )
if ( !exec( qry, QString( "SELECT %1 FROM %2 WHERE 1=0" ).arg( quotedIdentifier( mGeometryColumn ) ).arg( mQuery ) ) )
{
QgsMessageLog::logMessage( tr( "Could not execute query.\nThe error message from the database was:\n%1.\nSQL: %2" )
.arg( qry.lastError().text() )
Expand Down

0 comments on commit 122f6cc

Please sign in to comment.