Skip to content
Permalink
Browse files
QgsSQLStatement parser: emit more relevant error message (fixes #42985)
  • Loading branch information
rouault authored and nyalldawson committed May 21, 2021
1 parent c8067ea commit d3dfc64c3461f3880dfaa025ec8c4abda354ee38
Showing with 9 additions and 1 deletion.
  1. +9 −1 src/core/qgssqlstatementparser.yy
@@ -625,7 +625,15 @@ QgsSQLStatement::Node* parse(const QString& str, QString& parserErrorMsg, bool a
}
else // error?
{
parserErrorMsg = !allowFragments && !ctx.rootNode ? QStringLiteral("Expression must begin with SELECT") : ctx.errorMsg;
if( !allowFragments && !ctx.rootNode &&
!str.startsWith("SELECT", Qt::CaseInsensitive) )
{
parserErrorMsg = QObject::tr("Expression must begin with SELECT");
}
else
{
parserErrorMsg = ctx.errorMsg;
}
delete ctx.rootNode;
delete ctx.whereExp;
qDeleteAll(ctx.joinList);

0 comments on commit d3dfc64

Please sign in to comment.