summaryrefslogtreecommitdiff
path: root/client/mysqldump.c
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2020-08-22 02:08:59 +0300
committerSergei Golubchik <serg@mariadb.org>2021-05-19 22:54:07 +0200
commita206658b985fe5e18fb5692fdb3698dad5aca70a (patch)
treeeded15d92bd26154a7622a12f9ed6de6bd2fdf5c /client/mysqldump.c
parentb0910dddf53e2b41d5257bb5bda81f885044048a (diff)
downloadmariadb-git-a206658b985fe5e18fb5692fdb3698dad5aca70a.tar.gz
Change CHARSET_INFO character set and collaction names to LEX_CSTRING
This change removed 68 explict strlen() calls from the code. The following renames was done to ensure we don't use the old names when merging code from earlier releases, as using the new variables for print function could result in crashes: - charset->csname renamed to charset->cs_name - charset->name renamed to charset->coll_name Almost everything where mechanical changes except: - Changed to use the new Protocol::store(LEX_CSTRING..) when possible - Changed to use field->store(LEX_CSTRING*, CHARSET_INFO*) when possible - Changed to use String->append(LEX_CSTRING&) when possible Other things: - There where compiler issues with ensuring that all character set names points to the same string: gcc doesn't allow one to use integer constants when defining global structures (constant char * pointers works fine). To get around this, I declared defines for each character set name length.
Diffstat (limited to 'client/mysqldump.c')
-rw-r--r--client/mysqldump.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/client/mysqldump.c b/client/mysqldump.c
index 4fa15096777..7fda95239e6 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1647,8 +1647,8 @@ static int switch_db_collation(FILE *sql_file,
fprintf(sql_file,
"ALTER DATABASE %s CHARACTER SET %s COLLATE %s %s\n",
(const char *) quoted_db_name,
- (const char *) db_cl->csname,
- (const char *) db_cl->name,
+ (const char *) db_cl->cs_name.str,
+ (const char *) db_cl->coll_name.str,
(const char *) delimiter);
*db_cl_altered= 1;
@@ -1678,8 +1678,8 @@ static int restore_db_collation(FILE *sql_file,
fprintf(sql_file,
"ALTER DATABASE %s CHARACTER SET %s COLLATE %s %s\n",
(const char *) quoted_db_name,
- (const char *) db_cl->csname,
- (const char *) db_cl->name,
+ (const char *) db_cl->cs_name.str,
+ (const char *) db_cl->coll_name.str,
(const char *) delimiter);
return 0;
@@ -4120,7 +4120,7 @@ static void dump_table(const char *table, const char *db, const uchar *hash_key,
dynstr_append_checked(&query_string, " /*!50138 CHARACTER SET ");
dynstr_append_checked(&query_string, default_charset == mysql_universal_client_charset ?
- my_charset_bin.name : /* backward compatibility */
+ my_charset_bin.coll_name.str : /* backward compatibility */
default_charset);
dynstr_append_checked(&query_string, " */");