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
3bb9a70f
Commit
3bb9a70f
authored
Apr 01, 2009
by
Georgi Kodinov
Browse files
Options
Browse Files
Download
Plain Diff
auto merge
parents
3030d351
b46dc9ca
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
0 deletions
+58
-0
mysql-test/r/xml.result
mysql-test/r/xml.result
+29
-0
mysql-test/t/xml.test
mysql-test/t/xml.test
+27
-0
sql/item_xmlfunc.cc
sql/item_xmlfunc.cc
+2
-0
No files found.
mysql-test/r/xml.result
View file @
3bb9a70f
...
...
@@ -1064,4 +1064,33 @@ select extractvalue('<a></a>','"b"/a');
ERROR HY000: XPATH syntax error: '/a'
select extractvalue('
<a></a>
','(1)/a');
ERROR HY000: XPATH syntax error: '/a'
CREATE TABLE IF NOT EXISTS t1 (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
xml text,
PRIMARY KEY (id)
) ENGINE=MyISAM;
INSERT INTO t1 (id, xml) VALUES
(15, '
<?xml version="1.0"?>
<bla
name=
"blubb"
></bla>
'),
(14, '
<xml
version=
"kaputt"
>
');
SELECT
extractvalue( xml, '/bla/@name' ),
extractvalue( xml, '/bla/@name' )
FROM t1 ORDER BY t1.id;
extractvalue( xml, '/bla/@name' ) extractvalue( xml, '/bla/@name' )
NULL NULL
blubb blubb
Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
SELECT
UpdateXML(xml, '/bla/@name', 'test'),
UpdateXML(xml, '/bla/@name', 'test')
FROM t1 ORDER BY t1.id;
UpdateXML(xml, '/bla/@name', 'test') UpdateXML(xml, '/bla/@name', 'test')
NULL NULL
<?xml version="1.0"?>
<bla
test
></bla>
<?xml version="1.0"?>
<bla
test
></bla>
Warnings:
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
Warning 1525 Incorrect XML value: 'parse error at line 1 pos 23: unexpected END-OF-INPUT'
DROP TABLE t1;
End of 5.1 tests
mysql-test/t/xml.test
View file @
3bb9a70f
...
...
@@ -590,4 +590,31 @@ select extractvalue('<a></a>','"b"/a');
--
error
ER_UNKNOWN_ERROR
select
extractvalue
(
'<a></a>'
,
'(1)/a'
);
#
# Bug#43183 ExctractValue() brings result list in missorder
#
CREATE
TABLE
IF
NOT
EXISTS
t1
(
id
int
(
10
)
unsigned
NOT
NULL
AUTO_INCREMENT
,
xml
text
,
PRIMARY
KEY
(
id
)
)
ENGINE
=
MyISAM
;
INSERT
INTO
t1
(
id
,
xml
)
VALUES
(
15
,
'<?xml version="1.0"?><bla name="blubb"></bla>'
),
(
14
,
'<xml version="kaputt">'
);
SELECT
extractvalue
(
xml
,
'/bla/@name'
),
extractvalue
(
xml
,
'/bla/@name'
)
FROM
t1
ORDER
BY
t1
.
id
;
SELECT
UpdateXML
(
xml
,
'/bla/@name'
,
'test'
),
UpdateXML
(
xml
,
'/bla/@name'
,
'test'
)
FROM
t1
ORDER
BY
t1
.
id
;
DROP
TABLE
t1
;
--
echo
End
of
5.1
tests
sql/item_xmlfunc.cc
View file @
3bb9a70f
...
...
@@ -2785,6 +2785,7 @@ String *Item_xml_str_func::parse_xml(String *raw_xml, String *parsed_xml_buf)
String
*
Item_func_xml_extractvalue
::
val_str
(
String
*
str
)
{
String
*
res
;
null_value
=
0
;
if
(
!
nodeset_func
||
!
(
res
=
args
[
0
]
->
val_str
(
str
))
||
!
parse_xml
(
res
,
&
pxml
))
...
...
@@ -2801,6 +2802,7 @@ String *Item_func_xml_update::val_str(String *str)
{
String
*
res
,
*
nodeset
,
*
rep
;
null_value
=
0
;
if
(
!
nodeset_func
||
!
(
res
=
args
[
0
]
->
val_str
(
str
))
||
!
(
rep
=
args
[
2
]
->
val_str
(
&
tmp_value3
))
||
...
...
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