List:Commits« Previous MessageNext Message »
From:bar Date:April 17 2006 8:49am
Subject:bk commit into 5.1 tree (bar:1.2347) BUG#18170
View as plain text  
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.2347 06/04/17 11:49:20 bar@stripped +3 -0
  Bug#18170: XML: ExtractValue(): XPath expression can't use QNames (colon in names)
  
  Problem source:
  Qualified names (aka QName) didn't work as tag names and attribute names,
  because the parser lacked a real rule to scan QName, so it understood
  only non-qualified names without prefixes.
  
  Solution:
  New rule was added to check both "ident" and "ident:ident" sequences.

  sql/item_xmlfunc.cc
    1.14 06/04/17 11:49:04 bar@stripped +25 -1
    Adding real QName parser rule and using it in NodeTest rule.

  mysql-test/t/xml.test
    1.13 06/04/17 11:49:04 bar@stripped +8 -0
    Adding test case

  mysql-test/r/xml.result
    1.13 06/04/17 11:49:03 bar@stripped +9 -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.b18170

--- 1.12/mysql-test/r/xml.result	2006-04-11 17:12:19 +05:00
+++ 1.13/mysql-test/r/xml.result	2006-04-17 11:49:03 +05:00
@@ -641,3 +641,12 @@ CALL p2();
 EXTRACTVALUE(p,'/Ñ/r')
 A
 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

--- 1.12/mysql-test/t/xml.test	2006-04-11 17:12:19 +05:00
+++ 1.13/mysql-test/t/xml.test	2006-04-17 11:49:04 +05:00
@@ -321,3 +321,11 @@ END//
 DELIMITER ;//
 CALL 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');

--- 1.13/sql/item_xmlfunc.cc	2006-04-11 13:24:50 +05:00
+++ 1.14/sql/item_xmlfunc.cc	2006-04-17 11:49:04 +05:00
@@ -2267,6 +2267,30 @@ static int my_xpath_parse_Number(MY_XPAT
 
 
 /*
+  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
 
   SYNOPSYS
@@ -2299,7 +2323,7 @@ my_xpath_parse_VariableReference(MY_XPAT
 static int
 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;
   DBUG_ASSERT(xpath->context);
   uint len= xpath->prevtok.end - xpath->prevtok.beg;
Thread
bk commit into 5.1 tree (bar:1.2347) BUG#18170bar17 Apr