diff options
author | unknown <bar@mysql.com/bar.intranet.mysql.r18.ru> | 2006-09-14 11:47:19 +0500 |
---|---|---|
committer | unknown <bar@mysql.com/bar.intranet.mysql.r18.ru> | 2006-09-14 11:47:19 +0500 |
commit | 32ede45dd416e3ddbcf26ed0704cd86886f5bbd4 (patch) | |
tree | dc4747cdb58f41bf99ee390562be5094d0e63af3 /mysql-test | |
parent | 9e89ea6fa8734c2538a416b29fc3120447f6b733 (diff) | |
download | mariadb-git-32ede45dd416e3ddbcf26ed0704cd86886f5bbd4.tar.gz |
Bug#20854 XML functions: wrong result in ExtractValue
mysql-test/r/xml.result:
- Adding test case
- Fixing error message
mysql-test/t/xml.test:
Adding test case
sql/item_xmlfunc.cc:
For grammar rules with loops like:
AdditiveExpr ::= MultiplicativeExpr ('+' MultiplicativeExpr)*
If we scanned scanned '+' and then met an error when parsing
MultiplicativeExpr, then we should fully stop parsing - without
trying to apply any other rules.
Fix: add "error" member into MY_XPATH structure,
and make my_xpath_parse_term() never return success
as soon as error set.
strings/xml.c:
Adding my_xml_ctype map for flags, indicating
whether a character is a space character, is a
valid identifier start character, is a valid
identifier body character. Using this map to
properly scan identifiers. Also, using this map
to scan spaces faster (instead of strchr).
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/r/xml.result | 28 | ||||
-rw-r--r-- | mysql-test/t/xml.test | 16 |
2 files changed, 43 insertions, 1 deletions
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 780be01d7ce..efe7d14095d 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -570,7 +570,7 @@ select extractvalue('<a>a<b>B</b></a>','a|/b'); extractvalue('<a>a<b>B</b></a>','a|/b') a select extractvalue('<a>A</a>','/<a>'); -ERROR HY000: XPATH syntax error: '<a>' +ERROR HY000: XPATH error: comparison of two nodesets is not supported: '<a>' select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!'); ERROR HY000: XPATH syntax error: '!' select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*'); @@ -710,3 +710,29 @@ Data select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something'); extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something') Otherdata +select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','/zot/tim0/02'); +ERROR HY000: XPATH syntax error: '02' +select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','//*'); +extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','//*') +NULL +Warnings: +Warning 1512 Incorrect XML value: 'parse error at line 1 pos 13: unknown token unexpected (ident or '/' wanted)' +select extractValue('<.>test</.>','//*'); +extractValue('<.>test</.>','//*') +NULL +Warnings: +Warning 1512 Incorrect XML value: 'parse error at line 1 pos 2: unknown token unexpected (ident or '/' wanted)' +select extractValue('<->test</->','//*'); +extractValue('<->test</->','//*') +NULL +Warnings: +Warning 1512 Incorrect XML value: 'parse error at line 1 pos 2: unknown token unexpected (ident or '/' wanted)' +select extractValue('<:>test</:>','//*'); +extractValue('<:>test</:>','//*') +test +select extractValue('<_>test</_>','//*'); +extractValue('<_>test</_>','//*') +test +select extractValue('<x.-_:>test</x.-_:>','//*'); +extractValue('<x.-_:>test</x.-_:>','//*') +test diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index d510a61f04d..3347573b4b7 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -360,3 +360,19 @@ select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@x # select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/foo.bar'); select extractValue('<foo><foo.bar>Data</foo.bar><something>Otherdata</something></foo>','/foo/something'); + +# +# Bug#20854 XML functions: wrong result in ExtractValue +# +--error 1105 +select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','/zot/tim0/02'); +select extractValue('<zot><tim0><01>10:39:15</01><02>140</02></tim0></zot>','//*'); +# dot and dash are bad identtifier start character +select extractValue('<.>test</.>','//*'); +select extractValue('<->test</->','//*'); +# semicolon is good identifier start character +select extractValue('<:>test</:>','//*'); +# underscore is good identifier start character +select extractValue('<_>test</_>','//*'); +# dot, dash, underscore and semicolon are good identifier middle characters +select extractValue('<x.-_:>test</x.-_:>','//*'); |