Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
workaround for #843
git-svn-id: http://svn.osgeo.org/qgis/trunk@7710 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Dec 3, 2007
1 parent 1e33ab4 commit 7af3426
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/plugins/grass/qgsgrassmodule.cpp
Expand Up @@ -79,10 +79,8 @@
extern "C" {
#include <grass/gis.h>
#include <grass/Vect.h>
// #include <grass/version.h>
}


#include "../../src/providers/grass/qgsgrass.h"
#include "../../src/providers/grass/qgsgrassprovider.h"
#include "qgsgrassattributes.h"
Expand Down Expand Up @@ -2582,8 +2580,21 @@ void QgsGrassModuleGdalInput::updateQgisLayers()
// Construct OGR DSN
QgsDataSourceURI dsUri(provider->dataSourceUri());
uri = "PG:" + dsUri.connInfo();
// which OGR/GRASS combo actually supports schemas?
ogrLayer = dsUri.table();

// FIXME:
// GDAL prepends the schema only to tables that are not in the
// current schema. The default schema is the user schema, if it
// exists or public otherwise.
// So we need to query current_schema() here like GDAL does (see
// OGRPGTableLayer::ReadTableDefinition). But do we want a static
// PostgreSQL depencency here?
// This workaround makes public tables inaccessible, if a
// user schema exists.
if( dsUri.schema()!="public" && dsUri.schema()!=dsUri.username() ) {
ogrLayer = dsUri.schema() + ".";
}

ogrLayer += dsUri.table();
ogrWhere = dsUri.sql();
}
else
Expand Down Expand Up @@ -2633,8 +2644,8 @@ QStringList QgsGrassModuleGdalInput::options()
if ( !mOgrLayerOption.isNull() && mOgrLayers[current].length() > 0 )
{
opt = mOgrLayerOption + "=";
// which OGR/GRASS version actually supports schemas?
#if 1 // GDAL_VERSION_NUM >= 1400 && (GRASS_VERSION_MAJOR>6 || (GRASS_VERSION_MAJOR==6 && GRASS_VERSION_MINOR>=2))
// GDAL 1.4.0 supports schemas (r9998)
#if GDAL_VERSION_NUM >= 1400
opt += mOgrLayers[current];
#else
// Handle older versions of gdal gracefully
Expand Down

0 comments on commit 7af3426

Please sign in to comment.