Commit 20256d8a authored by unknown's avatar unknown

Merge mysql.com:/usr/home/bar/mysql-5.1-new

into  mysql.com:/usr/home/bar/mysql-5.1-new.b18170


mysql-test/r/xml.result:
  Auto merged
mysql-test/t/xml.test:
  Auto merged
sql/item_xmlfunc.cc:
  Auto merged
parents c7a5f503 1a3cb50c
...@@ -665,3 +665,12 @@ CALL p2(); ...@@ -665,3 +665,12 @@ CALL p2();
EXTRACTVALUE(p,'/Ñ/r') EXTRACTVALUE(p,'/Ñ/r')
A A
DROP PROCEDURE p2; DROP PROCEDURE p2;
select extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)');
extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)')
1
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element');
extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element')
a
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns');
extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns')
myns
...@@ -335,3 +335,11 @@ END// ...@@ -335,3 +335,11 @@ END//
DELIMITER ;// DELIMITER ;//
CALL p2(); CALL p2();
DROP PROCEDURE p2; DROP PROCEDURE p2;
#
# Bug#18170: XML: ExtractValue():
# XPath expression can't use QNames (colon in names)
#
select extractValue('<ns:element xmlns:ns="myns"/>','count(ns:element)');
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element');
select extractValue('<ns:element xmlns:ns="myns">a</ns:element>','/ns:element/@xmlns:ns');
...@@ -2280,6 +2280,30 @@ static int my_xpath_parse_Number(MY_XPATH *xpath) ...@@ -2280,6 +2280,30 @@ static int my_xpath_parse_Number(MY_XPATH *xpath)
} }
/*
QName grammar can be found in a separate document
http://www.w3.org/TR/REC-xml-names/#NT-QName
[6] QName ::= (Prefix ':')? LocalPart
[7] Prefix ::= NCName
[8] LocalPart ::= NCName
*/
static int
my_xpath_parse_QName(MY_XPATH *xpath)
{
const char *beg;
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT))
return 0;
beg= xpath->prevtok.beg;
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_COLON))
return 1; /* Non qualified name */
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT))
return 0;
xpath->prevtok.beg= beg;
return 1;
}
/* /*
Scan Variable reference Scan Variable reference
...@@ -2313,7 +2337,7 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath) ...@@ -2313,7 +2337,7 @@ my_xpath_parse_VariableReference(MY_XPATH *xpath)
static int static int
my_xpath_parse_NodeTest_QName(MY_XPATH *xpath) my_xpath_parse_NodeTest_QName(MY_XPATH *xpath)
{ {
if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_IDENT)) if (!my_xpath_parse_QName(xpath))
return 0; return 0;
DBUG_ASSERT(xpath->context); DBUG_ASSERT(xpath->context);
uint len= xpath->prevtok.end - xpath->prevtok.beg; uint len= xpath->prevtok.end - xpath->prevtok.beg;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment