diff options
Diffstat (limited to 'mysys/charset.c')
-rw-r--r-- | mysys/charset.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/mysys/charset.c b/mysys/charset.c index 4920e7806a2..701170b747b 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -383,26 +383,28 @@ static my_bool init_available_charsets(myf myflags) while we may changing the cs_info_table */ pthread_mutex_lock(&THR_LOCK_charset); - - bzero(&all_charsets,sizeof(all_charsets)); - init_compiled_charsets(myflags); - - /* Copy compiled charsets */ - for (cs=all_charsets; - cs < all_charsets+array_elements(all_charsets)-1 ; - cs++) + if (!charset_initialized) { - if (*cs) + bzero(&all_charsets,sizeof(all_charsets)); + init_compiled_charsets(myflags); + + /* Copy compiled charsets */ + for (cs=all_charsets; + cs < all_charsets+array_elements(all_charsets)-1 ; + cs++) { - if (cs[0]->ctype) - if (init_state_maps(*cs)) - *cs= NULL; + if (*cs) + { + if (cs[0]->ctype) + if (init_state_maps(*cs)) + *cs= NULL; + } } + + strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); + error= my_read_charset_file(fname,myflags); + charset_initialized=1; } - - strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); - error= my_read_charset_file(fname,myflags); - charset_initialized=1; pthread_mutex_unlock(&THR_LOCK_charset); } return error; @@ -586,6 +588,7 @@ CHARSET_INFO *get_charset_by_csname(const char *cs_name, ~0 The escaped string did not fit in the to buffer >=0 The length of the escaped string */ + ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, ulong to_length, const char *from, ulong length) @@ -700,6 +703,7 @@ ulong escape_string_for_mysql(CHARSET_INFO *charset_info, ~0 The escaped string did not fit in the to buffer >=0 The length of the escaped string */ + ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info, char *to, ulong to_length, const char *from, ulong length) @@ -712,7 +716,6 @@ ulong escape_quotes_for_mysql(CHARSET_INFO *charset_info, #endif for (end= from + length; from < end; from++) { - char escape= 0; #ifdef USE_MB int tmp_length; if (use_mb_flag && (tmp_length= my_ismbchar(charset_info, from, end))) |