diff options
author | bar@mysql.com <> | 2006-02-28 13:59:16 +0400 |
---|---|---|
committer | bar@mysql.com <> | 2006-02-28 13:59:16 +0400 |
commit | bcc72ad04f2df6aea27550d6389c39d03a29691e (patch) | |
tree | 1bec14b78e774e920471b487216af2d2bec36f3a /sql/item_xmlfunc.cc | |
parent | 1f30b1525ad2f3d22d7373f5785691269be1db5c (diff) | |
download | mariadb-git-bcc72ad04f2df6aea27550d6389c39d03a29691e.tar.gz |
Bug#16313 XML: extractvalue() ignores '!' in names
xml.result, xml.test:
Adding test case.
item_xmlfunc.cc:
Fixed that the "!" character written at the end was ignored.
Now if we try to scan "!=", and if "!" is not
followed by "=", we rollback lex scanner back
to "!" token, so the parser will start to check
the next rule from the "!" character again.
Previously parser started from the next character,
which was EOF in the example in xml.test,
which led to query being successfully parsed,
instead of producing a syntax error.
Diffstat (limited to 'sql/item_xmlfunc.cc')
-rw-r--r-- | sql/item_xmlfunc.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index d86b6acfc56..aad9e12f6c5 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -1976,8 +1976,17 @@ static int my_xpath_parse_AndExpr(MY_XPATH *xpath) */ static int my_xpath_parse_ne(MY_XPATH *xpath) { - return my_xpath_parse_term(xpath, MY_XPATH_LEX_EXCL) && - my_xpath_parse_term(xpath, MY_XPATH_LEX_EQ); + MY_XPATH_LEX prevtok= xpath->prevtok; + if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_EXCL)) + return 0; + if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_EQ)) + { + /* Unget the exclamation mark */ + xpath->lasttok= xpath->prevtok; + xpath->prevtok= prevtok; + return 0; + } + return 1; } static int my_xpath_parse_EqualityOperator(MY_XPATH *xpath) { |