Skip to content

Commit

Permalink
Merge pull request #34309 from elpaso/bugfixgh-gh34259-filter-express…
Browse files Browse the repository at this point in the history
…ion-with-errors

Fix test message from query builder on errors
  • Loading branch information
elpaso committed Feb 5, 2020
2 parents e0615d4 + 5d8c4f8 commit f8d863c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/gui/qgsquerybuilder.cpp
Expand Up @@ -218,9 +218,20 @@ void QgsQueryBuilder::test()
{
mUseUnfilteredLayer->setDisabled( mLayer->subsetString().isEmpty() );

QMessageBox::information( this,
tr( "Query Result" ),
tr( "The where clause returned %n row(s).", "returned test rows", mLayer->featureCount() ) );
const long featureCount { mLayer->featureCount() };
// Check for errors
if ( featureCount < 0 )
{
QMessageBox::warning( this,
tr( "Query Result" ),
tr( "An error occurred when executing the query, please check the expression syntax." ) );
}
else
{
QMessageBox::information( this,
tr( "Query Result" ),
tr( "The where clause returned %n row(s).", "returned test rows", featureCount ) );
}
}
else if ( mLayer->dataProvider()->hasErrors() )
{
Expand Down

0 comments on commit f8d863c

Please sign in to comment.