Commit 1286d0f3 authored by Jim Winstead's avatar Jim Winstead

Merge in bug fixes for client tools

parents ed3b0a69 f0f4efd7
...@@ -2302,8 +2302,10 @@ extern "C" char **new_mysql_completion (const char *text, int start, int end); ...@@ -2302,8 +2302,10 @@ extern "C" char **new_mysql_completion (const char *text, int start, int end);
*/ */
#if defined(USE_NEW_READLINE_INTERFACE) #if defined(USE_NEW_READLINE_INTERFACE)
static int fake_magic_space(int, int);
extern "C" char *no_completion(const char*,int) extern "C" char *no_completion(const char*,int)
#elif defined(USE_LIBEDIT_INTERFACE) #elif defined(USE_LIBEDIT_INTERFACE)
static int fake_magic_space(const char *, int);
extern "C" int no_completion(const char*,int) extern "C" int no_completion(const char*,int)
#else #else
extern "C" char *no_completion() extern "C" char *no_completion()
...@@ -2380,6 +2382,18 @@ static int not_in_history(const char *line) ...@@ -2380,6 +2382,18 @@ static int not_in_history(const char *line)
return 1; return 1;
} }
#if defined(USE_NEW_READLINE_INTERFACE)
static int fake_magic_space(int, int)
#else
static int fake_magic_space(const char *, int)
#endif
{
rl_insert(1, ' ');
return 0;
}
static void initialize_readline (char *name) static void initialize_readline (char *name)
{ {
/* Allow conditional parsing of the ~/.inputrc file. */ /* Allow conditional parsing of the ~/.inputrc file. */
...@@ -2389,12 +2403,15 @@ static void initialize_readline (char *name) ...@@ -2389,12 +2403,15 @@ static void initialize_readline (char *name)
#if defined(USE_NEW_READLINE_INTERFACE) #if defined(USE_NEW_READLINE_INTERFACE)
rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion; rl_attempted_completion_function= (rl_completion_func_t*)&new_mysql_completion;
rl_completion_entry_function= (rl_compentry_func_t*)&no_completion; rl_completion_entry_function= (rl_compentry_func_t*)&no_completion;
rl_add_defun("magic-space", (rl_command_func_t *)&fake_magic_space, -1);
#elif defined(USE_LIBEDIT_INTERFACE) #elif defined(USE_LIBEDIT_INTERFACE)
#ifdef HAVE_LOCALE_H #ifdef HAVE_LOCALE_H
setlocale(LC_ALL,""); /* so as libedit use isprint */ setlocale(LC_ALL,""); /* so as libedit use isprint */
#endif #endif
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= &no_completion; rl_completion_entry_function= &no_completion;
rl_add_defun("magic-space", (Function*)&fake_magic_space, -1);
#else #else
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion; rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= &no_completion; rl_completion_entry_function= &no_completion;
...@@ -3308,6 +3325,9 @@ print_table_data(MYSQL_RES *result) ...@@ -3308,6 +3325,9 @@ print_table_data(MYSQL_RES *result)
uint visible_length; uint visible_length;
uint extra_padding; uint extra_padding;
if (off)
(void) tee_fputs(" ", PAGER);
if (cur[off] == NULL) if (cur[off] == NULL)
{ {
buffer= "NULL"; buffer= "NULL";
...@@ -3342,7 +3362,7 @@ print_table_data(MYSQL_RES *result) ...@@ -3342,7 +3362,7 @@ print_table_data(MYSQL_RES *result)
else else
tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, FALSE); tee_print_sized_data(buffer, data_length, field_max_length+extra_padding, FALSE);
} }
tee_fputs(" | ", PAGER); tee_fputs(" |", PAGER);
} }
(void) tee_fputs("\n", PAGER); (void) tee_fputs("\n", PAGER);
} }
......
...@@ -253,8 +253,12 @@ get_one_option(int optid, const struct my_option *opt, ...@@ -253,8 +253,12 @@ get_one_option(int optid, const struct my_option *opt,
break; break;
case 'b': /* --basedir */ case 'b': /* --basedir */
case 'v': /* --verbose */
case 'd': /* --datadir */ case 'd': /* --datadir */
fprintf(stderr, "%s: the '--%s' option is always ignored\n",
my_progname, optid == 'b' ? "basedir" : "datadir");
/* FALLTHROUGH */
case 'v': /* --verbose */
case 'f': /* --force */ case 'f': /* --force */
add_option= FALSE; add_option= FALSE;
break; break;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <mysql.h> #include <mysql.h>
#define ADMIN_VERSION "8.42" #define ADMIN_VERSION "8.42"
#define MAX_MYSQL_VAR 256 #define MAX_MYSQL_VAR 512
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */ #define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
#define MAX_TRUNC_LENGTH 3 #define MAX_TRUNC_LENGTH 3
...@@ -371,7 +371,7 @@ int main(int argc,char *argv[]) ...@@ -371,7 +371,7 @@ int main(int argc,char *argv[])
} }
else else
{ {
while (!interrupted && (!opt_count_iterations || nr_iterations)) while (!interrupted)
{ {
new_line = 0; new_line = 0;
if ((error=execute_commands(&mysql,argc,commands))) if ((error=execute_commands(&mysql,argc,commands)))
...@@ -395,11 +395,11 @@ int main(int argc,char *argv[]) ...@@ -395,11 +395,11 @@ int main(int argc,char *argv[])
} }
if (interval) if (interval)
{ {
if (opt_count_iterations && --nr_iterations == 0)
break;
sleep(interval); sleep(interval);
if (new_line) if (new_line)
puts(""); puts("");
if (opt_count_iterations)
nr_iterations--;
} }
else else
break; break;
...@@ -743,6 +743,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -743,6 +743,9 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
mysql_error(mysql)); mysql_error(mysql));
return -1; return -1;
} }
DBUG_ASSERT(mysql_num_rows(res) < MAX_MYSQL_VAR);
if (!opt_vertical) if (!opt_vertical)
print_header(res); print_header(res);
else else
......
...@@ -442,7 +442,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) ...@@ -442,7 +442,7 @@ static int process_selected_tables(char *db, char **table_names, int tables)
{ {
if (use_db(db)) if (use_db(db))
return 1; return 1;
if (opt_all_in_1) if (opt_all_in_1 && what_to_do != DO_UPGRADE)
{ {
/* /*
We need table list in form `a`, `b`, `c` We need table list in form `a`, `b`, `c`
...@@ -536,7 +536,7 @@ static int process_all_tables_in_db(char *database) ...@@ -536,7 +536,7 @@ static int process_all_tables_in_db(char *database)
num_columns= mysql_num_fields(res); num_columns= mysql_num_fields(res);
if (opt_all_in_1) if (opt_all_in_1 && what_to_do != DO_UPGRADE)
{ {
/* /*
We need table list in form `a`, `b`, `c` We need table list in form `a`, `b`, `c`
......
...@@ -4810,7 +4810,8 @@ static my_bool get_view_structure(char *table, char* db) ...@@ -4810,7 +4810,8 @@ static my_bool get_view_structure(char *table, char* db)
result_table); result_table);
check_io(sql_file); check_io(sql_file);
} }
fprintf(sql_file, "/*!50001 DROP TABLE %s*/;\n", opt_quoted_table); /* Table might not exist if this view was dumped with --tab. */
fprintf(sql_file, "/*!50001 DROP TABLE IF EXISTS %s*/;\n", opt_quoted_table);
if (opt_drop) if (opt_drop)
{ {
fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
......
...@@ -303,7 +303,8 @@ static int get_options(int *argc, char ***argv) ...@@ -303,7 +303,8 @@ static int get_options(int *argc, char ***argv)
static int write_to_table(char *filename, MYSQL *mysql) static int write_to_table(char *filename, MYSQL *mysql)
{ {
char tablename[FN_REFLEN], hard_path[FN_REFLEN], char tablename[FN_REFLEN], hard_path[FN_REFLEN],
sql_statement[FN_REFLEN*16+256], *end; escaped_name[FN_REFLEN * 2 + 1],
sql_statement[FN_REFLEN*16+256], *end, *pos;
DBUG_ENTER("write_to_table"); DBUG_ENTER("write_to_table");
DBUG_PRINT("enter",("filename: %s",filename)); DBUG_PRINT("enter",("filename: %s",filename));
...@@ -338,15 +339,25 @@ static int write_to_table(char *filename, MYSQL *mysql) ...@@ -338,15 +339,25 @@ static int write_to_table(char *filename, MYSQL *mysql)
fprintf(stdout, "Loading data from SERVER file: %s into %s\n", fprintf(stdout, "Loading data from SERVER file: %s into %s\n",
hard_path, tablename); hard_path, tablename);
} }
mysql_real_escape_string(mysql, escaped_name, hard_path,
(unsigned long) strlen(hard_path));
sprintf(sql_statement, "LOAD DATA %s %s INFILE '%s'", sprintf(sql_statement, "LOAD DATA %s %s INFILE '%s'",
opt_low_priority ? "LOW_PRIORITY" : "", opt_low_priority ? "LOW_PRIORITY" : "",
opt_local_file ? "LOCAL" : "", hard_path); opt_local_file ? "LOCAL" : "", escaped_name);
end= strend(sql_statement); end= strend(sql_statement);
if (replace) if (replace)
end= strmov(end, " REPLACE"); end= strmov(end, " REPLACE");
if (ignore) if (ignore)
end= strmov(end, " IGNORE"); end= strmov(end, " IGNORE");
end= strmov(strmov(end, " INTO TABLE "), tablename); end= strmov(end, " INTO TABLE `");
/* Turn any ` into `` in table name. */
for (pos= tablename; *pos; pos++)
{
if (*pos == '`')
*end++= '`';
*end++= *pos;
}
end= strmov(end, "`");
if (fields_terminated || enclosed || opt_enclosed || escaped) if (fields_terminated || enclosed || opt_enclosed || escaped)
end= strmov(end, " FIELDS"); end= strmov(end, " FIELDS");
......
...@@ -565,8 +565,7 @@ static struct my_option my_long_options[] = ...@@ -565,8 +565,7 @@ static struct my_option my_long_options[] =
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"csv", OPT_SLAP_CSV, {"csv", OPT_SLAP_CSV,
"Generate CSV output to named file or to stdout if no file is named.", "Generate CSV output to named file or to stdout if no file is named.",
(uchar**) &opt_csv_str, (uchar**) &opt_csv_str, 0, GET_STR, NULL, NULL, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
OPT_ARG, 0, 0, 0, 0, 0, 0},
#ifdef DBUG_OFF #ifdef DBUG_OFF
{"debug", '#', "This is a non-debug version. Catch this and exit.", {"debug", '#', "This is a non-debug version. Catch this and exit.",
0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, 0, 0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0},
...@@ -740,6 +739,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), ...@@ -740,6 +739,11 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)),
DBUG_PUSH(argument ? argument : default_dbug_option); DBUG_PUSH(argument ? argument : default_dbug_option);
debug_check_flag= 1; debug_check_flag= 1;
break; break;
case OPT_SLAP_CSV:
if (!argument)
argument= (char *)"-"; /* use stdout */
opt_csv_str= argument;
break;
#include <sslopt-case.h> #include <sslopt-case.h>
case 'V': case 'V':
print_version(); print_version();
......
...@@ -64,28 +64,28 @@ drop table t1; ...@@ -64,28 +64,28 @@ drop table t1;
+----------------------+------------+--------+ +----------------------+------------+--------+
| concat('>',col1,'<') | col2 | col3 | | concat('>',col1,'<') | col2 | col3 |
+----------------------+------------+--------+ +----------------------+------------+--------+
| >a < | b | 123421 | | >a < | b | 123421 |
| >a < | 0123456789 | 4 | | >a < | 0123456789 | 4 |
| >abcd< | | 4 | | >abcd< | | 4 |
+----------------------+------------+--------+ +----------------------+------------+--------+
+-------------------+ +-------------------+
| __tañgè Ñãmé | | __tañgè Ñãmé |
+-------------------+ +-------------------+
| John Doe | | John Doe |
+-------------------+ +-------------------+
+-------------------+ +-------------------+
| John Doe | | John Doe |
+-------------------+ +-------------------+
| __tañgè Ñãmé | | __tañgè Ñãmé |
+-------------------+ +-------------------+
+------+------+---------------------------+ +------+------+---------------------------+
| i | j | k | | i | j | k |
+------+------+---------------------------+ +------+------+---------------------------+
| 1 | NULL | NULL | | 1 | NULL | NULL |
| NULL | NULL | <-----------------------> | | NULL | NULL | <-----------------------> |
| NULL | NULL | <----- | | NULL | NULL | <----- |
| NULL | NULL | Τη γλώσσα | | NULL | NULL | Τη γλώσσα |
| NULL | NULL | ᛖᚴ ᚷᛖᛏ | | NULL | NULL | ᛖᚴ ᚷᛖᛏ |
+------+------+---------------------------+ +------+------+---------------------------+
i j k i j k
NULL 1 NULL NULL 1 NULL
...@@ -96,14 +96,14 @@ k int(11) YES NULL ...@@ -96,14 +96,14 @@ k int(11) YES NULL
+------+---+------+ +------+---+------+
| i | j | k | | i | j | k |
+------+---+------+ +------+---+------+
| NULL | 1 | NULL | | NULL | 1 | NULL |
+------+---+------+ +------+---+------+
+-------+---------+------+-----+---------+-------+ +-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra | | Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+ +-------+---------+------+-----+---------+-------+
| i | int(11) | YES | | NULL | | | i | int(11) | YES | | NULL | |
| j | int(11) | NO | | NULL | | | j | int(11) | NO | | NULL | |
| k | int(11) | YES | | NULL | | | k | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+ +-------+---------+------+-----+---------+-------+
i s1 i s1
1 x 1 x
...@@ -112,16 +112,16 @@ i s1 ...@@ -112,16 +112,16 @@ i s1
+------+------+ +------+------+
| i | s1 | | i | s1 |
+------+------+ +------+------+
| 1 | x | | 1 | x |
| 2 | NULL | | 2 | NULL |
| 3 | | | 3 | |
+------+------+ +------+------+
unhex('zz') unhex('zz')
NULL NULL
+-------------+ +-------------+
| unhex('zz') | | unhex('zz') |
+-------------+ +-------------+
| NULL | | NULL |
+-------------+ +-------------+
create table t1(a int, b varchar(255), c int); create table t1(a int, b varchar(255), c int);
Field Type Null Key Default Extra Field Type Null Key Default Extra
......
...@@ -186,4 +186,18 @@ a ...@@ -186,4 +186,18 @@ a
500 500
DROP DATABASE `a@b`; DROP DATABASE `a@b`;
USE test; USE test;
#
# Bug #31821: --all-in-1 and --fix-table-names don't work together
#
drop table if exists `#mysql50#t1-1`;
create table `#mysql50#t1-1` (a int);
show tables like 't1-1';
Tables_in_test (t1-1)
t1-1
drop table `t1-1`;
create table `#mysql50#t1-1` (a int);
show tables like 't1-1';
Tables_in_test (t1-1)
t1-1
drop table `t1-1`;
End of 5.1 tests End of 5.1 tests
...@@ -1991,7 +1991,7 @@ SET character_set_client = utf8; ...@@ -1991,7 +1991,7 @@ SET character_set_client = utf8;
`a` varchar(30) `a` varchar(30)
) ENGINE=MyISAM */; ) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -2085,7 +2085,7 @@ SET character_set_client = utf8; ...@@ -2085,7 +2085,7 @@ SET character_set_client = utf8;
`a` int(11) `a` int(11)
) ENGINE=MyISAM */; ) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -2159,7 +2159,7 @@ SET character_set_client = utf8; ...@@ -2159,7 +2159,7 @@ SET character_set_client = utf8;
`a` varchar(30) `a` varchar(30)
) ENGINE=MyISAM */; ) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -2293,7 +2293,7 @@ SET character_set_client = utf8; ...@@ -2293,7 +2293,7 @@ SET character_set_client = utf8;
`c` varchar(30) `c` varchar(30)
) ENGINE=MyISAM */; ) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -2307,7 +2307,7 @@ SET character_set_client = @saved_cs_client; ...@@ -2307,7 +2307,7 @@ SET character_set_client = @saved_cs_client;
/*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -2321,7 +2321,7 @@ SET character_set_client = @saved_cs_client; ...@@ -2321,7 +2321,7 @@ SET character_set_client = @saved_cs_client;
/*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE `v3`*/; /*!50001 DROP TABLE IF EXISTS `v3`*/;
/*!50001 DROP VIEW IF EXISTS `v3`*/; /*!50001 DROP VIEW IF EXISTS `v3`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -3054,7 +3054,7 @@ SET character_set_client = utf8; ...@@ -3054,7 +3054,7 @@ SET character_set_client = utf8;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
USE `test`; USE `test`;
/*!50001 DROP TABLE `v0`*/; /*!50001 DROP TABLE IF EXISTS `v0`*/;
/*!50001 DROP VIEW IF EXISTS `v0`*/; /*!50001 DROP VIEW IF EXISTS `v0`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -3068,7 +3068,7 @@ USE `test`; ...@@ -3068,7 +3068,7 @@ USE `test`;
/*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -3082,7 +3082,7 @@ USE `test`; ...@@ -3082,7 +3082,7 @@ USE `test`;
/*!50001 SET character_set_client = @saved_cs_client */; /*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */; /*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 SET collation_connection = @saved_col_connection */;
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -3320,7 +3320,7 @@ insert into t values(5, 51); ...@@ -3320,7 +3320,7 @@ insert into t values(5, 51);
create view v1 as select qty, price, qty*price as value from t; create view v1 as select qty, price, qty*price as value from t;
create view v2 as select qty from v1; create view v2 as select qty from v1;
mysqldump { mysqldump {
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET @saved_col_connection = @@collation_connection */;
...@@ -3335,7 +3335,7 @@ mysqldump { ...@@ -3335,7 +3335,7 @@ mysqldump {
/*!50001 SET collation_connection = @saved_col_connection */; /*!50001 SET collation_connection = @saved_col_connection */;
} mysqldump { } mysqldump {
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET @saved_col_connection = @@collation_connection */;
...@@ -3434,7 +3434,7 @@ SET character_set_client = utf8; ...@@ -3434,7 +3434,7 @@ SET character_set_client = utf8;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
USE `mysqldump_test_db`; USE `mysqldump_test_db`;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -3496,7 +3496,7 @@ SET character_set_client = @saved_cs_client; ...@@ -3496,7 +3496,7 @@ SET character_set_client = @saved_cs_client;
USE `mysqldump_tables`; USE `mysqldump_tables`;
USE `mysqldump_views`; USE `mysqldump_views`;
/*!50001 DROP TABLE `nasishnasifu`*/; /*!50001 DROP TABLE IF EXISTS `nasishnasifu`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */; /*!50001 SET @saved_col_connection = @@collation_connection */;
...@@ -3885,7 +3885,7 @@ SET character_set_client = utf8; ...@@ -3885,7 +3885,7 @@ SET character_set_client = utf8;
`c` int(11) `c` int(11)
) ENGINE=MyISAM */; ) ENGINE=MyISAM */;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
/*!50001 DROP TABLE `v2`*/; /*!50001 DROP TABLE IF EXISTS `v2`*/;
/*!50001 DROP VIEW IF EXISTS `v2`*/; /*!50001 DROP VIEW IF EXISTS `v2`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -4304,7 +4304,7 @@ SET character_set_client = utf8; ...@@ -4304,7 +4304,7 @@ SET character_set_client = utf8;
SET character_set_client = @saved_cs_client; SET character_set_client = @saved_cs_client;
USE `mysqldump_test_db`; USE `mysqldump_test_db`;
/*!50001 DROP TABLE `v1`*/; /*!50001 DROP TABLE IF EXISTS `v1`*/;
/*!50001 DROP VIEW IF EXISTS `v1`*/; /*!50001 DROP VIEW IF EXISTS `v1`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */; /*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */; /*!50001 SET @saved_cs_results = @@character_set_results */;
...@@ -4430,6 +4430,25 @@ DROP DATABASE mysqldump_test_db; ...@@ -4430,6 +4430,25 @@ DROP DATABASE mysqldump_test_db;
# -- End of test case for Bug#32538. # -- End of test case for Bug#32538.
#
# Bug#37377 Incorrect DROP TABLE statement in dump of a VIEW using --tab
#
create table t1 (a int);
create view v1 as select a from t1;
drop view v1;
drop table t1;
drop view v1;
drop table t1;
#
# Bug#28071 mysqlimport does not quote or escape table name
#
drop table if exists `load`;
create table `load` (a varchar(255));
test.load: Records: 70 Deleted: 0 Skipped: 0 Warnings: 0
select count(*) from `load`;
count(*)
70
drop table `load`;
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
Bug #34861 - mysqldump with --tab gives weird output for triggers. Bug #34861 - mysqldump with --tab gives weird output for triggers.
......
...@@ -5,45 +5,45 @@ ...@@ -5,45 +5,45 @@
+----------+--------+ +----------+--------+
| expected | result | | expected | result |
+----------+--------+ +----------+--------+
| 2 | 2 | | 2 | 2 |
+----------+--------+ +----------+--------+
+----------+--------+ +----------+--------+
| expected | result | | expected | result |
+----------+--------+ +----------+--------+
| 1 | 1 | | 1 | 1 |
+----------+--------+ +----------+--------+
+----------+--------+ +----------+--------+
| expected | result | | expected | result |
+----------+--------+ +----------+--------+
| 3 | 3 | | 3 | 3 |
+----------+--------+ +----------+--------+
+----------+--------+ +----------+--------+
| expected | result | | expected | result |
+----------+--------+ +----------+--------+
| 2 | 2 | | 2 | 2 |
+----------+--------+ +----------+--------+
+----------+--------+ +----------+--------+
| expected | result | | expected | result |
+----------+--------+ +----------+--------+
| 7 | 7 | | 7 | 7 |
+----------+--------+ +----------+--------+
+----------+--------+ +----------+--------+
| expected | result | | expected | result |
+----------+--------+ +----------+--------+
| 8 | 8 | | 8 | 8 |
+----------+--------+ +----------+--------+
+----------+--------+ +----------+--------+
| expected | result | | expected | result |
+----------+--------+ +----------+--------+
| 7 | 7 | | 7 | 7 |
+----------+--------+ +----------+--------+
+----------+--------+ +----------+--------+
| expected | result | | expected | result |
+----------+--------+ +----------+--------+
| 4 | 4 | | 4 | 4 |
+----------+--------+ +----------+--------+
+----------+--------+ +----------+--------+
| expected | result | | expected | result |
+----------+--------+ +----------+--------+
| 4 | 4 | | 4 | 4 |
+----------+--------+ +----------+--------+
...@@ -193,5 +193,22 @@ DROP DATABASE `a@b`; ...@@ -193,5 +193,22 @@ DROP DATABASE `a@b`;
USE test; USE test;
--echo #
--echo # Bug #31821: --all-in-1 and --fix-table-names don't work together
--echo #
--disable_warnings
drop table if exists `#mysql50#t1-1`;
--enable_warnings
create table `#mysql50#t1-1` (a int);
--exec $MYSQL_CHECK --all-in-1 --fix-table-names --databases test
show tables like 't1-1';
drop table `t1-1`;
create table `#mysql50#t1-1` (a int);
--exec $MYSQL_CHECK --all-in-1 --fix-table-names test "#mysql50#t1-1"
show tables like 't1-1';
drop table `t1-1`;
--echo End of 5.1 tests --echo End of 5.1 tests
...@@ -1947,8 +1947,50 @@ DROP DATABASE mysqldump_test_db; ...@@ -1947,8 +1947,50 @@ DROP DATABASE mysqldump_test_db;
--echo # -- End of test case for Bug#32538. --echo # -- End of test case for Bug#32538.
--echo --echo
# We reset concurrent_inserts value to whatever it was at the start of the test --echo #
# This line must be executed _after_ all test cases. --echo # Bug#37377 Incorrect DROP TABLE statement in dump of a VIEW using --tab
--echo #
create table t1 (a int);
create view v1 as select a from t1;
--exec $MYSQL_DUMP --skip-comments --tab=$MYSQLTEST_VARDIR/tmp/ test t1 v1
drop view v1;
drop table t1;
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/t1.sql
--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/v1.sql
drop view v1;
drop table t1;
--remove_file $MYSQLTEST_VARDIR/tmp/t1.sql
--remove_file $MYSQLTEST_VARDIR/tmp/t1.txt
--remove_file $MYSQLTEST_VARDIR/tmp/v1.sql
--echo #
--echo # Bug#28071 mysqlimport does not quote or escape table name
--echo #
--disable_warnings
drop table if exists `load`;
--enable_warnings
create table `load` (a varchar(255));
--copy_file std_data/words.dat $MYSQLTEST_VARDIR/tmp/load.txt
--exec $MYSQL_IMPORT --ignore test $MYSQLTEST_VARDIR/tmp/load.txt
select count(*) from `load`;
--remove_file $MYSQLTEST_VARDIR/tmp/load.txt
drop table `load`;
# We reset concurrent_inserts value to whatever it was at the start of the
# test This line must be executed _after_ all test cases.
SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT; SET @@GLOBAL.CONCURRENT_INSERT = @OLD_CONCURRENT_INSERT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment