Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
9e47ae44
Commit
9e47ae44
authored
Mar 02, 2006
by
bar@mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into mysql.com:/usr/home/bar/mysql-5.1-new.16315
parents
46e6914d
47b4f007
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
0 deletions
+47
-0
mysql-test/r/xml.result
mysql-test/r/xml.result
+12
-0
mysql-test/t/xml.test
mysql-test/t/xml.test
+6
-0
sql/item_xmlfunc.cc
sql/item_xmlfunc.cc
+29
-0
No files found.
mysql-test/r/xml.result
View file @
9e47ae44
...
...
@@ -65,6 +65,9 @@ c1
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 @@ select extractvalue('<a>A</a>','/<a>');
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
mysql-test/t/xml.test
View file @
9e47ae44
...
...
@@ -23,6 +23,7 @@ SELECT extractValue(@xml,'/*/*');
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>A</a>','/<a>');
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'
);
sql/item_xmlfunc.cc
View file @
9e47ae44
...
...
@@ -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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment