Skip to content

Commit

Permalink
fix #2036
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11861 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Oct 28, 2009
1 parent 3fbfd0d commit 912b9b8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions python/core/qgsdataprovider.sip
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ class QgsDataProvider : QObject
*/
virtual bool setSubsetString(QString subset);

/**
* provider supports setting of subset strings
* @note added in 1.4
*/
virtual bool supportsSubsetString();

/**
* Returns the subset definition string (typically sql) currently in
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsvectorlayerproperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ void QgsVectorLayerProperties::reset( void )
// on the builder. If the ability to enter a query directly into the box is required,
// a mechanism to check it must be implemented.
txtSubsetSQL->setEnabled( false );
pbnQueryBuilder->setEnabled( true );
pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() );

//get field list for display field combo
const QgsFieldMap& myFields = layer->pendingFields();
Expand Down
6 changes: 6 additions & 0 deletions src/core/qgsdataprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ class CORE_EXPORT QgsDataProvider : public QObject
}


/**
* provider supports setting of subset strings
* @note added in 1.4
*/
virtual bool supportsSubsetString() { return false; }

/**
* Returns the subset definition string (typically sql) currently in
* use by the layer and used by the provider to limit the feature set.
Expand Down
2 changes: 2 additions & 0 deletions src/providers/ogr/qgsogrprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ class QgsOgrProvider : public QgsVectorDataProvider
/** Accessor for sql where clause used to limit dataset */
virtual QString subsetString();

virtual bool supportsSubsetString() { return true; }

/** mutator for sql where clause used to limit dataset size */
virtual bool setSubsetString( QString theSQL );

Expand Down
2 changes: 2 additions & 0 deletions src/providers/postgres/qgspostgresprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ class QgsPostgresProvider : public QgsVectorDataProvider
/** mutator for sql where clause used to limit dataset size */
bool setSubsetString( QString theSQL );

virtual bool supportsSubsetString() { return true; }

/**Returns a bitmask containing the supported capabilities*/
int capabilities() const;

Expand Down
2 changes: 2 additions & 0 deletions src/providers/spatialite/qgsspatialiteprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
/** mutator for sql where clause used to limit dataset size */
virtual bool setSubsetString( QString theSQL );

virtual bool supportsSubsetString() { return true; }

/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
Expand Down

0 comments on commit 912b9b8

Please sign in to comment.