postgres: consider subset string when deleting, updating and retrieving by fid

git-svn-id: http://svn.osgeo.org/qgis/trunk@11770 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2009-10-08 13:03:14 +00:00
parent d726cb9893
commit 2642450bd2

View File

@ -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 )