Commit graph

27 commits

Author SHA1 Message Date
unknown
7595cb06eb Bug#22823 gt and lt operators appear to be reversed in ExtractValue() command
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".
2006-10-23 14:17:57 +05:00
unknown
32ede45dd4 Bug#20854 XML functions: wrong result in ExtractValue
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).
2006-09-14 11:47:19 +05:00
unknown
6530968211 Bug#20795: extractvalue() won't accept names containing a dot (.)
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.
2006-07-25 18:46:43 +05:00
unknown
3657f34629 Post-merge fixes.
mysql-test/mysql-test-run.sh:
  A post-merge fix (apply a change lost during the merge).
sql/ha_ndbcluster.cc:
  A post-merge fix: resolve a merge error.
sql/item.cc:
  Fix a merge error.
sql/item_xmlfunc.cc:
  Use the new signature of agg_arg_charsets.
2006-07-14 02:07:37 +04:00
unknown
ca741138e7 Merge mysql.com:/usr/home/bar/mysql-5.1-new.b18201
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
2006-06-19 11:18:05 +05:00
unknown
20256d8a56 Merge mysql.com:/usr/home/bar/mysql-5.1-new
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
2006-05-03 09:08:12 +05:00
unknown
d3bb4670a9 Merge mysql.com:/usr/home/bar/mysql-5.1-new
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
2006-05-02 14:10:18 +05:00
unknown
ba67c865db item_xmlfunc.cc:
After review minor fixes for bug#16319
  Thanks to Gluh for suggestions.


sql/item_xmlfunc.cc:
  After review minor fixes.
  Thanks Gluh for suggestions.
2006-04-19 11:11:47 +05:00
unknown
3010775ed1 Bug#18201: XML: ExtractValue works even if the xml
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).
2006-04-17 14:40:25 +05:00
unknown
1a3cb50c24 Bug#18170: XML: ExtractValue(): XPath expression can't use QNames (colon in 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.
2006-04-17 11:49:20 +05:00
unknown
9faa297074 Merge mysql.com:/usr/home/bar/mysql-5.1-new
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
2006-04-14 13:34:18 +05:00
unknown
6c0cfad17b Bug#16233: XML: ExtractValue() fails with special characters
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.
2006-04-11 13:25:02 +05:00
unknown
e84041f174 Bug#16319: XML: extractvalue() returns syntax errors for some functions
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)
2006-04-07 14:07:56 +05:00
unknown
59eaf292de Fixed compiler and valgrind warnings
Added missing DBUG_xxx_RETURN statements
Fixed some usage of not initialized variables (as found by valgrind)
Ensure that we don't remove locked tables used as name locks from open table cache until unlock_table_names() are called.
This was fixed by having drop_locked_name() returning any table used as a name lock so that we can free it in unlock_table_names()
This will allow Tomas to continue with his work to use namelocks to syncronize things.

Note: valgrind still produces a lot of warnings about using not initialized code and shows memory loss errors when running the ndb tests


BitKeeper/etc/ignore:
  added mysql-test/r/*.log
client/mysqltest.c:
  Change type of variables to get rid of compiler warnings
  More debugging
  Fix memory leak
mysql-test/mysql-test-run.sh:
  Collect warnings about missing DBUG_RETURN statements
mysql-test/r/lock_multi.result:
  Add test of new code
mysql-test/r/ndb_condition_pushdown.result:
  Drop used tables before test
mysql-test/t/lock_multi.test:
  Add test of new code
mysql-test/t/ndb_condition_pushdown.test:
  Drop used tables before test
mysql-test/valgrind.supp:
  Ignore 'safe' warnings from libz (when used with archive)
sql/event.cc:
  More comments
  Simplify code
  Fixed memory leak found by valgrind
sql/ha_archive.cc:
  Remove compiler warnings (Wrong handlerton structure and signed/unsigned comparison)
sql/ha_berkeley.cc:
  Fixed compiler warning
sql/ha_blackhole.cc:
  Fixed compiler warning
sql/ha_federated.cc:
  Fixed compiler warning
sql/ha_heap.cc:
  Fixed compiler warning
sql/ha_myisam.cc:
  Fixed compiler warning
sql/ha_myisammrg.cc:
  Fixed compiler warning
sql/ha_ndbcluster.cc:
  Fixed compiler warnings
sql/ha_partition.cc:
  Fixed compiler warning
  Fixed error noticed by valgrind in ha_partition::rnd_init()
sql/handler.cc:
  Fixed compiler warning
sql/handler.h:
  Fixed compiler warning
sql/item.cc:
  Fixed compiler warning
sql/item_xmlfunc.cc:
  Fixed warning from valgrind when calling memcpy with wrong address
sql/lock.cc:
  More debugging
sql/log.cc:
  Fixed compiler warning
  Indentation fixes
sql/log.h:
  Fixed compiler warning
sql/mysql_priv.h:
  Changed prototype for 'drop_locked_tables'
sql/opt_range.cc:
  Indentation fix
sql/password.c:
  Removed compiler warnings
sql/set_var.cc:
  Fixed compiler warning
sql/slave.cc:
  Fixed compiler warning
sql/sp_head.cc:
  Fixed compiler warning
sql/sql_acl.cc:
  Fixed compiler warning
sql/sql_analyse.cc:
  Added missing DBUG_RETURN statements
sql/sql_base.cc:
  Removed de-reference of not initialized pointer
  More comments
  drop_locked_tables() changed to not delete tables used for name locking
  Fixed compiler warnings
sql/sql_delete.cc:
  Fixed usage of not initialized variable
  (deleted could be referenced in some not common error conditions)
sql/sql_parse.cc:
  Added missing DBUG_VOID_RETURN
  Simplify code
sql/sql_partition.cc:
  Fixed usage of wrong variable (noticed by valgrind)
sql/sql_plugin.cc:
  Removed compiler warning
sql/sql_show.cc:
  Removed compiler warning
sql/sql_table.cc:
  Ensure that we don't remove locked tables used as name locks from open table cache until unlock_table_names() are called.
  This was fixed by having drop_locked_name() returning any table used as a name lock so that we can free it in unlock_table_names()
  This will allow Tomas to continue with his work to use namelocks to syncronize things.
  
  Fixed wrong test of 'table_type' (path_length could otherwise be accessed uninitialized)
  
  Remove compile warnings about not initialized variables.
sql/sql_yacc.yy:
  Ensure that no_write_to_binlog is properly initialized
  (Was accessed uninitialized by partition code)
sql/table.cc:
  Removed valgrind warnings (not fatal)
  Removed compiler warnings
sql/tztime.cc:
  Removed valgrind warning
storage/ndb/include/ndbapi/NdbIndexStat.hpp:
  Removed compiler warning
2006-03-29 14:27:36 +03:00
unknown
64dc3289de item_xmlfunc.cc:
After review fix.
  Thanks to Gluh for suggestion.
  Bug#18172: XML: Extractvalue() accepts mallformed XPath without a XPath syntax error


sql/item_xmlfunc.cc:
  After review fix.
  Thanks to Gluh for suggestion.
  Bug#18172: XML: Extractvalue() accepts mallformed XPath without a XPath syntax error
2006-03-22 12:57:41 +04:00
unknown
5f8bd7fe0f Bug #18172 XML: Extractvalue() accepts mallformed
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.
2006-03-20 14:57:34 +04:00
unknown
1dc87feb20 xml.result, xml.test:
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.
2006-03-15 11:57:37 +04:00
unknown
41a863830a Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1-new/
into  mysql.com:/usr/home/bar/mysql-5.1-new.b16318


sql/item_xmlfunc.cc:
  Auto merged
mysql-test/r/xml.result:
  After merge fix
mysql-test/t/xml.test:
  After merge fix
2006-03-09 11:53:56 +04:00
unknown
a5694ba4cf Bug#16318: XML: extractvalue() incorrectly returns last() = 1
xml.result, xml.test:
  Adding test case.
item_xmlfunc.cc:
  - adding "size" member into MY_XPATH_FLT struct,
  to pass parent's context size when iterating
  in a predicate. Previously, temporaty context
  size was calculated instead, which is always 1.
  As a result, things like last() and count() 
  didn't work fine.
  - adding iteration into Item_func_xpath_elementbyindex:
  similar to Item_func_xpath_predicate.
  This is to make things like last() and count()
  work inside square brackets.


sql/item_xmlfunc.cc:
  Bug#16318: XML: extractvalue() incorrectly returns last() = 1
  - adding "size" member into MY_XPATH_FLT struct,
  to pass parent's context size when iterating
  in a predicate. Previously, temporaty context
  size was calculated instead, which is always 1.
  As a result, things like last() and count() 
  didn't work fine.
  - adding iteration into Item_func_xpath_elementbyindex:
  similar to Item_func_xpath_predicate.
  This is to make things like last() and count()
  work inside square brackets.
mysql-test/t/xml.test:
  Adding test case.
mysql-test/r/xml.result:
  Adding test case.
2006-03-03 18:36:14 +04:00
unknown
c76459aca9 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.
2006-03-02 14:05:38 +04:00
unknown
526d28f36a Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-5.1-new
into  mysql.com:/usr/home/bar/mysql-5.1-new.16315


sql/item_xmlfunc.cc:
  Auto merged
mysql-test/r/xml.result:
  After merge fix
mysql-test/t/xml.test:
  After merge fix
2006-03-02 10:42:08 +04:00
unknown
3f480fcb9f Bug#16315 XML: extractvalue() handles self badly
xml.result, xml.test:
  Adding test case.
item_xmlfunc.cc:
  Adding a special function to handle "self" axis.
  Previously "child" and "self" were handled the same.


sql/item_xmlfunc.cc:
  Bug#16315 XML: extractvalue() handles self badly
  Adding a special function to handle "self" axis.
  Previously "child" and "self" were handled the same.
mysql-test/t/xml.test:
  Adding test case.
mysql-test/r/xml.result:
  Adding test case.
2006-03-01 13:16:12 +04:00
unknown
0466a90944 Bug#16320 XML: extractvalue() won't accept names containing underscores
added '_' to allowed tag body symbols


mysql-test/r/xml.result:
  Bug#16320 XML: extractvalue() won't accept names containing underscores
    test case
mysql-test/t/xml.test:
  Bug#16320 XML: extractvalue() won't accept names containing underscores
    test case
2006-03-01 10:36:22 +04:00
unknown
828de833bf Bug#16313 XML: extractvalue() ignores '!' in names
xml.result, xml.test:
  Adding test case.
item_xmlfunc.cc:
  Fixed that the "!" character written at the end was ignored.

  Now if we try to scan "!=", and if "!" is not
  followed by "=", we rollback lex scanner back 
  to "!" token, so the parser will start to check
  the next rule from the "!" character again.

  Previously parser started from the next character,
  which was EOF in the example in xml.test,
  which led to query being successfully parsed,
  instead of producing a syntax error.


sql/item_xmlfunc.cc:
  Bug#16313 XML: extractvalue() ignores '!' in names
  '!' at the end was ignored.
  Now if we try to scan "!=", and if "!" is not
  followed by "=", we rollback lex scanner back 
  to "!" token, so the parser will start to check
  the next rule from the "!" character again.
  Previously it started from the next character,
  which was EOF in the example in xml.test, and
  which led to query being successfully parsed,
  instead of producing a syntax error.
mysql-test/t/xml.test:
  Adding test case.
mysql-test/r/xml.result:
  Adding test case.
2006-02-28 13:59:16 +04:00
unknown
c736708725 Bug#16234 XML: Crash if ExtractValue()
Also fixes 16314: XML: extractvalue() crash if vertical bar
xml.result, xml.test:
  Adding test case
item_xmlfunc.cc:
  Using root element as a context node,
  instead of NULL, with relative paths.


sql/item_xmlfunc.cc:
  Bug#16234 XML: Crash if ExtractValue()
  Also fixes 16314: XML: extractvalue() crash if vertical bar
  Use root element as a context node,
  instead of NULL, with relative paths.
mysql-test/t/xml.test:
  Adding test case
mysql-test/r/xml.result:
  Adding test case
2006-02-10 13:24:10 +04:00
unknown
02f4054ece Fix -ansi -pedantic compile 2006-01-05 11:18:26 +03:00
unknown
5e4c3ce682 Adding XPath support: ExtractValue and UpdateXML functions.
libmysqld/Makefile.am:
sql/Makefile.am:
  Adding new source files.
  Adding new file into build process.
include/my_xml.h:
strings/xml.c:
  Adding new XML parse flags to skip text normalization and 
  to use relative tag names. Adding enum for XML token types.
sql/lex.h:
  Making parser aware of new SQL functions.
sqll/item_create.h, sql/item_create.cc:
  Adding creators for ExtractValue and UpdateXML.
sql/item.h:
  Adding new Item types: nodeset and nodeset comparator.
sql/item_xmlfunc.h
sql/item_xmlfunc.cc
  Adding new classes implementing XPath functions.
mysql-test/t/xml.test, mysql-test/r/xml.result:
  New files: adding test case


include/my_xml.h:
  Adding ExtractValue and UpdateXML functions.
  Adding XML parser flags and enum for XML token types.
sql/Makefile.am:
  Adding new source files.
sql/item.h:
  Adding new Item types: nodeset and nodeset comparator.
sql/item_create.cc:
  Adding creators for ExtractValue and UpdateXML.
sql/item_create.h:
  Adding creators for ExtractValue and UpdateXML.
sql/lex.h:
  Make parse aware of new SQL functions.
strings/xml.c:
  Adding new flags to skip text normalization and 
  to use relative tag names.
libmysqld/Makefile.am:
  Adding new file into build process.
2005-12-21 17:13:52 +04:00