Skip to content

Commit

Permalink
allow adding features to postgres layers with oid
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13781 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jun 22, 2010
1 parent 0c0c86d commit 383545c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/providers/postgres/qgspostgresprovider.cpp
Expand Up @@ -1142,7 +1142,7 @@ QString QgsPostgresProvider::getPrimaryKey()
// oid isn't indexed (and that they may want to add a
// primary key to the table)
primaryKey = "oid";
primaryKeyType = "int4";
primaryKeyType = "oid";
mIsDbPrimaryKey = true;
}
else
Expand Down Expand Up @@ -1308,7 +1308,7 @@ QString QgsPostgresProvider::getPrimaryKey()
if ( PQntuples( oidCheck ) != 0 )
{
primaryKey = "oid";
primaryKeyType = "int4";
primaryKeyType = "oid";
}
else
{
Expand Down Expand Up @@ -2240,7 +2240,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
.arg( srid );

int offset;
if ( primaryKeyType != "tid" )
if ( primaryKeyType != "tid" && primaryKeyType != "oid" )
{
insert += "," + quotedIdentifier( primaryKey );
values += ",$2";
Expand Down Expand Up @@ -2346,7 +2346,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList &flist )
QStringList params;
params << geomParam;

if ( primaryKeyType != "tid" )
if ( primaryKeyType != "tid" && primaryKeyType != "oid" )
{
int id = paramValue( primaryKeyDefault(), primaryKeyDefault() ).toInt();
params << QString::number( id );
Expand Down

0 comments on commit 383545c

Please sign in to comment.