List:Commits« Previous MessageNext Message »
From:bar Date:March 2 2006 6:42am
Subject:bk commit into 5.1 tree (bar:1.2206)
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.2206 06/03/02 10:42:08 bar@stripped +3 -0
  Merge abarkov@stripped:/home/bk/mysql-5.1-new
  into  mysql.com:/usr/home/bar/mysql-5.1-new.16315

  mysql-test/t/xml.test
    1.6 06/03/02 10:42:02 bar@stripped +0 -2
    After merge fix

  mysql-test/r/xml.result
    1.6 06/03/02 10:42:02 bar@stripped +0 -0
    After merge fix

  sql/item_xmlfunc.cc
    1.6 06/03/02 10:37:58 bar@stripped +0 -0
    Auto merged

# 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.16315/RESYNC

--- 1.5/mysql-test/r/xml.result	2006-03-01 10:36:15 +04:00
+++ 1.6/mysql-test/r/xml.result	2006-03-02 10:42:02 +04:00
@@ -65,6 +65,9 @@
 SELECT extractValue(@xml,'/a/child::*');
 extractValue(@xml,'/a/child::*')
 b1 b2
+SELECT extractValue(@xml,'/a/self::*');
+extractValue(@xml,'/a/self::*')
+a1 a2
 SELECT extractValue(@xml,'/a/descendant::*');
 extractValue(@xml,'/a/descendant::*')
 b1 c1 b2
@@ -546,6 +549,15 @@
 ERROR HY000: XPATH syntax error: '>'
 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::*');
+extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*')
+B C
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*');
+extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*')
+A
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*');
+extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*')
+A B C
 select extractvalue('<A_B>A</A_B>','/A_B');
 extractvalue('<A_B>A</A_B>','/A_B')
 A

--- 1.5/mysql-test/t/xml.test	2006-03-01 10:36:15 +04:00
+++ 1.6/mysql-test/t/xml.test	2006-03-02 10:42:02 +04:00
@@ -23,6 +23,7 @@
 SELECT extractValue(@xml,'/*/*/*');
 
 SELECT extractValue(@xml,'/a/child::*');
+SELECT extractValue(@xml,'/a/self::*');
 SELECT extractValue(@xml,'/a/descendant::*');
 SELECT extractValue(@xml,'/a/descendant-or-self::*');
 SELECT extractValue(@xml,'/a/attribute::*');
@@ -245,6 +246,11 @@
 select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
 
 #
+# Bug #16315 XML: extractvalue() handles self badly
+#
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant::*');
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/self::*');
+select extractvalue('<a>A<b>B<c>C</c></b></a>','/a/descendant-or-self::*');
 # Bug #16320 XML: extractvalue() won't accept names containing underscores
 #
 select extractvalue('<A_B>A</A_B>','/A_B');

--- 1.5/sql/item_xmlfunc.cc	2006-03-01 10:36:15 +04:00
+++ 1.6/sql/item_xmlfunc.cc	2006-03-02 10:37:58 +04:00
@@ -252,6 +252,18 @@
 };
 
 
+/* Returns self */
+class Item_nodeset_func_selfbyname: public Item_nodeset_func_axisbyname
+{
+public:
+  Item_nodeset_func_selfbyname(Item *a, const char *n_arg, uint l_arg,
+                                String *pxml): 
+    Item_nodeset_func_axisbyname(a, n_arg, l_arg, pxml) {}
+  const char *func_name() const { return "xpath_selfbyname"; }
+  String *val_nodeset(String *nodeset);
+};
+
+
 /* Returns children */
 class Item_nodeset_func_childbyname: public Item_nodeset_func_axisbyname
 {
@@ -572,6 +584,20 @@
 }
 
 
+String *Item_nodeset_func_selfbyname::val_nodeset(String *nodeset)
+{
+  prepare(nodeset);
+  for (MY_XPATH_FLT *flt= fltbeg; flt < fltend; flt++)
+  {
+    uint pos= 0;
+    MY_XML_NODE *self= &nodebeg[flt->num];
+    if (validname(self))
+      ((XPathFilter*)nodeset)->append_element(flt->num,pos++);
+  }
+  return nodeset;
+}
+
+
 String *Item_nodeset_func_childbyname::val_nodeset(String *nodeset)
 {
   prepare(nodeset);
@@ -944,6 +970,9 @@
     break;
   case MY_XPATH_AXIS_ATTRIBUTE:
     res= new Item_nodeset_func_attributebyname(arg, beg, len, xpath->pxml);
+    break;
+  case MY_XPATH_AXIS_SELF:
+    res= new Item_nodeset_func_selfbyname(arg, beg, len, xpath->pxml);
     break;
   default:
     res= new Item_nodeset_func_childbyname(arg, beg, len, xpath->pxml);
Thread
bk commit into 5.1 tree (bar:1.2206)bar2 Mar