Skip to content

Commit

Permalink
include key= field in all postgres data source uris (only for views b…
Browse files Browse the repository at this point in the history
…efore)

git-svn-id: http://svn.osgeo.org/qgis/trunk@12369 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 8, 2009
1 parent dba9cab commit 1077ec7
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/providers/postgres/qgspostgresprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
if ( mCurrentSchema == mSchemaName )
{
mUri.clearSchema();
setDataSourceUri( mUri.uri() );
}

if ( mSchemaName == "" )
mSchemaName = mCurrentSchema;

Expand Down Expand Up @@ -250,6 +250,11 @@ QgsPostgresProvider::QgsPostgresProvider( QString const & uri )
{
valid = false;
}
else
{
mUri.setKeyColumn( primaryKey );
setDataSourceUri( mUri.uri() );
}

// Close the database connection if the layer isn't going to be loaded.
if ( !valid )
Expand Down Expand Up @@ -1097,9 +1102,6 @@ QString QgsPostgresProvider::getPrimaryKey()
// From the view columns, choose one for which the underlying
// column is suitable for use as a key into the view.
primaryKey = chooseViewColumn( cols );

mUri.setKeyColumn( primaryKey );
setDataSourceUri( mUri.uri() );
}
}
else
Expand Down Expand Up @@ -3159,9 +3161,6 @@ QString QgsPostgresProvider::description() const
return POSTGRES_DESCRIPTION;
} // QgsPostgresProvider::description()




/**
* Class factory to return a pointer to a newly created
* QgsPostgresProvider object
Expand Down

0 comments on commit 1077ec7

Please sign in to comment.