List:Internals« Previous MessageNext Message »
From:Jim Winstead Date:April 29 2005 12:57am
Subject:bk commit into 5.0 tree (jimw:1.1913) BUG#10251
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of jimw. When jimw 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.1913 05/04/28 17:57:26 jimw@stripped +3 -0
  Support quoted identifiers containing single and double
  quotes in mysqltest. (Bug #10251)

  mysql-test/t/mysqltest.test
    1.4 05/04/28 17:57:23 jimw@stripped +6 -0
    Add test of identifiers containing quotes.

  mysql-test/r/mysqltest.result
    1.4 05/04/28 17:57:23 jimw@stripped +3 -0
    Add results

  client/mysqltest.c
    1.140 05/04/28 17:57:23 jimw@stripped +22 -40
    Remove duplication in quote-handling quote, and add handling
    of backquote (`).

# 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:	jimw
# Host:	rama.(none)
# Root:	/home/jimw/my/mysql-5.0-10251

--- 1.3/mysql-test/r/mysqltest.result	2004-11-02 10:13:23 -08:00
+++ 1.4/mysql-test/r/mysqltest.result	2005-04-28 17:57:23 -07:00
@@ -142,3 +142,6 @@
 1064
 select 3 from t1 ;
 ERROR 42S02: Table 'test.t1' doesn't exist
+select 1 as `a'b`, 2 as `a"b`;
+a'b	a"b
+1	2

--- 1.3/mysql-test/t/mysqltest.test	2004-11-02 10:13:23 -08:00
+++ 1.4/mysql-test/t/mysqltest.test	2005-04-28 17:57:23 -07:00
@@ -286,3 +286,9 @@
 #select 3 from t1 ;
 #
 #select 3 from t1 ;
+
+
+#
+# Bug #10251: Identifiers containing quotes not handled correctly
+#
+select 1 as `a'b`, 2 as `a"b`;

--- 1.139/client/mysqltest.c	2005-04-14 04:39:39 -07:00
+++ 1.140/client/mysqltest.c	2005-04-28 17:57:23 -07:00
@@ -2024,11 +2024,11 @@
 int read_line(char* buf, int size)
 {
   int c;
+  char quote;
   char* p= buf, *buf_end= buf + size - 1;
   int no_save= 0;
-  enum {R_NORMAL, R_Q1, R_ESC_Q_Q1, R_ESC_Q_Q2,
-	R_ESC_SLASH_Q1, R_ESC_SLASH_Q2,
-	R_Q2, R_COMMENT, R_LINE_START} state= R_LINE_START;
+  enum {R_NORMAL, R_Q, R_ESC_Q, R_ESC_SLASH_Q,
+	R_COMMENT, R_LINE_START} state= R_LINE_START;
   DBUG_ENTER("read_line");
 
   start_lineno= *lineno;
@@ -2063,10 +2063,11 @@
 	*p= 0;
 	DBUG_RETURN(0);
       }
-      else if (c == '\'')
-	state = R_Q1;
-      else if (c == '"')
-	state = R_Q2;
+      else if (c == '\'' || c == '"' || c == '`')
+      {
+        quote= c;
+	state= R_Q;
+      }
       else if (c == '\n')
       {
 	state = R_LINE_START;
@@ -2101,55 +2102,36 @@
 	*p= 0;
 	DBUG_RETURN(0);
       }
-      else if (c == '\'')
-	state= R_Q1;
-      else if (c == '"')
-	state= R_Q2;
-      else
-	state= R_NORMAL;
-      break;
-
-    case R_Q1:
-      if (c == '\'')
-	state= R_ESC_Q_Q1;
-      else if (c == '\\')
-	state= R_ESC_SLASH_Q1;
-      break;
-    case R_ESC_Q_Q1:
-      if (end_of_query(c))
+      else if (c == '\'' || c == '"' || c == '`')
       {
-	*p= 0;
-	DBUG_RETURN(0);
+        quote= c;
+	state= R_Q;
       }
-      if (c != '\'')
-	state= R_NORMAL;
       else
-	state= R_Q1;
-      break;
-    case R_ESC_SLASH_Q1:
-      state= R_Q1;
+	state= R_NORMAL;
       break;
 
-    case R_Q2:
-      if (c == '"')
-	state= R_ESC_Q_Q2;
+    case R_Q:
+      if (c == quote)
+	state= R_ESC_Q;
       else if (c == '\\')
-	state= R_ESC_SLASH_Q2;
+	state= R_ESC_SLASH_Q;
       break;
-    case R_ESC_Q_Q2:
+    case R_ESC_Q:
       if (end_of_query(c))
       {
 	*p= 0;
 	DBUG_RETURN(0);
       }
-      if (c != '"')
+      if (c != quote)
 	state= R_NORMAL;
       else
-	state= R_Q2;
+	state= R_Q;
       break;
-    case R_ESC_SLASH_Q2:
-      state= R_Q2;
+    case R_ESC_SLASH_Q:
+      state= R_Q;
       break;
+
     }
 
     if (!no_save)
Thread
bk commit into 5.0 tree (jimw:1.1913) BUG#10251Jim Winstead29 Apr