mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 04:53:01 +01:00
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.
This commit is contained in:
parent
1f30b1525a
commit
bcc72ad04f
3 changed files with 19 additions and 2 deletions
|
@ -544,3 +544,5 @@ extractvalue('<a>a<b>B</b></a>','a|/b')
|
|||
a
|
||||
select extractvalue('<a>A</a>','/<a>');
|
||||
ERROR HY000: XPATH syntax error: '>'
|
||||
select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
|
||||
ERROR HY000: XPATH syntax error: '!'
|
||||
|
|
|
@ -237,3 +237,9 @@ select extractvalue('<a>a<b>B</b></a>','a|/b');
|
|||
#
|
||||
--error 1105
|
||||
select extractvalue('<a>A</a>','/<a>');
|
||||
|
||||
#
|
||||
# Bug#16313 XML: extractvalue() ignores '!' in names
|
||||
#
|
||||
--error 1105
|
||||
select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue