summaryrefslogtreecommitdiff
path: root/client/mysqldump.c
diff options
context:
space:
mode:
Diffstat (limited to 'client/mysqldump.c')
-rw-r--r--client/mysqldump.c65
1 files changed, 25 insertions, 40 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 9c796cf0bac..b6f44eb8a74 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -148,6 +148,7 @@ static ulonglong opt_system= 0ULL;
static my_bool insert_pat_inited= 0, debug_info_flag= 0, debug_check_flag= 0,
select_field_names_inited= 0;
static ulong opt_max_allowed_packet, opt_net_buffer_length;
+static double opt_max_statement_time= 0.0;
static MYSQL mysql_connection,*mysql=0;
static DYNAMIC_STRING insert_pat, select_field_names;
static char *opt_password=0,*current_user=0,
@@ -164,6 +165,7 @@ static my_bool server_supports_switching_charsets= TRUE;
static ulong opt_compatible_mode= 0;
#define MYSQL_OPT_MASTER_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_MASTER_DATA_COMMENTED_SQL 2
+#define MYSQL_OPT_MAX_STATEMENT_TIME 0
#define MYSQL_OPT_SLAVE_DATA_EFFECTIVE_SQL 1
#define MYSQL_OPT_SLAVE_DATA_COMMENTED_SQL 2
static uint opt_mysql_port= 0, opt_master_data;
@@ -475,6 +477,10 @@ static struct my_option my_long_options[] =
&opt_max_allowed_packet, &opt_max_allowed_packet, 0,
GET_ULONG, REQUIRED_ARG, 24*1024*1024, 4096,
(longlong) 2L*1024L*1024L*1024L, MALLOC_OVERHEAD, 1024, 0},
+ {"max-statement-time", MYSQL_OPT_MAX_STATEMENT_TIME,
+ "Max statement execution time. If unset, overrides server default with 0.",
+ &opt_max_statement_time, &opt_max_statement_time, 0, GET_DOUBLE,
+ REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{"net_buffer_length", OPT_NET_BUFFER_LENGTH,
"The buffer size for TCP/IP and socket communication.",
&opt_net_buffer_length, &opt_net_buffer_length, 0,
@@ -3219,9 +3225,8 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
if (strcmp(field->name, "View") == 0)
{
char *scv_buff= NULL;
- my_ulonglong n_cols;
- verbose_msg("-- It's a view, create dummy table for view\n");
+ verbose_msg("-- It's a view, create dummy view for view\n");
/* save "show create" statement for later */
if ((row= mysql_fetch_row(result)) && (scv_buff=row[1]))
@@ -3230,9 +3235,9 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
mysql_free_result(result);
/*
- Create a table with the same name as the view and with columns of
+ Create a view with the same name as the view and with columns of
the same name in order to satisfy views that depend on this view.
- The table will be removed when the actual view is created.
+ The view will be removed when the actual view is created.
The properties of each column, are not preserved in this temporary
table, because they are not necessary.
@@ -3264,23 +3269,9 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
else
my_free(scv_buff);
- n_cols= mysql_num_rows(result);
- if (0 != n_cols)
+ if (mysql_num_rows(result) != 0)
{
- /*
- The actual formula is based on the column names and how the .FRM
- files are stored and is too volatile to be repeated here.
- Thus we simply warn the user if the columns exceed a limit we
- know works most of the time.
- */
- if (n_cols >= 1000)
- fprintf(stderr,
- "-- Warning: Creating a stand-in table for view %s may"
- " fail when replaying the dump file produced because "
- "of the number of columns exceeding 1000. Exercise "
- "caution when replaying the produced dump file.\n",
- table);
if (opt_drop)
{
/*
@@ -3296,7 +3287,7 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
fprintf(sql_file,
"SET @saved_cs_client = @@character_set_client;\n"
"SET character_set_client = utf8;\n"
- "/*!50001 CREATE TABLE %s (\n",
+ "/*!50001 CREATE VIEW %s AS SELECT\n",
result_table);
/*
@@ -3308,28 +3299,21 @@ static uint get_table_structure(const char *table, const char *db, char *table_t
row= mysql_fetch_row(result);
/*
- The actual column type doesn't matter anyway, since the table will
+ The actual column value doesn't matter anyway, since the view will
be dropped at run time.
- We do tinyint to avoid hitting the row size limit.
*/
- fprintf(sql_file, " %s tinyint NOT NULL",
+ fprintf(sql_file, " 1 AS %s",
quote_name(row[0], name_buff, 0));
while((row= mysql_fetch_row(result)))
{
/* col name, col type */
- fprintf(sql_file, ",\n %s tinyint NOT NULL",
+ fprintf(sql_file, ",\n 1 AS %s",
quote_name(row[0], name_buff, 0));
}
- /*
- Stand-in tables are always MyISAM tables as the default
- engine might have a column-limit that's lower than the
- number of columns in the view, and MyISAM support is
- guaranteed to be in the server anyway.
- */
fprintf(sql_file,
- "\n) ENGINE=MyISAM */;\n"
+ " */;\n"
"SET character_set_client = @saved_cs_client;\n");
check_io(sql_file);
@@ -6852,15 +6836,8 @@ static my_bool get_view_structure(char *table, char* db)
"\n--\n-- Final view structure for view %s\n--\n\n",
fix_for_comment(result_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)
- {
- fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n",
- opt_quoted_table);
- check_io(sql_file);
- }
-
+ /* View might not exist if this view was dumped with --tab. */
+ fprintf(sql_file, "/*!50001 DROP VIEW IF EXISTS %s*/;\n", opt_quoted_table);
my_snprintf(query, sizeof(query),
"SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, "
@@ -7032,6 +7009,7 @@ static void dynstr_realloc_checked(DYNAMIC_STRING *str, ulong additional_size)
int main(int argc, char **argv)
{
+ char query[48];
char bin_log_name[FN_REFLEN];
int exit_code;
int consistent_binlog_pos= 0;
@@ -7073,6 +7051,13 @@ int main(int argc, char **argv)
if (!path)
write_header(md_result_file, *argv);
+ /* Set MAX_STATEMENT_TIME to 0 unless set in client */
+ my_snprintf(query, sizeof(query), "/*!100100 SET @@MAX_STATEMENT_TIME=%f */", opt_max_statement_time);
+ mysql_query(mysql, query);
+
+ /* Set server side timeout between client commands to server compiled-in default */
+ mysql_query(mysql, "/*!100100 SET WAIT_TIMEOUT=DEFAULT */");
+
/* Check if the server support multi source */
if (mysql_get_server_version(mysql) >= 100000)
{