diff options
author | unknown <hery.ramilison@oracle.com> | 2011-07-06 01:13:50 +0200 |
---|---|---|
committer | MySQL Release Engineering <mysql-re_ww@oracle.com> | 2011-07-06 01:13:50 +0200 |
commit | 7d605ec45f8e55e1775fd028931c459e6501d25a (patch) | |
tree | 31e14059cf5a1e5e8c1601a2488b98c4af1bfeb0 /sql/item_xmlfunc.cc | |
parent | 8f73e64fff57fe4080cfc4d2816555b0d22b9e13 (diff) | |
parent | 8b1566aaaf93e6e885badd6500a07a0f70cc81f3 (diff) | |
download | mariadb-git-7d605ec45f8e55e1775fd028931c459e6501d25a.tar.gz |
Merge from mysql-5.5.14-release
Diffstat (limited to 'sql/item_xmlfunc.cc')
-rw-r--r-- | sql/item_xmlfunc.cc | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index b141ff5ec80..79773095515 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -1973,6 +1973,9 @@ static int my_xpath_parse_UnionExpr(MY_XPATH *xpath) static int my_xpath_parse_FilterExpr_opt_slashes_RelativeLocationPath(MY_XPATH *xpath) { + Item *context= xpath->context; + int rc; + if (!my_xpath_parse_FilterExpr(xpath)) return 0; @@ -1986,8 +1989,22 @@ my_xpath_parse_FilterExpr_opt_slashes_RelativeLocationPath(MY_XPATH *xpath) return 0; } - my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH); - return my_xpath_parse_RelativeLocationPath(xpath); + /* + The context for the next relative path is the nodeset + returned by FilterExpr + */ + xpath->context= xpath->item; + + /* treat double slash (//) as /descendant-or-self::node()/ */ + if (my_xpath_parse_term(xpath, MY_XPATH_LEX_SLASH)) + xpath->context= new Item_nodeset_func_descendantbyname(xpath->context, + "*", 1, xpath->pxml, 1); + rc= my_xpath_parse_RelativeLocationPath(xpath); + + /* push back the context and restore the item */ + xpath->item= xpath->context; + xpath->context= context; + return rc; } static int my_xpath_parse_PathExpr(MY_XPATH *xpath) { |