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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
423f1340
Commit
423f1340
authored
Feb 17, 2006
by
unknown
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.16234
parents
36a0a13d
c7367087
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
1 deletion
+44
-1
mysql-test/r/xml.result
mysql-test/r/xml.result
+22
-0
mysql-test/t/xml.test
mysql-test/t/xml.test
+16
-0
sql/item_xmlfunc.cc
sql/item_xmlfunc.cc
+6
-1
No files found.
mysql-test/r/xml.result
View file @
423f1340
...
...
@@ -520,3 +520,25 @@ UpdateXML(@xml, '/a/b/@bb2', '')
select UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"');
UpdateXML(@xml, '/a/b/@bb2', 'bb3="bb3"')
<a aa1="aa1" aa2="aa2"><b bb1="bb1" bb3="bb3">bb</b></a>
SET @xml= '<order><clerk>lesser wombat</clerk></order>';
select extractvalue(@xml,'order/clerk');
extractvalue(@xml,'order/clerk')
lesser wombat
select extractvalue(@xml,'/order/clerk');
extractvalue(@xml,'/order/clerk')
lesser wombat
select extractvalue('<a><b>B</b></a>','/a|/b');
extractvalue('<a><b>B</b></a>','/a|/b')
select extractvalue('<a><b>B</b></a>','/a|b');
extractvalue('<a><b>B</b></a>','/a|b')
select extractvalue('<a>a<b>B</b></a>','/a|/b');
extractvalue('<a>a<b>B</b></a>','/a|/b')
a
select extractvalue('<a>a<b>B</b></a>','/a|b');
extractvalue('<a>a<b>B</b></a>','/a|b')
a
select extractvalue('<a>a<b>B</b></a>','a|/b');
extractvalue('<a>a<b>B</b></a>','a|/b')
a
mysql-test/t/xml.test
View file @
423f1340
...
...
@@ -215,3 +215,19 @@ select UpdateXML(@xml, '/a/b/@bb1', '');
select
UpdateXML
(
@
xml
,
'/a/b/@bb1'
,
'bb3="bb3"'
);
select
UpdateXML
(
@
xml
,
'/a/b/@bb2'
,
''
);
select
UpdateXML
(
@
xml
,
'/a/b/@bb2'
,
'bb3="bb3"'
);
#
# Bug#16234 XML: Crash if ExtractValue()
#
SET
@
xml
=
'<order><clerk>lesser wombat</clerk></order>'
;
select
extractvalue
(
@
xml
,
'order/clerk'
);
select
extractvalue
(
@
xml
,
'/order/clerk'
);
#
# Bug#16314 XML: extractvalue() crash if vertical bar
#
select
extractvalue
(
'<a><b>B</b></a>'
,
'/a|/b'
);
select
extractvalue
(
'<a><b>B</b></a>'
,
'/a|b'
);
select
extractvalue
(
'<a>a<b>B</b></a>'
,
'/a|/b'
);
select
extractvalue
(
'<a>a<b>B</b></a>'
,
'/a|b'
);
select
extractvalue
(
'<a>a<b>B</b></a>'
,
'a|/b'
);
sql/item_xmlfunc.cc
View file @
423f1340
...
...
@@ -101,6 +101,7 @@ typedef struct my_xpath_st
MY_XPATH_FUNC
*
func
;
/* last scanned function creator */
Item
*
item
;
/* current expression */
Item
*
context
;
/* last scanned context */
Item
*
rootelement
;
/* The root element */
String
*
context_cache
;
/* last context provider */
String
*
pxml
;
/* Parsed XML, an array of MY_XML_NODE */
CHARSET_INFO
*
cs
;
/* character set/collation string comparison */
...
...
@@ -1464,6 +1465,8 @@ static int my_xpath_parse_LocationPath(MY_XPATH *xpath)
{
Item
*
context
=
xpath
->
context
;
if
(
!
xpath
->
context
)
xpath
->
context
=
xpath
->
rootelement
;
int
rc
=
my_xpath_parse_RelativeLocationPath
(
xpath
)
||
my_xpath_parse_AbsoluteLocationPath
(
xpath
);
...
...
@@ -1496,7 +1499,7 @@ static int my_xpath_parse_AbsoluteLocationPath(MY_XPATH *xpath)
if
(
!
my_xpath_parse_term
(
xpath
,
MY_XPATH_LEX_SLASH
))
return
0
;
xpath
->
context
=
new
Item_nodeset_func_rootelement
(
xpath
->
pxml
)
;
xpath
->
context
=
xpath
->
rootelement
;
if
(
my_xpath_parse_term
(
xpath
,
MY_XPATH_LEX_SLASH
))
{
...
...
@@ -2292,6 +2295,8 @@ my_xpath_parse(MY_XPATH *xpath, const char *str, const char *strend)
my_xpath_lex_init
(
&
xpath
->
prevtok
,
str
,
strend
);
my_xpath_lex_scan
(
xpath
,
&
xpath
->
lasttok
,
str
,
strend
);
xpath
->
rootelement
=
new
Item_nodeset_func_rootelement
(
xpath
->
pxml
);
return
my_xpath_parse_Expr
(
xpath
)
&&
my_xpath_parse_term
(
xpath
,
MY_XPATH_LEX_EOF
);
...
...
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