Skip to content

Commit 912b9b8

Browse files
author
jef
committed
fix #2036
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11861 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 3fbfd0d commit 912b9b8

File tree

6 files changed

+18
-1
lines changed

6 files changed

+18
-1
lines changed

python/core/qgsdataprovider.sip

+5
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ class QgsDataProvider : QObject
6666
*/
6767
virtual bool setSubsetString(QString subset);
6868

69+
/**
70+
* provider supports setting of subset strings
71+
* @note added in 1.4
72+
*/
73+
virtual bool supportsSubsetString();
6974

7075
/**
7176
* Returns the subset definition string (typically sql) currently in

src/app/qgsvectorlayerproperties.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ void QgsVectorLayerProperties::reset( void )
438438
// on the builder. If the ability to enter a query directly into the box is required,
439439
// a mechanism to check it must be implemented.
440440
txtSubsetSQL->setEnabled( false );
441-
pbnQueryBuilder->setEnabled( true );
441+
pbnQueryBuilder->setEnabled( layer && layer->dataProvider() && layer->dataProvider()->supportsSubsetString() );
442442

443443
//get field list for display field combo
444444
const QgsFieldMap& myFields = layer->pendingFields();

src/core/qgsdataprovider.h

+6
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ class CORE_EXPORT QgsDataProvider : public QObject
121121
}
122122

123123

124+
/**
125+
* provider supports setting of subset strings
126+
* @note added in 1.4
127+
*/
128+
virtual bool supportsSubsetString() { return false; }
129+
124130
/**
125131
* Returns the subset definition string (typically sql) currently in
126132
* use by the layer and used by the provider to limit the feature set.

src/providers/ogr/qgsogrprovider.h

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ class QgsOgrProvider : public QgsVectorDataProvider
9595
/** Accessor for sql where clause used to limit dataset */
9696
virtual QString subsetString();
9797

98+
virtual bool supportsSubsetString() { return true; }
99+
98100
/** mutator for sql where clause used to limit dataset size */
99101
virtual bool setSubsetString( QString theSQL );
100102

src/providers/postgres/qgspostgresprovider.h

+2
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ class QgsPostgresProvider : public QgsVectorDataProvider
255255
/** mutator for sql where clause used to limit dataset size */
256256
bool setSubsetString( QString theSQL );
257257

258+
virtual bool supportsSubsetString() { return true; }
259+
258260
/**Returns a bitmask containing the supported capabilities*/
259261
int capabilities() const;
260262

src/providers/spatialite/qgsspatialiteprovider.h

+2
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ class QgsSpatiaLiteProvider: public QgsVectorDataProvider
8181
/** mutator for sql where clause used to limit dataset size */
8282
virtual bool setSubsetString( QString theSQL );
8383

84+
virtual bool supportsSubsetString() { return true; }
85+
8486
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
8587
* @param fetchAttributes list of attributes which should be fetched
8688
* @param rect spatial filter

0 commit comments

Comments
 (0)