Commit c76459ac authored by unknown's avatar unknown

Bug#16316: XML: extractvalue() is case-sensitive with contains()

xml.result, xml.test:
  Adding test case.
item_xmlfunc.cc:
  Fixed that Item_nodeset_func derived classes
  didn't take into account charset of the XML value
  and always worked using "binary" charset.


sql/item_xmlfunc.cc:
  Bug#16316: XML: extractvalue() is case-sensitive with contains()
  Fixed that Item_nodeset_func derived classes
  didn't take into account charset of the XML value
  and always worked using "binary" charset.
mysql-test/t/xml.test:
  Adding test case.
mysql-test/r/xml.result:
  Adding test case.
parent c3251424
......@@ -561,3 +561,15 @@ A B C
select extractvalue('<A_B>A</A_B>','/A_B');
extractvalue('<A_B>A</A_B>','/A_B')
A
select extractvalue('<a>Jack</a>','/a[contains(../a,"J")]');
extractvalue('<a>Jack</a>','/a[contains(../a,"J")]')
Jack
select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]');
extractvalue('<a>Jack</a>','/a[contains(../a,"j")]')
Jack
select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin);
extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin)
select extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]');
extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]')
......@@ -254,3 +254,11 @@ 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');
#
# Bug#16316: XML: extractvalue() is case-sensitive with contains()
#
select extractvalue('<a>Jack</a>','/a[contains(../a,"J")]');
select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]');
select extractvalue('<a>Jack</a>','/a[contains(../a,"j")]' collate latin1_bin);
select extractvalue('<a>Jack</a>' collate latin1_bin,'/a[contains(../a,"j")]');
......@@ -206,7 +206,11 @@ public:
return str;
}
enum Item_result result_type () const { return STRING_RESULT; }
void fix_length_and_dec() { max_length= MAX_BLOB_WIDTH; }
void fix_length_and_dec()
{
max_length= MAX_BLOB_WIDTH;
collation.collation= pxml->charset();
}
const char *func_name() const { return "nodeset"; }
};
......@@ -2373,6 +2377,7 @@ void Item_xml_str_func::fix_length_and_dec()
xpath.cs= collation.collation;
xpath.debug= 0;
xpath.pxml= &pxml;
pxml.set_charset(collation.collation);
rc= my_xpath_parse(&xpath, xp->ptr(), xp->ptr() + xp->length());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment