summaryrefslogtreecommitdiff
path: root/sql/item_xmlfunc.cc
diff options
context:
space:
mode:
authorbar@mysql.com <>2006-03-02 10:42:08 +0400
committerbar@mysql.com <>2006-03-02 10:42:08 +0400
commit9e47ae44a0d7ab7cd0be888fb92ea92c8ed5efa6 (patch)
tree870c8c101fe7f45878a5679e849ae600cb287094 /sql/item_xmlfunc.cc
parent46e6914d827d6cfd367f349db5d0391aa851e3b8 (diff)
parent47b4f007207e1c9d7dd68d3c5fdff01c6191125c (diff)
downloadmariadb-git-9e47ae44a0d7ab7cd0be888fb92ea92c8ed5efa6.tar.gz
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into mysql.com:/usr/home/bar/mysql-5.1-new.16315
Diffstat (limited to 'sql/item_xmlfunc.cc')
-rw-r--r--sql/item_xmlfunc.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc
index 61f7579fa22..26c2e84f8dd 100644
--- a/sql/item_xmlfunc.cc
+++ b/sql/item_xmlfunc.cc
@@ -252,6 +252,18 @@ public:
};
+/* 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_union::val_nodeset(String *nodeset)
}
+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);
@@ -945,6 +971,9 @@ static Item* nametestfunc(MY_XPATH *xpath,
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);
}