Skip to content
Permalink
Browse files
allow adding features to postgres layers with oid
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 383545cfbd9d5414b8005c2eb56bba7e625a3c17
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/providers/postgres/qgspostgresprovider.cpp
@@ -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
@@ -1308,7 +1308,7 @@ QString QgsPostgresProvider::getPrimaryKey()
if ( PQntuples( oidCheck ) != 0 )
{
primaryKey = "oid";
primaryKeyType = "int4";
primaryKeyType = "oid";
}
else
{
@@ -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";
@@ -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 );

0 comments on commit 383545c

Please sign in to comment.