Skip to content
Permalink
Browse files
postgres: consider subset string when deleting, updating and retrievi…
…ng by fid

git-svn-id: http://svn.osgeo.org/qgis/trunk@11770 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 8, 2009
1 parent d726cb9 commit 2642450bd216ccf8b01d1a239e603678665c2baf
Showing with 14 additions and 2 deletions.
  1. +14 −2 src/providers/postgres/qgspostgresprovider.cpp
@@ -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 )

0 comments on commit 2642450

Please sign in to comment.