Skip to content

Commit 9157173

Browse files
committed
Make expression compilation optional, but enabled by default
Remove the previous postgres specific option and replace with an enabled-by-default option which applies to all expression compilation.
1 parent 982490f commit 9157173

10 files changed

+79
-268
lines changed

src/app/qgsoptions.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,7 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl ) :
575575
cbxSnappingOptionsDocked->setChecked( settings.value( "/qgis/dockSnapping", false ).toBool() );
576576
cbxAddPostgisDC->setChecked( settings.value( "/qgis/addPostgisDC", false ).toBool() );
577577
cbxAddOracleDC->setChecked( settings.value( "/qgis/addOracleDC", false ).toBool() );
578-
cbxCompileExpressions->setChecked( settings.value( "/qgis/postgres/compileExpressions", false ).toBool() );
578+
cbxCompileExpressions->setChecked( settings.value( "/qgis/compileExpressions", true ).toBool() );
579579
cbxCreateRasterLegendIcons->setChecked( settings.value( "/qgis/createRasterLegendIcons", false ).toBool() );
580580
cbxCopyWKTGeomFromTable->setChecked( settings.value( "/qgis/copyGeometryAsWKT", true ).toBool() );
581581
leNullValue->setText( settings.value( "qgis/nullValue", "NULL" ).toString() );
@@ -1102,7 +1102,7 @@ void QgsOptions::saveOptions()
11021102
settings.setValue( "/qgis/dockSnapping", cbxSnappingOptionsDocked->isChecked() );
11031103
settings.setValue( "/qgis/addPostgisDC", cbxAddPostgisDC->isChecked() );
11041104
settings.setValue( "/qgis/addOracleDC", cbxAddOracleDC->isChecked() );
1105-
settings.setValue( "/qgis/postgres/compileExpressions", cbxCompileExpressions->isChecked() );
1105+
settings.setValue( "/qgis/compileExpressions", cbxCompileExpressions->isChecked() );
11061106
settings.setValue( "/qgis/defaultLegendGraphicResolution", mLegendGraphicResolutionSpinBox->value() );
11071107
bool createRasterLegendIcons = settings.value( "/qgis/createRasterLegendIcons", false ).toBool();
11081108
settings.setValue( "/qgis/createRasterLegendIcons", cbxCreateRasterLegendIcons->isChecked() );

src/providers/ogr/qgsogrfeatureiterator.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ QgsOgrFeatureIterator::QgsOgrFeatureIterator( QgsOgrFeatureSource* source, bool
8484
OGR_L_SetSpatialFilter( ogrLayer, 0 );
8585
}
8686

87-
if ( request.filterType() == QgsFeatureRequest::FilterExpression )
87+
if ( request.filterType() == QgsFeatureRequest::FilterExpression
88+
&& QSettings().value( "/qgis/compileExpressions", true ).toBool() )
8889
{
8990
QgsOgrExpressionCompiler compiler = QgsOgrExpressionCompiler( source );
9091

src/providers/ogr/qgsogrprovider.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2577,7 +2577,8 @@ QString QgsOgrUtils::quotedValue( const QVariant& value )
25772577
return value.toString();
25782578

25792579
case QVariant::Bool:
2580-
return value.toBool() ? "TRUE" : "FALSE";
2580+
//OGR does not support boolean literals
2581+
return value.toBool() ? "1" : "0";
25812582

25822583
default:
25832584
case QVariant::String:

src/providers/postgres/qgspostgresfeatureiterator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
7777
whereClause = QgsPostgresUtils::andWhereClauses( whereClause, fidsWhereClause );
7878
}
7979
else if ( request.filterType() == QgsFeatureRequest::FilterExpression
80-
&& QSettings().value( "/qgis/postgres/compileExpressions", false ).toBool() )
80+
&& QSettings().value( "/qgis/compileExpressions", true ).toBool() )
8181
{
8282
QgsPostgresExpressionCompiler compiler = QgsPostgresExpressionCompiler( source );
8383

src/providers/spatialite/qgsspatialitefeatureiterator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
#include "qgslogger.h"
2323
#include "qgsmessagelog.h"
24-
25-
24+
#include <QSettings>
2625

2726
QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeatureSource* source, bool ownSource, const QgsFeatureRequest& request )
2827
: QgsAbstractFeatureIteratorFromSource<QgsSpatiaLiteFeatureSource>( source, ownSource, request )
@@ -64,7 +63,8 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature
6463
whereClauses.append( whereClause );
6564
}
6665
}
67-
else if ( request.filterType() == QgsFeatureRequest::FilterExpression )
66+
else if ( request.filterType() == QgsFeatureRequest::FilterExpression
67+
&& QSettings().value( "/qgis/compileExpressions", true ).toBool() )
6868
{
6969
QgsSpatiaLiteExpressionCompiler compiler = QgsSpatiaLiteExpressionCompiler( source );
7070

0 commit comments

Comments
 (0)