summaryrefslogtreecommitdiff
path: root/mysql-test/t/xml.test
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'github/10.1' into 10.2Sergei Golubchik2018-02-061-0/+9
|\
| * Merge branch 'github/10.0' into 10.1Sergei Golubchik2018-02-021-0/+9
| |\
| | * MDEV-15118 ExtractValue(xml,something_complex) does not workAlexander Barkov2018-01-301-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | Item_xml_str_func::fix_fields() used a local "String tmp" as a buffer for args[1]->val_str(). "tmp" was freed at the end of fix_fields(), while Items created during my_xpath_parse() still pointed to its fragments. Adding a new member Item_xml_str_func::m_xpath_query and store the result of args[1]->val_str() into it.
* | | Merge remote-tracking branch 'origin/10.1' into 10.2Vicențiu Ciorbaru2017-12-221-1/+1
|\ \ \ | |/ /
| * | MDEV-14265 - RPMLint warning: shared-lib-calls-exitSergey Vojtovich2017-12-191-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | find_type_or_exit() client helper did exit(1) on error, exit(1) moved to clients. mysql_read_default_options() did exit(1) on error, error is passed through and handled now. my_str_malloc_default() did exit(1) on error, replaced my_str_ allocator functions with normal my_malloc()/my_realloc()/my_free(). sql_connect.cc did many exit(1) on hash initialisation failure. Removed error check since my_hash_init() never fails. my_malloc() did exit(1) on error. Replaced with abort(). my_load_defaults() did exit(1) on error, replaced with return 2. my_load_defaults() still does exit(0) when invoked with --print-defaults.
* | Merge branch '10.1' into 10.2Sergei Golubchik2017-10-241-2/+0
|\ \ | |/
* | More tests for MDEV-10134 Add full support for DEFAULTAlexander Barkov2016-06-301-0/+21
| | | | | | | | XML functions
* | Fixing a failure in "mtr --ps xml",Alexander Barkov2015-09-231-0/+2
|/ | | | | | | introduced by the patch for MDEV-8466 and MDEV-8468. Using --enable_prepare_warnings and --disable_prepare_warnings around the affected query, to have the same warning in regular and --ps mtr runs.
* 5.5 mergeSergei Golubchik2014-05-091-1/+13
|\
| * Merge 5.3->5.5Alexander Barkov2014-04-231-1/+13
| |\
| | * MDEV-5338 XML parser accepts malformed dataAlexander Barkov2014-04-231-1/+15
| | |
* | | A joint patch for:Alexander Barkov2014-03-231-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - MDEV-5689 ExtractValue(xml, 'substring(/x,/y)') crashes - MDEV-5709 ExtractValue() with XPath variable references returns wrong result. Description: 1. The main problem was that that nodeset_func->fix_fields() was called in Item_func_xml_extractvalue::val_str() and Item_func_xml_update::val_str(), which led in some cases to execution of the XPath engine *before* having a parsed XML value. Moved to Item_xml_str_func::fix_fields(). 2. Cleanup: added a new method Item_xml_str_func::fix_fields() and moved most of the code from Item_xml_str_func::fix_length_and_dec() to Item_xml_str_func::fix_fields(), to follow the usual Item layout. 3. Cleanup: a parsed XML value is useless without the raw XML value it was built from. Previously the parsed and the raw values where stored in separate String instances. It was hard to follow how they are synchronized. Added a helper class XML which contains both parsed and raw values. Makes things easier to read and modify. 4. MDEV-5709: const_item() could incorrectly return a "true" result when XPath expression contains users/SP variable references. Now nodeset_func->const_item() is also taken into account to catch such cases. 5. Minor code enhancements.
* | | 10.0-base mergeSergei Golubchik2014-02-261-0/+5
|\ \ \ | |/ /
| * | test case forSergei Golubchik2014-02-171-0/+6
| | | | | | | | | | | | | | | MDEV-5689 ExtractValue(xml, 'substring(/x,/y)') crashes MySQL bug#12428404 MYSQLD.EXE CRASHES WHEN EXTRACTVALUE() IS CALLED WITH MALFORMED XPATH EXP
* | | MDEV-4928 Merge collation customization improvements Alexander Barkov2013-10-021-0/+29
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | Merging the following MySQL-5.6 changes: - WL#5624: Collation customization improvements http://dev.mysql.com/worklog/task/?id=5624 - WL#4013: Unicode german2 collation http://dev.mysql.com/worklog/task/?id=4013 - Bug#62429 XML: ExtractValue, UpdateXML max arg length 127 chars http://bugs.mysql.com/bug.php?id=62429 (required by WL#5624)
* | Bug #12375190: UPDATEXML CRASHES ON SIMPLE INPUTS Georgi Kodinov2011-05-031-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The XPATH implementation was not handling correctly the XPATH production #19 (http://www.w3.org/TR/1999/REC-xpath-19991116/#node-sets), namely PathExpr ::= | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath It was lacking context for the RelativeLocationPath and it was just ignoring the second slash instead of treating it as a different axis specifier. Fixed the above two problems and added a test case.
* | Merging from mysql-5.1Alexander Barkov2011-03-011-0/+5
|\ \ | |/
| * Bug#11766725 (Bug#59901) EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332Alexander Barkov2011-03-011-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: a byte behind the end of input string was read in case of a broken XML not having a quote or doublequote character closing a string value. Fix: changing condition not to read behind the end of input string @ mysql-test/r/xml.result @ mysql-test/t/xml.test Adding tests @ strings/xml.c When checking if the closing quote/doublequote was found, using p->cur[0] us unsafe, as p->cur can point to the byte after the value. Comparing p->cur to p->beg instead.
* | Merging from 5.1.Alexander Barkov2011-01-181-0/+5
|\ \ | |/
| * Bug#44332 my_xml_scan reads behind the end of bufferAlexander Barkov2011-01-181-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: the scanner function tested for strings "<![CDATA[" and "-->" without checking input string boundaries, which led to valgrind's "Conditional jump or move depends on uninitialised value(s)" error. Fix: Adding boundary checking. @ mysql-test/r/xml.result @ mysql-test/t/xml.test Adding test @ strings/xml.c Adding a helper function my_xml_parser_prefix_cmp(), with input string boundary check.
| * Manual-merge from mysql-5.1-bugteam.Ramil Kalimullin2010-11-221-0/+13
| |\
* | \ Manual merge from mysql-5.5-bugteam.Ramil Kalimullin2010-11-221-0/+28
|\ \ \ | |/ / |/| |
| * | Bug#58175 xml functions read initialized bytes when conversions happenAlexander Barkov2010-11-191-0/+15
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: nr_of_decimals could read behind the end of the buffer in case of a non-null-terminated string, which caused valgring warnings. Fix: fixing nr_of_decimals not to read behind the "end" pointer. modified: @ mysql-test/r/xml.result @ mysql-test/t/xml.test @ sql/item.cc
| * Bug#57279 updatexml dies with: Assertion failed: str_arg[length] == 0Alexander Barkov2010-11-181-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: crash in Item_float constructor on DBUG_ASSERT due to not null-terminated string parameter. Fix: making Item_float::Item_float non-null-termintated parameter safe: - Using temporary buffer when generating error modified: @ mysql-test/r/xml.result @ mysql-test/t/xml.test @ sql/item.cc
* | Bug#57257 Replace(ExtractValue(...)) causes MySQL crashAlexander Barkov2010-11-111-0/+11
|/ | | | | | | | | | | | | | | | | | | | | | | | Bug#57820 extractvalue crashes Problem: ExtractValue and Replace crashed in some cases due to invalid handling of empty and NULL arguments. Per file comments: @mysql-test/r/ctype_ujis.result @mysql-test/r/xml.result @mysql-test/t/ctype_ujis.test @mysql-test/t/xml.test Adding tests @sql/item_strfunc.cc Make sure Item_func_replace::val_str safely handles empty strings. @sql/item_xmlfunc.cc set null_value if nodeset_func returned NULL, which is possible when the second argument is an unset user variable.
* Bug#43183 ExctractValue() brings result list in missorderSergey Glukhov2009-04-011-0/+27
| | | | | | | | | | | | | | | | | | The problem is that XML functions(items) do not reset null_value before their execution and further item excution may use null_value value of the previous result. The fix is to reset null_value. mysql-test/r/xml.result: test result mysql-test/t/xml.test: test case sql/item_xmlfunc.cc: The problem is that XML functions(items) do not reset null_value before their execution and further item excution may use null_value value of the previous result. The fix is to reset null_value.
* Bug#42495 updatexml: Assertion failed: xpath->context, file ↵Sergey Glukhov2009-02-041-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | .\item_xmlfunc.cc, line 2507 Problem: RelativeLocationPath can appear only after a node-set expression in the third and the fourth branches of this rule: PathExpr :: = LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath XPatch code didn't check the type of FilterExpr and crashed. Fix: If FilterExpr is a scalar expression (variable reference, literal, number, scalar function call) return error. mysql-test/r/xml.result: test result mysql-test/t/xml.test: test case sql/item_xmlfunc.cc: Problem: RelativeLocationPath can appear only after a node-set expression in the third and the fourth branches of this rule: PathExpr :: = LocationPath | FilterExpr | FilterExpr '/' RelativeLocationPath | FilterExpr '//' RelativeLocationPath XPatch code didn't check the type of FilterExpr and crashed. Fix: If FilterExpr is a scalar expression (variable reference, literal, number, scalar function call) return error.
* Bug#38227 EXTRACTVALUE doesn't work with DTD declarationsAlexander Barkov2008-12-101-0/+25
| | | | | | | | | | | | Problem: XML syntax parser allowed to use quoted strings as attribute names, and tried to put them into parser state stack instead of identifiers. After that parser failed, if quoted string contained some slash characters. Fix: - Disallowing quoted strings in regular tags. - Allowing quoted string in DOCTYPE declararion, but don't push it into parse state stack (just skip it).
* Fix for bug #32557: order by updatexml causes assertion in filesortunknown2007-11-211-0/+8
| | | | | | | | | | | | | | | | | | Problem: even if an Item_xml_str_func successor returns NULL, it doesn't have a corresponding property (maybe_null) set, that leads to a failed assertion. Fix: set nullability property of Item_xml_str_func. mysql-test/r/xml.result: Fix for bug #32557: order by updatexml causes assertion in filesort - test result. mysql-test/t/xml.test: Fix for bug #32557: order by updatexml causes assertion in filesort - test case. sql/item_xmlfunc.h: Fix for bug #32557: order by updatexml causes assertion in filesort - set Item_xml_str_func::maybe_null.
* Fix for bug #31438: updatexml still crashesunknown2007-10-081-0/+11
| | | | | | | | | | | | | | | | | Problem: check missed if the second updatexml() argument is valid. Fix: check it. mysql-test/r/xml.result: Fix for bug #31438: updatexml still crashes - test result. mysql-test/t/xml.test: Fix for bug #31438: updatexml still crashes - test case. sql/item_xmlfunc.cc: Fix for bug #31438: updatexml still crashes - check if the second argument passed to the updatexml() is valid.
* Bug#28558 UpdateXML called with garbage crashes serverunknown2007-05-231-0/+10
| | | | | | | | | | | | | | | | | | | | Problem: Memory overrun happened in attempts to generate error messages (e.g. in case of incorrect XPath syntax). Reason: set_if_bigger() was used instead of set_if_smaller(). Change: replacing wrong set_if_bigger() to set_if_smaller(), and making minor additional code clean-ups. mysql-test/r/xml.result: Adding test cases for all pieces of code with set_if_smaller() followed by my_printf_error(). mysql-test/t/xml.test: Adding test cases for all pieces of code with set_if_smaller() followed by my_printf_error(). sql/item_xmlfunc.cc: - fixing incorrect set_if_bigger to set_if_smaller in two places - getting read of unnesessary "char context[32]" variable and using '%.*s' instead if '%s' in the error format.
* Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1-rplunknown2007-05-081-0/+72
|\ | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/home/bar/mysql-5.1.b26518 mysql-test/r/xml.result: Auto merged mysql-test/t/xml.test: Auto merged sql/item_xmlfunc.cc: Auto merged
| * Bug#26518 XPath and variables problemunknown2007-05-081-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: XPath variables didn't work. Fix: adding variables support, both user-defined and sp local variables are now supported by XPath. mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Adding variables support: - SP variables with standard XPath syntax: $i - User variables with non-standard syntax: $@i
* | Bug#27898 UPDATEXML Crashes the Server!unknown2007-05-021-0/+7
|/ | | | | | | | | | | | | | | | | | 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.
* Bug#24747 XPath error with the node name "Text"unknown2006-12-271-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Bug#24747 XPath error with the node name "Text" Problem: keywords, nodetype names and axis names didn't work in node name context. Fix: 1. Changes in lexem scanner behaviour when an identifier has been read: - search through axis names and return MY_XPATH_AXIS_xxx only when identifier is followed by two semicolons. Don't check axis names and return MY_XPATH_IDENT of not followed by two semicolons. - search through nodetype names and return MY_XPATH_LEX_NODETYPE only when identifier is followed by left parenthesis. Don't check nodetype names and return MY_XPATH_LEX_IDENT when not followed by parenthesis 2. Change in syntax analizer: QName scanner now accepts keywords AND, OR, MOD, DIV as valid node names.
* Bug#22823 gt and lt operators appear to be reversed in ExtractValue() commandunknown2006-10-231-0/+30
| | | | | | | | | | | | | | | | | Problem: "greater than" and "less than" XPath operators appeared to have been implemented in reverse. Fix: swap arguments to eq_func() and eq_func_reverse() to provide correct operation result. mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Pass argumemtns to eq_func() and eq_func_reverse() in correct order: nodeset argument first, then scalar argument. Also, fixing eq_func_reverse() to do correct conversion, e.g: "scalar > nodeset" into "nodeset < scalar" instead of wrong "nodeset <= scalar" "scalar >= nodeset" into "nodeset <= scalar" instead of wrong "nodeset < scalar".
* Bug#20854 XML functions: wrong result in ExtractValueunknown2006-09-141-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | mysql-test/r/xml.result: - Adding test case - Fixing error message mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: For grammar rules with loops like: AdditiveExpr ::= MultiplicativeExpr ('+' MultiplicativeExpr)* If we scanned scanned '+' and then met an error when parsing MultiplicativeExpr, then we should fully stop parsing - without trying to apply any other rules. Fix: add "error" member into MY_XPATH structure, and make my_xpath_parse_term() never return success as soon as error set. strings/xml.c: Adding my_xml_ctype map for flags, indicating whether a character is a space character, is a valid identifier start character, is a valid identifier body character. Using this map to properly scan identifiers. Also, using this map to scan spaces faster (instead of strchr).
* Bug#20795: extractvalue() won't accept names containing a dot (.)unknown2006-07-251-0/+6
| | | | | | | | | | | | | | | | Dot character was not considered as a valid identifier body character. mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Treat dot character as a valid identifier body part. strings/ctype.c: Fixing to use '/' instead of '.' as a delimiter in charset file parser. strings/xml.c: Fixing to use '/' instead of '.' as a delimiter.
* Merge mysql.com:/usr/home/bar/mysql-5.1-new.b18201unknown2006-06-191-1/+12
|\ | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/usr/home/bar/mysql-5.1-kt mysql-test/r/xml.result: Auto merged mysql-test/t/xml.test: Auto merged sql/item_xmlfunc.cc: Auto merged
| * Merge mysql.com:/usr/home/bar/mysql-5.1-newunknown2006-05-021-1/+12
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/usr/home/bar/mysql-5.1-new.b18201 mysql-test/r/xml.result: Auto merged mysql-test/t/xml.test: Auto merged sql/item_xmlfunc.cc: Auto merged
| | * Bug#18201: XML: ExtractValue works even if the xmlunknown2006-04-171-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | fragment is not well-formed xml Problem: - ExtractValue silently returned NULL if a wrong XML value is passed. - In some cases "unexpected END-OF-INPUT" error was not detected, and a non-NULL result could be returned for a bad XML value. Fix: - Adding warning messages, to make user aware why NULL was returned. - Missing "unexpected END-OF-INPUT" error is reported now. mysql-test/r/xml.result: - Fixing XML systax error in old test - Adding test cases. mysql-test/t/xml.test: - Fixing XML systax error in old test - Adding test cases. sql/item_xmlfunc.cc: Produce warning in case of XML systax error, instead of silentrly returning NULL. strings/xml.c: - Making error messages better looking and clearer: It is important because now they're seen in SHOW WARNINGS (previously they were used only for debugging purposes). - Adding "unexpected END-OF-INPUT" error if after scanning closing tag for the root element some input is left (previously this error was ignored in a mistake).
* | | Merge mysql.com:/usr/home/bar/mysql-5.1-newunknown2006-05-031-0/+8
|\ \ \ | |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/usr/home/bar/mysql-5.1-new.b18170 mysql-test/r/xml.result: Auto merged mysql-test/t/xml.test: Auto merged sql/item_xmlfunc.cc: Auto merged
| * | Bug#18170: XML: ExtractValue(): XPath expression can't use QNames (colon in ↵unknown2006-04-171-0/+8
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | names) Problem source: Qualified names (aka QName) didn't work as tag names and attribute names, because the parser lacked a real rule to scan QName, so it understood only non-qualified names without prefixes. Solution: New rule was added to check both "ident" and "ident:ident" sequences. mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Adding real QName parser rule and using it in NodeTest rule.
* | Merge mysql.com:/usr/home/bar/mysql-5.1-newunknown2006-04-141-0/+14
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | into mysql.com:/usr/home/bar/mysql-5.1-new.b16319 mysql-test/r/xml.result: Auto merged mysql-test/t/xml.test: Auto merged sql/item_xmlfunc.cc: Auto merged
| * Bug#16319: XML: extractvalue() returns syntax errors for some functionsunknown2006-04-071-0/+14
| | | | | | | | | | | | | | | | | | | | | | mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Adding support for missing XPath function string-length(). Fixing function lookup to allow functions with one optional arguments (i.e. with 0 or 1 arguments)
* | Merge mysql.com:/usr/home/bar/mysql-5.1-newunknown2006-04-111-0/+6
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | into mysql.com:/usr/home/bar/mysql-5.1-new.b18285 mysql-test/r/xml.result: Auto merged mysql-test/t/xml.test: Auto merged
| * | Bug#18285: ExtractValue not returning character data within <![CDATA[]]> as ↵unknown2006-04-071-0/+6
| |/ | | | | | | | | | | | | | | | | | | | | expected mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case strings/xml.c: Adding missing support of CDATA sections.
* | Bug#16233: XML: ExtractValue() fails with special charactersunknown2006-04-111-0/+20
|/ | | | | | | | | | | | | | | | | | | | | | | ExtractValue didn't understand tag and attribute names consisting of "tricky" national letters (e.g. latin accenter letters). It happened because XPath lex parser recognized only basic latin letter a..z ad a part of an identifier. Fixed to recognize all letters by means of new "full ctype" which was added recently. mysql-test/r/xml.result: Adding test case mysql-test/t/xml.test: Adding test case sql/item_xmlfunc.cc: Using recently implemented "true" ctype functionality to treat all national letters as valid tag names, Only basic latin letters worked so far. strings/ctype-simple.c: A bug fix: ctype is array of 257 elements, adding offset to address correct element.
* Bug #18172 XML: Extractvalue() accepts mallformedunknown2006-03-201-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | XPath without a XPath syntax error item_xmlfunc.cc: Error message didn't happen because after a failing attempt to parse RelativeLocationPath, my_xpath_parse_AbsoluteLocationPath() returned success. Changeing logic a bit: - Try to parse EOF first, return success if true. - Then try to parse RelativeLocationPath(), return success if true. - Otherwise return failure. xml.result: Adding test case. Also, this change made it possible to generate an error message earlier in the case of another bad XPATH syntax. xml.test: Adding test case. sql/item_xmlfunc.cc: Bug #18172 XML: Extractvalue() accepts mallformed XPath without a XPath syntax error Error message didn't happen because after a failing attempt to parse RelativeLocationPath(), my_xpath_parse_AbsoluteLocationPath() returned with 1. Changeing logic a bit: check for EOF first. Then try to parse RelativeLocationPath(). If the latter fails, return failure. mysql-test/t/xml.test: Adding test case. mysql-test/r/xml.result: Adding test case. Also, this change makes error message to be generated earlier in the case of another bad XPATH syntax.
* xml.result, xml.test:unknown2006-03-151-0/+9
| | | | | | | | | | | | | | | | Adding test. item_xmlfunc.cc: Bug #18171 XML: ExtractValue: the XPath position() function crashes the server! Disallowing use of position() and last() without context. sql/item_xmlfunc.cc: Bug #18171 XML: ExtractValue: the XPath position() function crashes the server! Disallowing use of position() and last() without context. mysql-test/t/xml.test: Adding test. mysql-test/r/xml.result: Adding test.