mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge branch '10.3' into 10.4
This commit is contained in:
@ -146,6 +146,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,
|
||||
@ -162,6 +163,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;
|
||||
@ -461,6 +463,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,
|
||||
@ -3056,9 +3062,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]))
|
||||
@ -3067,9 +3072,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.
|
||||
@ -3101,23 +3106,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)
|
||||
{
|
||||
/*
|
||||
@ -3133,7 +3124,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);
|
||||
|
||||
/*
|
||||
@ -3145,28 +3136,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);
|
||||
@ -6626,15 +6610,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, "
|
||||
@ -6806,6 +6783,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;
|
||||
@ -6847,6 +6825,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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user