From 0f9f2b02c1f87eef80b1ff0a6873be28ddcfc3fe Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Nov 2004 14:36:25 +0400 Subject: [PATCH 1/4] A fix (bug #6449: DO server-crashing bug). sql/sql_yacc.yy: A fix (bug #6449: DO server-crashing bug). expr_list is used for DO command. --- mysql-test/r/select.result | 4 ++++ mysql-test/t/select.test | 9 +++++++++ sql/sql_yacc.yy | 9 +++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index ba0a80331b1..3417c7ecb85 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -2057,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE drop table t4, t3, t2, t1; DO 1; DO benchmark(100,1+1),1,1; +do default; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 +do foobar; +ERROR 42S22: Unknown column 'foobar' in 'field list' CREATE TABLE t1 ( id mediumint(8) unsigned NOT NULL auto_increment, pseudo varchar(35) NOT NULL default '', diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 5bae44796dc..3b36ba6bfb2 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -1756,6 +1756,15 @@ drop table t4, t3, t2, t1; DO 1; DO benchmark(100,1+1),1,1; +# +# Bug #6449: do default; +# + +--error 1064 +do default; +--error 1054 +do foobar; + # # random in WHERE clause # diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 521196085bb..8cbfaf3f99b 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -3932,11 +3932,12 @@ do: DO_SYM { LEX *lex=Lex; lex->sql_command = SQLCOM_DO; - if (!(lex->insert_list = new List_item)) - YYABORT; + mysql_init_select(lex); + } + expr_list + { + Lex->insert_list= $3; } - values - {} ; /* From 9ae173c4ff5f4aab480ac7d1d5f32d2ef24fdb25 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Nov 2004 12:10:44 +0000 Subject: [PATCH 2/4] Also print warning if there is an ndb->mysql errorcode mapping, this since the warning provides valuable info to the user --- sql/ha_ndbcluster.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index d9545d5cbb8..bc1c887bfab 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -144,10 +144,17 @@ static int ndb_to_mysql_error(const NdbError *err) // Push the NDB error message as warning push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, ER_GET_ERRMSG, ER(ER_GET_ERRMSG), - err->code, err->message, "NDB"); + err->code, err->message, "NDB"); return err->code; } } + // Push the NDB error message as warning + // this since e.g. HA_ERR_RECORD_FILE_FULL maps to + // several error codes in NDB, and the uses needs + // to know which one it is + push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_GET_ERRMSG, ER(ER_GET_ERRMSG), + err->code, err->message, "NDB"); return err_map[i].my_err; } From b226bebcc81b820c10c8cadafbf9fc0483f780e3 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Nov 2004 16:45:47 +0400 Subject: [PATCH 3/4] ctype-tis620.c: Space allocated didn't take in account trailing '\0' bytes. strings/ctype-tis620.c: Space allocated didn't take in account trailing '\0' bytes. --- strings/ctype-tis620.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 68bfefafe6a..5d37aa965d9 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -541,7 +541,7 @@ int my_strnncoll_tis620(CHARSET_INFO *cs __attribute__((unused)), tc1= buf; if ((len1 + len2 +2) > (int) sizeof(buf)) - tc1= (uchar*) malloc(len1+len2); + tc1= (uchar*) malloc(len1+len2+2); tc2= tc1 + len1+1; memcpy((char*) tc1, (char*) s1, len1); tc1[len1]= 0; /* if length(s1)> len1, need to put 'end of string' */ @@ -568,7 +568,7 @@ int my_strnncollsp_tis620(CHARSET_INFO * cs __attribute__((unused)), a= buf; if ((a_length + b_length +2) > (int) sizeof(buf)) - alloced= a= (uchar*) malloc(a_length+b_length); + alloced= a= (uchar*) malloc(a_length+b_length+2); b= a + a_length+1; memcpy((char*) a, (char*) a0, a_length); From c9a09e12db31c530ffa763e9657dd502db26c5d7 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 16 Nov 2004 13:56:25 +0000 Subject: [PATCH 4/4] ha_ndbcluster.cc: reverting previous patch sql/ha_ndbcluster.cc: reverting previous patch --- sql/ha_ndbcluster.cc | 7 ------- 1 file changed, 7 deletions(-) diff --git a/sql/ha_ndbcluster.cc b/sql/ha_ndbcluster.cc index bc1c887bfab..cdbf2eb3d6a 100644 --- a/sql/ha_ndbcluster.cc +++ b/sql/ha_ndbcluster.cc @@ -148,13 +148,6 @@ static int ndb_to_mysql_error(const NdbError *err) return err->code; } } - // Push the NDB error message as warning - // this since e.g. HA_ERR_RECORD_FILE_FULL maps to - // several error codes in NDB, and the uses needs - // to know which one it is - push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR, - ER_GET_ERRMSG, ER(ER_GET_ERRMSG), - err->code, err->message, "NDB"); return err_map[i].my_err; }