From fd352c22841c23cad5d765ea4799639783341481 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Wed, 14 Jan 2004 11:52:25 +0100 Subject: [PATCH] bugs #2280, #2281 - show create table should always return a valid sql statement --- sql/sql_show.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 52f7e6cb9ed..ab761ad761d 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -997,6 +997,19 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd) DBUG_RETURN(0); } +/* possible TODO: call find_keyword() from sql_lex.cc here */ +static bool require_quotes(const char *name, uint length) +{ + uint i, d, c; + for (i=0; iident_map[c]) + return 1; + } + return 0; +} void append_identifier(THD *thd, String *packet, const char *name, uint length) @@ -1007,7 +1020,8 @@ append_identifier(THD *thd, String *packet, const char *name, uint length) else qtype= '`'; - if (thd->options & OPTION_QUOTE_SHOW_CREATE) + if ((thd->options & OPTION_QUOTE_SHOW_CREATE) || + require_quotes(name, length)) { packet->append(&qtype, 1); packet->append(name, length, system_charset_info);