summaryrefslogtreecommitdiff
path: root/mysql-test/r/xml.result
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2006-03-03 18:36:14 +0400
committerunknown <bar@mysql.com>2006-03-03 18:36:14 +0400
commit1b0b5617b975df2bb91f749605eec26b5067ad84 (patch)
tree2b26ee2e04c02d466877f00f7d596e6d5541d0ca /mysql-test/r/xml.result
parentea35b4e5e1776ee3b000f4714157f4ece1afa5d3 (diff)
downloadmariadb-git-1b0b5617b975df2bb91f749605eec26b5067ad84.tar.gz
Bug#16318: XML: extractvalue() incorrectly returns last() = 1
xml.result, xml.test: Adding test case. item_xmlfunc.cc: - adding "size" member into MY_XPATH_FLT struct, to pass parent's context size when iterating in a predicate. Previously, temporaty context size was calculated instead, which is always 1. As a result, things like last() and count() didn't work fine. - adding iteration into Item_func_xpath_elementbyindex: similar to Item_func_xpath_predicate. This is to make things like last() and count() work inside square brackets. sql/item_xmlfunc.cc: Bug#16318: XML: extractvalue() incorrectly returns last() = 1 - adding "size" member into MY_XPATH_FLT struct, to pass parent's context size when iterating in a predicate. Previously, temporaty context size was calculated instead, which is always 1. As a result, things like last() and count() didn't work fine. - adding iteration into Item_func_xpath_elementbyindex: similar to Item_func_xpath_predicate. This is to make things like last() and count() work inside square brackets. mysql-test/t/xml.test: Adding test case. mysql-test/r/xml.result: Adding test case.
Diffstat (limited to 'mysql-test/r/xml.result')
-rw-r--r--mysql-test/r/xml.result36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result
index 0b75b50f754..da2e2e400ad 100644
--- a/mysql-test/r/xml.result
+++ b/mysql-test/r/xml.result
@@ -561,3 +561,39 @@ A B C
select extractvalue('<A_B>A</A_B>','/A_B');
extractvalue('<A_B>A</A_B>','/A_B')
A
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[position()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[position()]')
+B1 B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=last()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=last()]')
+B1 B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()]')
+B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()-1]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()-1]')
+B1
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=1]')
+
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=2]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=2]')
+B1 B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=position()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[last()=position()]')
+B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)]')
+B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)-1]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)-1]')
+B1
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=1]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=1]')
+
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=2]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=2]')
+B1 B2
+select extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=position()]');
+extractvalue('<a>A<b>B1</b><b>B2</b></a>','/a/b[count(.)=position()]')
+B2