Skip to content
Permalink
Browse files

oracle provider: replace rownum=0 with 1=0 to retrieve columns (fixes #…

  • Loading branch information
jef-n committed Feb 24, 2014
1 parent e75170c commit 115f9807f10f168b4abd0c0dba5b82d15a426027
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/providers/oracle/qgsoracleprovider.cpp
@@ -697,7 +697,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;
@@ -826,7 +826,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() )
@@ -1892,7 +1892,7 @@ bool QgsOracleProvider::setSubsetString( QString theSQL, bool updateFeatureCount
sql += "(" + mSqlWhereClause + ") AND ";
}

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

QSqlQuery qry( *mConnection );
if ( !exec( qry, sql ) )
@@ -2060,7 +2060,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() )

0 comments on commit 115f980

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