Skip to content
Permalink
Browse files
QgsSQLStatement parser: emit more relevant error message (fixes #42985)
  • Loading branch information
rouault authored and nyalldawson committed May 23, 2021
1 parent d6d1b45 commit 9f1c77bc7df2fe955c0f685740bb42357be52a45
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 9f1c77b

Please sign in to comment.