Below is the list of changes that have just been committed into a local
5.1 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2284 06/04/06 09:33:04 bar@stripped +4 -0
Bug#16233: XML: ExtractValue() fails with special characters
strings/ctype-simple.c
1.79 06/04/06 09:32:54 bar@stripped +1 -1
A bug fix: ctype is array of 257 elements,
adding offset to address correct element.
sql/item_xmlfunc.cc
1.13 06/04/06 09:32:54 bar@stripped +26 -38
Using recently implemented "true" ctype functionality
to treat all national letters as valid tag names,
Only basic latin letters worked so far.
mysql-test/t/xml.test
1.11 06/04/06 09:32:54 bar@stripped +8 -0
Adding test case
mysql-test/r/xml.result
1.11 06/04/06 09:32:54 bar@stripped +13 -0
Adding test case
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: bar
# Host: bar.intranet.mysql.r18.ru
# Root: /usr/home/bar/mysql-5.1-new.b16233
--- 1.78/strings/ctype-simple.c 2006-03-23 21:40:17 +04:00
+++ 1.79/strings/ctype-simple.c 2006-04-06 09:32:54 +05:00
@@ -1362,7 +1362,7 @@ int my_mb_ctype_8bit(CHARSET_INFO *cs, i
*ctype= 0;
return MY_CS_TOOSMALL;
}
- *ctype= cs->ctype[*s];
+ *ctype= cs->ctype[*s + 1];
return 1;
}
--- 1.10/mysql-test/r/xml.result 2006-03-20 14:53:12 +04:00
+++ 1.11/mysql-test/r/xml.result 2006-04-06 09:32:54 +05:00
@@ -615,3 +615,16 @@ select extractValue('<e>1</e>','last()')
ERROR HY000: XPATH syntax error: ''
select extractValue('<e><a>1</a></e>','/e/');
ERROR HY000: XPATH syntax error: ''
+set names utf8;
+select extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r');
+extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r')
+r
+select extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ');
+extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ')
+Ñ
+select extractValue('<Ñ r="r"/>','/Ñ/@r');
+extractValue('<Ñ r="r"/>','/Ñ/@r')
+r
+select extractValue('<r Ñ="Ñ"/>','/r/@Ñ');
+extractValue('<r Ñ="Ñ"/>','/r/@Ñ')
+Ñ
--- 1.10/mysql-test/t/xml.test 2006-03-20 14:53:06 +04:00
+++ 1.11/mysql-test/t/xml.test 2006-04-06 09:32:54 +05:00
@@ -295,3 +295,11 @@ select extractValue('<e>1</e>','last()')
--error 1105
select extractValue('<e><a>1</a></e>','/e/');
+#
+# Bug#16233: XML: ExtractValue() fails with special characters
+#
+set names utf8;
+select extractValue('<Ñ><r>r</r></Ñ>','/Ñ/r');
+select extractValue('<r><Ñ>Ñ</Ñ></r>','/r/Ñ');
+select extractValue('<Ñ r="r"/>','/Ñ/@r');
+select extractValue('<r Ñ="Ñ"/>','/r/@Ñ');
--- 1.12/sql/item_xmlfunc.cc 2006-03-29 16:27:30 +05:00
+++ 1.13/sql/item_xmlfunc.cc 2006-04-06 09:32:54 +05:00
@@ -1304,30 +1304,6 @@ my_xpath_init(MY_XPATH *xpath)
}
-/*
- Some ctype-alike helper functions. Note, we cannot
- reuse cs->ident_map[], because in Xpath, unlike in SQL,
- dash character is a valid identifier part.
-*/
-static int
-my_xident_beg(int c)
-{
- return (((c) >= 'a' && (c) <= 'z') ||
- ((c) >= 'A' && (c) <= 'Z') ||
- ((c) == '_'));
-}
-
-
-static int
-my_xident_body(int c)
-{
- return (((c) >= 'a' && (c) <= 'z') ||
- ((c) >= 'A' && (c) <= 'Z') ||
- ((c) >= '0' && (c) <= '9') ||
- ((c)=='-') || ((c) == '_'));
-}
-
-
static int
my_xdigit(int c)
{
@@ -1350,7 +1326,7 @@ static void
my_xpath_lex_scan(MY_XPATH *xpath,
MY_XPATH_LEX *lex, const char *beg, const char *end)
{
- int ch;
+ int ch, ctype, length;
for ( ; beg < end && *beg == ' ' ; beg++); // skip leading spaces
lex->beg= beg;
@@ -1360,20 +1336,20 @@ my_xpath_lex_scan(MY_XPATH *xpath,
lex->term= MY_XPATH_LEX_EOF; // end of line reached
return;
}
- ch= *beg++;
-
- if (ch > 0 && ch < 128 && simpletok[ch])
- {
- // a token consisting of one character found
- lex->end= beg;
- lex->term= ch;
- return;
- }
-
- if (my_xident_beg(ch)) // ident, or a function call, or a keyword
+
+ // Check ident, or a function call, or a keyword
+ if ((length= xpath->cs->cset->ctype(xpath->cs, &ctype,
+ (const uchar*) beg,
+ (const uchar*) end)) > 0 &&
+ ((ctype & (_MY_L | _MY_U)) || *beg == '_'))
{
- // scan until the end of the identifier
- for ( ; beg < end && my_xident_body(*beg); beg++);
+ // scan untill the end of the idenfitier
+ for (beg+= length;
+ (length= xpath->cs->cset->ctype(xpath->cs, &ctype,
+ (const uchar*) beg,
+ (const uchar*) end)) > 0 &&
+ ((ctype & (_MY_L | _MY_U | _MY_NMR)) || *beg == '_' || *beg == '-') ;
+ beg+= length);
lex->end= beg;
// check if a function call
@@ -1387,6 +1363,18 @@ my_xpath_lex_scan(MY_XPATH *xpath,
lex->term= my_xpath_keyword(xpath, lex->beg, beg);
return;
}
+
+
+ ch= *beg++;
+
+ if (ch > 0 && ch < 128 && simpletok[ch])
+ {
+ // a token consisting of one character found
+ lex->end= beg;
+ lex->term= ch;
+ return;
+ }
+
if (my_xdigit(ch)) // a sequence of digits
{
| Thread |
|---|
| • bk commit into 5.1 tree (bar:1.2284) BUG#16233 | bar | 6 Apr |