From 1a7533074ebe8e6ce1ed6af999a46be86f08d684 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 10 Nov 2002 14:45:21 +0400 Subject: [PATCH] Fix syntax to be more clean: SHOW CREATE DATABASE [WITH IF NOT EXISTS] dbname --- client/mysqldump.c | 2 +- sql/sql_yacc.yy | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 9470786705d..c99f1429a8b 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -1252,7 +1252,7 @@ static int init_dumping(char *database) MYSQL_ROW row; MYSQL_RES *dbinfo; - sprintf(qbuf,"SHOW CREATE DATABASE IF NOT EXISTS %s",database); + sprintf(qbuf,"SHOW CREATE DATABASE WITH IF NOT EXISTS %s",database); if (mysql_query(sock, qbuf) || !(dbinfo = mysql_store_result(sock))) { diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 6235d93c18f..d432a76770d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -549,7 +549,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize); type int_type real_type order_dir opt_field_spec lock_option udf_type if_exists opt_local opt_table_options table_options table_option opt_if_not_exists opt_var_type opt_var_ident_type - delete_option + delete_option opt_with_if_not_exists %type ULONG_NUM raid_types merge_insert_types @@ -878,6 +878,10 @@ opt_if_not_exists: /* empty */ { $$= 0; } | IF NOT EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; }; +opt_with_if_not_exists: + /* empty */ { $$= 0; } + | WITH IF NOT EXISTS { $$=HA_LEX_CREATE_IF_NOT_EXISTS; }; + opt_create_table_options: /* empty */ | create_table_options; @@ -3106,7 +3110,7 @@ show_param: lex->grant_user=$3; lex->grant_user->password.str=NullS; } - | CREATE DATABASE opt_if_not_exists ident + | CREATE DATABASE opt_with_if_not_exists ident { Lex->sql_command=SQLCOM_SHOW_CREATE_DB; Lex->create_info.options=$3;