Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
postgres: consider subset string when deleting, updating and retrievi…
…ng by fid

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11770 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 8, 2009
1 parent 0729c44 commit aede963
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -685,14 +685,26 @@ bool QgsPostgresProvider::nextFeature( QgsFeature& feature )

QString QgsPostgresProvider::whereClause( int featureId ) const
{
QString whereClause;

if ( primaryKeyType != "tid" )
{
return QString( "%1=%2" ).arg( quotedIdentifier( primaryKey ) ).arg( featureId );
whereClause = QString( "%1=%2" ).arg( quotedIdentifier( primaryKey ) ).arg( featureId );
}
else
{
return QString( "%1='(%2,%3)'" ).arg( quotedIdentifier( primaryKey ) ).arg( featureId >> 16 ).arg( featureId & 0xffff );
whereClause = QString( "%1='(%2,%3)'" ).arg( quotedIdentifier( primaryKey ) ).arg( featureId >> 16 ).arg( featureId & 0xffff );
}

if ( !sqlWhereClause.isEmpty() )
{
if ( !whereClause.isEmpty() )
whereClause += " and ";

whereClause += "(" + sqlWhereClause + ")";
}

return whereClause;
}

bool QgsPostgresProvider::featureAtId( int featureId, QgsFeature& feature, bool fetchGeometry, QgsAttributeList fetchAttributes )
Expand Down

0 comments on commit aede963

Please sign in to comment.