mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
SET OPTION SQL_QUOTE_SHOW_CREATE = 0 | 1
It makes SHOW CREATE TABLE to quote table and column names. This is ON by default ! configure.in: REAL fix for mkstemp() sql/lex.h: SET OPTION SQL_QUOTE_SHOW_CREATE = 0 | 1 sql/sql_yacc.yy: SET OPTION SQL_QUOTE_SHOW_CREATE = 0 | 1 sql/mysql_priv.h: SET OPTION SQL_QUOTE_SHOW_CREATE = 0 | 1 sql/mysqld.cc: SET OPTION SQL_QUOTE_SHOW_CREATE = 0 | 1 sql/sql_show.cc: SET OPTION SQL_QUOTE_SHOW_CREATE = 0 | 1 Docs/manual.texi: SET OPTION SQL_QUOTE_SHOW_CREATE = 0 | 1
This commit is contained in:
744
Docs/manual.texi
744
Docs/manual.texi
File diff suppressed because it is too large
Load Diff
@ -1238,7 +1238,7 @@ AC_CHECK_FUNCS(alarm bmove \
|
|||||||
cuserid fcntl fconvert \
|
cuserid fcntl fconvert \
|
||||||
getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \
|
getrusage getpwuid getcwd getrlimit getwd index stpcpy locking longjmp \
|
||||||
perror pread realpath rename \
|
perror pread realpath rename \
|
||||||
socket strnlen madvise \
|
socket strnlen madvise mkstemp \
|
||||||
strtol strtoul strtoull snprintf tempnam thr_setconcurrency \
|
strtol strtoul strtoull snprintf tempnam thr_setconcurrency \
|
||||||
gethostbyaddr_r gethostbyname_r getpwnam \
|
gethostbyaddr_r gethostbyname_r getpwnam \
|
||||||
bfill bzero bcmp strstr strpbrk strerror\
|
bfill bzero bcmp strstr strpbrk strerror\
|
||||||
|
@ -275,6 +275,7 @@ static SYMBOL symbols[] = {
|
|||||||
{ "SQL_LOG_UPDATE", SYM(SQL_LOG_UPDATE),0,0},
|
{ "SQL_LOG_UPDATE", SYM(SQL_LOG_UPDATE),0,0},
|
||||||
{ "SQL_LOW_PRIORITY_UPDATES", SYM(SQL_LOW_PRIORITY_UPDATES),0,0},
|
{ "SQL_LOW_PRIORITY_UPDATES", SYM(SQL_LOW_PRIORITY_UPDATES),0,0},
|
||||||
{ "SQL_MAX_JOIN_SIZE",SYM(SQL_MAX_JOIN_SIZE), 0, 0},
|
{ "SQL_MAX_JOIN_SIZE",SYM(SQL_MAX_JOIN_SIZE), 0, 0},
|
||||||
|
{ "SQL_QUOTE_SHOW_CREATE",SYM(SQL_QUOTE_SHOW_CREATE), 0, 0},
|
||||||
{ "SQL_SAFE_UPDATES", SYM(SQL_SAFE_UPDATES),0,0},
|
{ "SQL_SAFE_UPDATES", SYM(SQL_SAFE_UPDATES),0,0},
|
||||||
{ "SQL_SELECT_LIMIT", SYM(SQL_SELECT_LIMIT),0,0},
|
{ "SQL_SELECT_LIMIT", SYM(SQL_SELECT_LIMIT),0,0},
|
||||||
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0},
|
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT),0,0},
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
the Free Software Foundation; either version 2 of the License, or
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
(at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
@ -57,7 +57,7 @@ void kill_one_thread(THD *thd, ulong id);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
Configuration parameters
|
Configuration parameters
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#define ACL_CACHE_SIZE 256
|
#define ACL_CACHE_SIZE 256
|
||||||
@ -83,7 +83,7 @@ void kill_one_thread(THD *thd, ulong id);
|
|||||||
// Number of rows in a reference table when refereed through a not unique key.
|
// Number of rows in a reference table when refereed through a not unique key.
|
||||||
// This value is only used when we don't know anything about the key
|
// This value is only used when we don't know anything about the key
|
||||||
// distribution.
|
// distribution.
|
||||||
#define MATCHING_ROWS_IN_OTHER_TABLE 10
|
#define MATCHING_ROWS_IN_OTHER_TABLE 10
|
||||||
|
|
||||||
/* Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used) */
|
/* Don't pack string keys shorter than this (if PACK_KEYS=1 isn't used) */
|
||||||
#define KEY_DEFAULT_PACK_LENGTH 8
|
#define KEY_DEFAULT_PACK_LENGTH 8
|
||||||
@ -158,6 +158,7 @@ void kill_one_thread(THD *thd, ulong id);
|
|||||||
#define OPTION_AUTO_COMMIT OPTION_BIN_LOG*2
|
#define OPTION_AUTO_COMMIT OPTION_BIN_LOG*2
|
||||||
#define OPTION_BEGIN OPTION_AUTO_COMMIT*2
|
#define OPTION_BEGIN OPTION_AUTO_COMMIT*2
|
||||||
#define OPTION_QUICK OPTION_BEGIN*2
|
#define OPTION_QUICK OPTION_BEGIN*2
|
||||||
|
#define OPTION_QUOTE_SHOW_CREATE OPTION_QUICK*2
|
||||||
|
|
||||||
#define RAID_BLOCK_SIZE 1024
|
#define RAID_BLOCK_SIZE 1024
|
||||||
|
|
||||||
|
@ -188,7 +188,8 @@ uint test_flags, select_errors=0, dropping_tables=0,ha_open_options=0;
|
|||||||
uint volatile thread_count=0, thread_running=0, kill_cached_threads=0,
|
uint volatile thread_count=0, thread_running=0, kill_cached_threads=0,
|
||||||
wake_thread=0, global_read_lock=0;
|
wake_thread=0, global_read_lock=0;
|
||||||
ulong thd_startup_options=(OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL |
|
ulong thd_startup_options=(OPTION_UPDATE_LOG | OPTION_AUTO_IS_NULL |
|
||||||
OPTION_BIN_LOG | OPTION_AUTO_COMMIT);
|
OPTION_BIN_LOG | OPTION_AUTO_COMMIT |
|
||||||
|
OPTION_QUOTE_SHOW_CREATE );
|
||||||
uint protocol_version=PROTOCOL_VERSION;
|
uint protocol_version=PROTOCOL_VERSION;
|
||||||
ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
|
ulong keybuff_size,sortbuff_size,max_item_sort_length,table_cache_size,
|
||||||
max_join_size,join_buff_size,tmp_table_size,thread_stack,
|
max_join_size,join_buff_size,tmp_table_size,thread_stack,
|
||||||
|
@ -37,7 +37,10 @@ static int mysql_find_files(THD *thd,List<char> *files, const char *db,
|
|||||||
const char *path, const char *wild, bool dir);
|
const char *path, const char *wild, bool dir);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
store_create_info(THD *thd, TABLE *table, String* packet);
|
store_create_info(THD *thd, TABLE *table, String *packet);
|
||||||
|
|
||||||
|
static void
|
||||||
|
append_identifier(THD *thd, String *packet, const char *name);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
** Send list of databases
|
** Send list of databases
|
||||||
@ -668,8 +671,23 @@ mysqld_dump_create_info(THD *thd, TABLE *table, int fd)
|
|||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
append_identifier(THD *thd, String *packet, const char *name)
|
||||||
|
{
|
||||||
|
if (thd->options & OPTION_QUOTE_SHOW_CREATE)
|
||||||
|
{
|
||||||
|
packet->append("`", 1);
|
||||||
|
packet->append(name);
|
||||||
|
packet->append("`", 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
packet->append(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
store_create_info(THD *thd, TABLE *table, String* packet)
|
store_create_info(THD *thd, TABLE *table, String *packet)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("store_create_info");
|
DBUG_ENTER("store_create_info");
|
||||||
DBUG_PRINT("enter",("table: %s",table->real_name));
|
DBUG_PRINT("enter",("table: %s",table->real_name));
|
||||||
@ -680,7 +698,7 @@ store_create_info(THD *thd, TABLE *table, String* packet)
|
|||||||
char tmp[MAX_FIELD_WIDTH];
|
char tmp[MAX_FIELD_WIDTH];
|
||||||
String type(tmp, sizeof(tmp));
|
String type(tmp, sizeof(tmp));
|
||||||
packet->append("CREATE TABLE ", 13);
|
packet->append("CREATE TABLE ", 13);
|
||||||
packet->append(table->real_name);
|
append_identifier(thd,packet,table->real_name);
|
||||||
packet->append(" (\n", 3);
|
packet->append(" (\n", 3);
|
||||||
|
|
||||||
Field **ptr,*field;
|
Field **ptr,*field;
|
||||||
@ -691,7 +709,7 @@ store_create_info(THD *thd, TABLE *table, String* packet)
|
|||||||
|
|
||||||
uint flags = field->flags;
|
uint flags = field->flags;
|
||||||
packet->append(" ", 2);
|
packet->append(" ", 2);
|
||||||
packet->append(field->field_name);
|
append_identifier(thd,packet,field->field_name);
|
||||||
packet->append(' ');
|
packet->append(' ');
|
||||||
// check for surprises from the previous call to Field::sql_type()
|
// check for surprises from the previous call to Field::sql_type()
|
||||||
if(type.ptr() != tmp)
|
if(type.ptr() != tmp)
|
||||||
@ -746,7 +764,7 @@ store_create_info(THD *thd, TABLE *table, String* packet)
|
|||||||
packet->append("KEY ", 4);
|
packet->append("KEY ", 4);
|
||||||
|
|
||||||
if(i != primary_key)
|
if(i != primary_key)
|
||||||
packet->append(key_info->name);
|
append_identifier(thd,packet,key_info->name);
|
||||||
|
|
||||||
packet->append('(');
|
packet->append('(');
|
||||||
|
|
||||||
@ -756,7 +774,7 @@ store_create_info(THD *thd, TABLE *table, String* packet)
|
|||||||
packet->append(',');
|
packet->append(',');
|
||||||
|
|
||||||
if (key_part->field)
|
if (key_part->field)
|
||||||
packet->append(key_part->field->field_name);
|
append_identifier(thd,packet,key_part->field->field_name);
|
||||||
if (!key_part->field ||
|
if (!key_part->field ||
|
||||||
(key_part->length !=
|
(key_part->length !=
|
||||||
table->field[key_part->fieldnr-1]->key_length() &&
|
table->field[key_part->fieldnr-1]->key_length() &&
|
||||||
|
@ -407,6 +407,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
|
|||||||
%token SQL_WARNINGS
|
%token SQL_WARNINGS
|
||||||
%token SQL_AUTO_IS_NULL
|
%token SQL_AUTO_IS_NULL
|
||||||
%token SQL_SAFE_UPDATES
|
%token SQL_SAFE_UPDATES
|
||||||
|
%token SQL_QUOTE_SHOW_CREATE
|
||||||
|
|
||||||
%left SET_VAR
|
%left SET_VAR
|
||||||
%left OR_OR_CONCAT OR
|
%left OR_OR_CONCAT OR
|
||||||
@ -530,7 +531,7 @@ query:
|
|||||||
verb_clause:
|
verb_clause:
|
||||||
alter
|
alter
|
||||||
| analyze
|
| analyze
|
||||||
| backup
|
| backup
|
||||||
| begin
|
| begin
|
||||||
| change
|
| change
|
||||||
| check
|
| check
|
||||||
@ -549,7 +550,7 @@ verb_clause:
|
|||||||
| rename
|
| rename
|
||||||
| repair
|
| repair
|
||||||
| replace
|
| replace
|
||||||
| restore
|
| restore
|
||||||
| revoke
|
| revoke
|
||||||
| rollback
|
| rollback
|
||||||
| select
|
| select
|
||||||
@ -2096,7 +2097,7 @@ opt_low_priority:
|
|||||||
/* Delete rows from a table */
|
/* Delete rows from a table */
|
||||||
|
|
||||||
delete:
|
delete:
|
||||||
DELETE_SYM
|
DELETE_SYM
|
||||||
{ Lex->sql_command= SQLCOM_DELETE; Lex->options=0;
|
{ Lex->sql_command= SQLCOM_DELETE; Lex->options=0;
|
||||||
Lex->lock_option= current_thd->update_lock_default; }
|
Lex->lock_option= current_thd->update_lock_default; }
|
||||||
opt_delete_options FROM table
|
opt_delete_options FROM table
|
||||||
@ -2620,6 +2621,7 @@ set_option:
|
|||||||
| SQL_AUTO_IS_NULL { $$= OPTION_AUTO_IS_NULL; }
|
| SQL_AUTO_IS_NULL { $$= OPTION_AUTO_IS_NULL; }
|
||||||
| SQL_SAFE_UPDATES { $$= OPTION_SAFE_UPDATES; }
|
| SQL_SAFE_UPDATES { $$= OPTION_SAFE_UPDATES; }
|
||||||
| SQL_BUFFER_RESULT { $$= OPTION_BUFFER_RESULT; }
|
| SQL_BUFFER_RESULT { $$= OPTION_BUFFER_RESULT; }
|
||||||
|
| SQL_QUOTE_SHOW_CREATE { $$= OPTION_QUOTE_SHOW_CREATE; }
|
||||||
|
|
||||||
/* Lock function */
|
/* Lock function */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user