Skip to content

Commit 115f980

Browse files
committedFeb 24, 2014
oracle provider: replace rownum=0 with 1=0 to retrieve columns (fixes #9633)
1 parent e75170c commit 115f980

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/providers/oracle/qgsoracleprovider.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ bool QgsOracleProvider::loadFields()
697697
mEnabledCapabilities |= QgsVectorDataProvider::CreateSpatialIndex;
698698
}
699699

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

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

1895-
sql += "rownum=0";
1895+
sql += "1=0";
18961896

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

0 commit comments

Comments
 (0)