mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Bug#27898 UPDATEXML Crashes the Server!
Problem: when replacing the root element, UpdateXML erroneously tried to mix old XML content with the replacement string, which led to crash. Fix: don't use the old XML content in these cases, just return the replacement string. mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Adding special code to handle replacements of the root element - the replacing content is just copied to the result, the previous content of the XML value is removed.
This commit is contained in:
@@ -547,6 +547,13 @@ 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>
|
||||
select updatexml('<div><div><span>1</span><span>2</span></div></div>',
|
||||
'/','<tr><td>1</td><td>2</td></tr>') as upd1;
|
||||
upd1
|
||||
<tr><td>1</td><td>2</td></tr>
|
||||
select updatexml('', '/', '') as upd2;
|
||||
upd2
|
||||
|
||||
SET @xml= '<order><clerk>lesser wombat</clerk></order>';
|
||||
select extractvalue(@xml,'order/clerk');
|
||||
extractvalue(@xml,'order/clerk')
|
||||
|
||||
Reference in New Issue
Block a user