diff options
author | Sergei Golubchik <serg@mariadb.org> | 2016-06-28 22:01:55 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2016-06-28 22:01:55 +0200 |
commit | 3361aee591b1eb8c676f60887ffc535cd509890a (patch) | |
tree | 54a65f83ba7d9293e6f8e8281ad920fbae6eb823 /client/mysqldump.c | |
parent | 6ce20fb2b9fe57330c797694b9dbea4028f40d7c (diff) | |
parent | 0fdb17e6c3f50ae22eb97b6363bcbd8b0cd9e040 (diff) | |
download | mariadb-git-3361aee591b1eb8c676f60887ffc535cd509890a.tar.gz |
Merge branch '10.0' into 10.1
Diffstat (limited to 'client/mysqldump.c')
-rw-r--r-- | client/mysqldump.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c index ae59380544a..f2576861fc0 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -92,7 +92,7 @@ static void add_load_option(DYNAMIC_STRING *str, const char *option, const char *option_value); -static ulong find_set(TYPELIB *lib, const char *x, uint length, +static ulong find_set(TYPELIB *lib, const char *x, size_t length, char **err_pos, uint *err_len); static char *alloc_query_str(ulong size); @@ -896,7 +896,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), opt_set_charset= 0; opt_compatible_mode_str= argument; opt_compatible_mode= find_set(&compatible_mode_typelib, - argument, (uint) strlen(argument), + argument, strlen(argument), &err_ptr, &err_len); if (err_len) { @@ -906,7 +906,7 @@ get_one_option(int optid, const struct my_option *opt __attribute__((unused)), } #if !defined(DBUG_OFF) { - uint size_for_sql_mode= 0; + size_t size_for_sql_mode= 0; const char **ptr; for (ptr= compatible_mode_names; *ptr; ptr++) size_for_sql_mode+= strlen(*ptr); @@ -1177,8 +1177,8 @@ static int fetch_db_collation(const char *db_name, break; } - strncpy(db_cl_name, db_cl_row[0], db_cl_size); - db_cl_name[db_cl_size - 1]= 0; /* just in case. */ + strncpy(db_cl_name, db_cl_row[0], db_cl_size-1); + db_cl_name[db_cl_size - 1]= 0; } while (FALSE); @@ -1311,7 +1311,7 @@ get_gtid_pos(char *out_gtid_pos, int master) static char *my_case_str(const char *str, - uint str_len, + size_t str_len, const char *token, uint token_len) { @@ -1527,7 +1527,7 @@ static int switch_character_set_results(MYSQL *mysql, const char *cs_name) */ static char *cover_definer_clause(const char *stmt_str, - uint stmt_length, + size_t stmt_length, const char *definer_version_str, uint definer_version_length, const char *stmt_version_str, @@ -1727,14 +1727,14 @@ static void dbDisconnect(char *host) } /* dbDisconnect */ -static void unescape(FILE *file,char *pos,uint length) +static void unescape(FILE *file,char *pos, size_t length) { char *tmp; DBUG_ENTER("unescape"); if (!(tmp=(char*) my_malloc(length*2+1, MYF(MY_WME)))) die(EX_MYSQLERR, "Couldn't allocate memory"); - mysql_real_escape_string(&mysql_connection, tmp, pos, length); + mysql_real_escape_string(&mysql_connection, tmp, pos, (ulong)length); fputc('\'', file); fputs(tmp, file); fputc('\'', file); @@ -1868,7 +1868,7 @@ static char *quote_for_equal(const char *name, char *buff) Quote '<' '>' '&' '\"' chars and print a string to the xml_file. */ -static void print_quoted_xml(FILE *xml_file, const char *str, ulong len, +static void print_quoted_xml(FILE *xml_file, const char *str, size_t len, my_bool is_attribute_name) { const char *end; @@ -2129,7 +2129,7 @@ static void print_xml_row(FILE *xml_file, const char *row_name, squeezed to a single hyphen. */ -static void print_xml_comment(FILE *xml_file, ulong len, +static void print_xml_comment(FILE *xml_file, size_t len, const char *comment_string) { const char* end; @@ -2246,7 +2246,7 @@ static uint dump_events_for_db(char *db) DBUG_ENTER("dump_events_for_db"); DBUG_PRINT("enter", ("db: '%s'", db)); - mysql_real_escape_string(mysql, db_name_buff, db, strlen(db)); + mysql_real_escape_string(mysql, db_name_buff, db, (ulong)strlen(db)); /* nice comments */ print_comment(sql_file, 0, @@ -2366,7 +2366,6 @@ static uint dump_events_for_db(char *db) (const char *) delimiter); my_free(query_str); - restore_time_zone(sql_file, delimiter); restore_sql_mode(sql_file, delimiter); @@ -2459,7 +2458,7 @@ static uint dump_routines_for_db(char *db) DBUG_ENTER("dump_routines_for_db"); DBUG_PRINT("enter", ("db: '%s'", db)); - mysql_real_escape_string(mysql, db_name_buff, db, strlen(db)); + mysql_real_escape_string(mysql, db_name_buff, db, (ulong)strlen(db)); /* nice comments */ print_comment(sql_file, 0, @@ -2517,9 +2516,9 @@ static uint dump_routines_for_db(char *db) if the user has EXECUTE privilege he see routine names, but NOT the routine body of other routines that are not the creator of! */ - DBUG_PRINT("info",("length of body for %s row[2] '%s' is %d", + DBUG_PRINT("info",("length of body for %s row[2] '%s' is %zu", routine_name, row[2] ? row[2] : "(null)", - row[2] ? (int) strlen(row[2]) : 0)); + row[2] ? strlen(row[2]) : 0)); if (row[2] == NULL) { print_comment(sql_file, 1, "\n-- insufficient privileges to %s\n", @@ -4107,7 +4106,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables) int i; char name_buff[NAME_LEN*2+3]; - mysql_real_escape_string(mysql, name_buff, db, strlen(db)); + mysql_real_escape_string(mysql, name_buff, db, (ulong)strlen(db)); init_dynamic_string_checked(&dynamic_where, " AND TABLESPACE_NAME IN (" "SELECT DISTINCT TABLESPACE_NAME FROM" @@ -4120,7 +4119,7 @@ static int dump_tablespaces_for_tables(char *db, char **table_names, int tables) for (i=0 ; i<tables ; i++) { mysql_real_escape_string(mysql, name_buff, - table_names[i], strlen(table_names[i])); + table_names[i], (ulong)strlen(table_names[i])); dynstr_append_checked(&dynamic_where, "'"); dynstr_append_checked(&dynamic_where, name_buff); @@ -4150,7 +4149,7 @@ static int dump_tablespaces_for_databases(char** databases) { char db_name_buff[NAME_LEN*2+3]; mysql_real_escape_string(mysql, db_name_buff, - databases[i], strlen(databases[i])); + databases[i], (ulong)strlen(databases[i])); dynstr_append_checked(&dynamic_where, "'"); dynstr_append_checked(&dynamic_where, db_name_buff); dynstr_append_checked(&dynamic_where, "',"); @@ -5418,7 +5417,7 @@ static int start_transaction(MYSQL *mysql_con) } -static ulong find_set(TYPELIB *lib, const char *x, uint length, +static ulong find_set(TYPELIB *lib, const char *x, size_t length, char **err_pos, uint *err_len) { const char *end= x + length; @@ -5476,7 +5475,7 @@ static void print_value(FILE *file, MYSQL_RES *result, MYSQL_ROW row, fputc(' ',file); fputs(prefix, file); if (string_value) - unescape(file,row[0],(uint) strlen(row[0])); + unescape(file,row[0], strlen(row[0])); else fputs(row[0], file); check_io(file); @@ -5732,8 +5731,8 @@ static my_bool get_view_structure(char *table, char* db) verbose_msg("-- Retrieving view structure for table %s...\n", table); #ifdef NOT_REALLY_USED_YET - sprintf(insert_pat, "SET SQL_QUOTE_SHOW_CREATE=%d", - (opt_quoted || opt_keywords)); + dynstr_append_checked(&insert_pat, "SET SQL_QUOTE_SHOW_CREATE="); + dynstr_append_checked(&insert_pat, (opt_quoted || opt_keywords)? "1":"0"); #endif result_table= quote_name(table, table_buff, 1); |