summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/t/analyse.test5
-rw-r--r--sql/sql_analyse.cc15
2 files changed, 12 insertions, 8 deletions
diff --git a/mysql-test/t/analyse.test b/mysql-test/t/analyse.test
index 34343c2b7bf..52e367769a2 100644
--- a/mysql-test/t/analyse.test
+++ b/mysql-test/t/analyse.test
@@ -38,6 +38,11 @@ select * from t2;
insert into t2 select * from t1 procedure analyse();
select * from t2;
drop table t1,t2;
+
+#
+# Bug#2813 - analyse does not quote string values in enums from string
+#
+
create table t1 (v varchar(128));
insert into t1 values ('abc'),('abc\'def\\hij\"klm\0opq'),('\''),('\"'),('\\'),('a\0'),('b\''),('c\"'),('d\\'),('\'b'),('\"c'),('\\d'),('a\0\0\0b'),('a\'\'\'\'b'),('a\"\"\"\"b'),('a\\\\\\\\b'),('\'\0\\\"'),('\'\''),('\"\"'),('\\\\'),('The\ZEnd');
select * from t1 procedure analyse();
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 5265857f3b1..33ce62bc5cf 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -1029,20 +1029,19 @@ uint check_ulonglong(const char *str, uint length)
} /* check_ulonlong */
-
/*
- FUNCTION: append_escaped()
-
+ Quote special characters in a string.
+
+ SYNOPSIS
+ append_escaped(to_str, from_str)
+ to_str (in) A pointer to a String.
+ from_str (to) A pointer to an allocated string
+
DESCRIPTION
append_escaped() takes a String type variable, where it appends
escaped the second argument. Only characters that require escaping
will be escaped.
- ARGUMENTS
- A pointer to a String variable, where results will be appended
- A pointer to a String variable, which is appended to the result
- String, escaping those characters that require it.
-
RETURN VALUES
0 Success
1 Out of memory