diff options
author | unknown <marko@hundin.mysql.fi> | 2004-10-01 11:51:59 +0300 |
---|---|---|
committer | unknown <marko@hundin.mysql.fi> | 2004-10-01 11:51:59 +0300 |
commit | a418a35ceba85354328b5f75bb4e908f88b6759f (patch) | |
tree | cd5df16f04eff773fc341cd412fa9d695ff0680c /sql/sql_show.cc | |
parent | 927179ecd464e6dca78d0eabc2653ec63072456f (diff) | |
download | mariadb-git-a418a35ceba85354328b5f75bb4e908f88b6759f.tar.gz |
InnoDB: quote identifiers according to MySQL settings (Bug #5292)
innobase/btr/btr0btr.c:
Add parameter to ut_print_name() and dict_index_name_print() calls
innobase/btr/btr0cur.c:
Add parameter to dict_index_name_print() calls
innobase/buf/buf0buf.c:
Add parameter to dict_index_name_print() calls
innobase/dict/dict0crea.c:
Add parameter to ut_print_name() calls
innobase/dict/dict0dict.c:
Add parameter to ut_print_name() calls
Update documentation links to http://dev.mysql.com
innobase/dict/dict0load.c:
Add parameter to ut_print_name() calls
innobase/fil/fil0fil.c:
Use ut_print_filename()
Update links to documentation to http://dev.mysql.com
innobase/ibuf/ibuf0ibuf.c:
Replaced printf(...) with fprintf(stderr,...)
innobase/include/dict0dict.h:
Added trx parameters
innobase/include/row0row.h:
Added trx parameter
innobase/include/row0sel.h:
Added trx parameter
innobase/include/row0upd.h:
Added trx parameters
innobase/include/row0upd.ic:
Added trx parameter for dict_index_name_print()
innobase/include/trx0rec.h:
Added trx parameter
innobase/include/ut0ut.h:
Added ut_print_filename()
Added trx parameter to ut_print_name() and ut_print_namel()
innobase/lock/lock0lock.c:
Added parameter to dict_index_name_print() and ut_print_name() calls
innobase/page/page0page.c:
Added parameter to dict_index_name_print() calls
innobase/pars/pars0opt.c:
Added parameter to dict_index_name_print() call
innobase/pars/pars0pars.c:
Added parameter to upd_field_set_field_no() call
innobase/row/row0ins.c:
Added trx parameters
innobase/row/row0mysql.c:
Added trx parameters
innobase/row/row0purge.c:
Added trx parameter
innobase/row/row0row.c:
Added trx parameter
innobase/row/row0sel.c:
Added trx parameters
innobase/row/row0umod.c:
Added trx parameters
innobase/row/row0upd.c:
Added trx parameters
innobase/trx/trx0rec.c:
Added trx parameters
innobase/trx/trx0roll.c:
Added parameter to ut_print_name() calls
innobase/ut/ut0ut.c:
Added ut_print_filename()
Added trx parameter to ut_print_namel() and ut_print_name() calls
sql/ha_innodb.cc:
Added trx parameters
Rewrote mysql_get_identifier_quote_char()
sql/mysql_priv.h:
Added get_quote_char_for_identifier()
sql/sql_show.cc:
Added get_quote_char_for_identifier()
Removed append_quoted_simple_identifier()
Make append_identifier() use get_quote_char_for_identifier()
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r-- | sql/sql_show.cc | 46 |
1 files changed, 20 insertions, 26 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc index fbb45ce2484..6a380664cb7 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -1143,40 +1143,18 @@ static const char *require_quotes(const char *name, uint name_length) } -static void append_quoted_simple_identifier(String *packet, char quote_char, - const char *name, uint length) -{ - packet->append("e_char, 1, system_charset_info); - packet->append(name, length, system_charset_info); - packet->append("e_char, 1, system_charset_info); -} - - void append_identifier(THD *thd, String *packet, const char *name, uint length) { const char *name_end; - char quote_char; + int q= get_quote_char_for_identifier(thd, name, length); - if (thd->variables.sql_mode & MODE_ANSI_QUOTES) - quote_char= '\"'; - else - quote_char= '`'; - - if (is_keyword(name,length)) - { - append_quoted_simple_identifier(packet, quote_char, name, length); + if (q == EOF) { + packet->append(name, length, system_charset_info); return; } - if (!require_quotes(name, length)) - { - if (!(thd->options & OPTION_QUOTE_SHOW_CREATE)) - packet->append(name, length, system_charset_info); - else - append_quoted_simple_identifier(packet, quote_char, name, length); - return; - } + char quote_char= q; /* The identifier must be quoted as it includes a quote character */ @@ -1195,6 +1173,22 @@ append_identifier(THD *thd, String *packet, const char *name, uint length) } +/* Get the quote character for displaying an identifier. + If no quote character is needed, return EOF. */ + +int get_quote_char_for_identifier(THD *thd, const char *name, uint length) +{ + if (!is_keyword(name,length) && + !require_quotes(name, length) && + !(thd->options & OPTION_QUOTE_SHOW_CREATE)) + return EOF; + else if (thd->variables.sql_mode & MODE_ANSI_QUOTES) + return '"'; + else + return '`'; +} + + /* Append directory name (if exists) to CREATE INFO */ static void append_directory(THD *thd, String *packet, const char *dir_type, |