List:Commits« Previous MessageNext Message »
From:bar Date:February 28 2006 9:59am
Subject:bk commit into 5.1 tree (bar:1.2185) BUG#16313
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of bar. When bar does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2185 06/02/28 13:59:16 bar@stripped +3 -0
    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.

  mysql-test/r/xml.result
    1.4 06/02/28 13:57:40 bar@stripped +2 -0
    Adding test case.

  mysql-test/t/xml.test
    1.4 06/02/28 13:57:34 bar@stripped +6 -0
    Adding test case.

  sql/item_xmlfunc.cc
    1.4 06/02/28 13:53:58 bar@stripped +11 -2
    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.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	bar
# Host:	bar.intranet.mysql.r18.ru
# Root:	/usr/home/bar/mysql-5.1-new

--- 1.3/mysql-test/r/xml.result	2006-02-27 11:20:34 +04:00
+++ 1.4/mysql-test/r/xml.result	2006-02-28 13:57:40 +04:00
@@ -544,3 +544,5 @@
 a
 select extractvalue('<a>A</a>','/<a>');
 ERROR HY000: XPATH syntax error: '>'
+select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');
+ERROR HY000: XPATH syntax error: '!'

--- 1.3/mysql-test/t/xml.test	2006-02-27 11:18:47 +04:00
+++ 1.4/mysql-test/t/xml.test	2006-02-28 13:57:34 +04:00
@@ -237,3 +237,9 @@
 #
 --error 1105
 select extractvalue('<a>A</a>','/<a>');
+
+#
+# Bug#16313 XML: extractvalue() ignores '!' in names
+#
+--error 1105
+select extractvalue('<a><b>b</b><b!>b!</b!></a>','//b!');

--- 1.3/sql/item_xmlfunc.cc	2006-02-10 13:20:43 +04:00
+++ 1.4/sql/item_xmlfunc.cc	2006-02-28 13:53:58 +04:00
@@ -1976,8 +1976,17 @@
 */
 static int my_xpath_parse_ne(MY_XPATH *xpath)
 { 
-  return my_xpath_parse_term(xpath, MY_XPATH_LEX_EXCL) &&
-         my_xpath_parse_term(xpath, MY_XPATH_LEX_EQ);
+  MY_XPATH_LEX prevtok= xpath->prevtok;
+  if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_EXCL))
+    return 0;
+  if (!my_xpath_parse_term(xpath, MY_XPATH_LEX_EQ))
+  {
+    /* Unget the exclamation mark */
+    xpath->lasttok= xpath->prevtok;
+    xpath->prevtok= prevtok;
+    return 0;
+  }
+  return 1;
 }
 static int my_xpath_parse_EqualityOperator(MY_XPATH *xpath)
 {
Thread
bk commit into 5.1 tree (bar:1.2185) BUG#16313bar28 Feb