From 0318ed0e75f57f0fa28dffa196cea4dfe9c85a23 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 12 Aug 2005 04:44:04 -0600 Subject: [PATCH 1/7] Bug #6581 Failure to start mysql server on Windows with AWE option enabled innobase/srv/srv0start.c: added line to error message clearly indicating that to get AWE support the user must compile InnoDB with __WIN2000__ defined. --- innobase/srv/srv0start.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/innobase/srv/srv0start.c b/innobase/srv/srv0start.c index 62df7301cc9..87f4c31257a 100644 --- a/innobase/srv/srv0start.c +++ b/innobase/srv/srv0start.c @@ -1052,7 +1052,8 @@ innobase_start_or_create_for_mysql(void) fprintf(stderr, "InnoDB: Error: You have specified innodb_buffer_pool_awe_mem_mb\n" -"InnoDB: in my.cnf, but AWE can only be used in Windows 2000 and later.\n"); +"InnoDB: in my.cnf, but AWE can only be used in Windows 2000 and later.\n" +"InnoDB: To use AWE, InnoDB must be compiled with __WIN2000__ defined.\n"); return(DB_ERROR); } From a29b1d7151497b4777e4b4917f0eee001705a928 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Aug 2005 04:26:32 -0400 Subject: [PATCH 2/7] BUG#11338 (logging of prepared statement w/ blob type) In cp932, '\' character can be the second byte in a multi-byte character stream. This makes it difficult to use mysql_escape_string. Added flag to indicate which languages allow '\' as second byte of multibyte sequence so that when putting a prepared statement into the binlog we can decide at runtime whether hex encoding is really needed. include/m_ctype.h: Added bool to indicate character sets which allow '\' as the second byte of a multibyte character set (currently only cp932). For these character sets, escaping with '\' is dangerous and leads to corruption in replication. include/my_sys.h: Add function to enocde a string as hex with no prefix (bare) mysys/charset.c: Add function to encode string as hex with no prefix (bare). sql/item.cc: Check the connection character set to see if escape_string_for_mysql is safe, or if character set requires unambiguous (hex) encoding sql/item.h: Pass thd to query_val_str for access to charset() sql/sql_prepare.cc: Pass thd to query_val_str. strings/ctype-big5.c: Add escape_with_backslash_is_dangerous flag. strings/ctype-bin.c: Add escape_with_backslash_is_dangerous flag strings/ctype-cp932.c: Add escape_with_backslash_is_dangerous flag. strings/ctype-czech.c: Add escape_with_backslash_is_dangerous flag. strings/ctype-euc_kr.c: Add escape_with_backslash_is_dangerous flag. strings/ctype-extra.c: Add escape_with_backslash_is_dangerous flag. strings/ctype-gb2312.c: Add escape_with_backslash_is_dangerous flag. strings/ctype-gbk.c: Added escape_with_backslash_is_dangerous flag. strings/ctype-latin1.c: Added escape_with_backslash_is_dangerous flag. strings/ctype-sjis.c: Added escape_with_backslash_is_dangerous flag. strings/ctype-tis620.c: Added esacpe_with_backslash_character_is_dangerous flag. strings/ctype-uca.c: Added escape_with_backslash_is_dangerous flag. strings/ctype-ucs2.c: Added escape_with_backslash_is_dangerous. strings/ctype-ujis.c: Added escape_with_backslash_is_dangerous flag. strings/ctype-utf8.c: Added escape_with_backslash_is_dangerous. strings/ctype-win1250ch.c: Added escape_with_backslash_is_dangerous. --- include/m_ctype.h | 1 + include/my_sys.h | 1 + mysys/charset.c | 18 ++++++++++++++++++ sql/item.cc | 18 +++++++++++++----- sql/item.h | 2 +- sql/sql_prepare.cc | 4 ++-- strings/ctype-big5.c | 2 ++ strings/ctype-bin.c | 1 + strings/ctype-cp932.c | 2 ++ strings/ctype-czech.c | 1 + strings/ctype-euc_kr.c | 2 ++ strings/ctype-extra.c | 1 + strings/ctype-gb2312.c | 2 ++ strings/ctype-gbk.c | 2 ++ strings/ctype-latin1.c | 3 +++ strings/ctype-sjis.c | 2 ++ strings/ctype-tis620.c | 2 ++ strings/ctype-uca.c | 34 ++++++++++++++++++++++++++++++++++ strings/ctype-ucs2.c | 2 ++ strings/ctype-ujis.c | 2 ++ strings/ctype-utf8.c | 3 +++ strings/ctype-win1250ch.c | 1 + 22 files changed, 98 insertions(+), 8 deletions(-) diff --git a/include/m_ctype.h b/include/m_ctype.h index ab63a1e0db1..a5dc7cc00c6 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -220,6 +220,7 @@ typedef struct charset_info_st uint mbmaxlen; uint16 min_sort_char; uint16 max_sort_char; /* For LIKE optimization */ + my_bool escape_with_backslash_is_dangerous; MY_CHARSET_HANDLER *cset; MY_COLLATION_HANDLER *coll; diff --git a/include/my_sys.h b/include/my_sys.h index 8752aa30772..eafa41a05c8 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -788,6 +788,7 @@ extern my_bool init_compiled_charsets(myf flags); extern void add_compiled_collation(CHARSET_INFO *cs); extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, const char *from, ulong length); +extern char *bare_str_to_hex(char *to, const char *from, uint len); #ifdef __WIN__ #define BACKSLASH_MBTAIL /* File system character set */ diff --git a/mysys/charset.c b/mysys/charset.c index 3a39fce9437..df3f1cfa279 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -663,3 +663,21 @@ CHARSET_INFO *fs_character_set() return fs_cset_cache; } #endif + +/* + Transforms a string into hex form. + */ +char *bare_str_to_hex(char *to, const char *from, uint len) +{ + char *p= to; + uint i; + for (i= 0; i < len; i++, p+= 2) + { + /* val[i] is char. Casting to uchar helps greatly if val[i] < 0 */ + uint tmp= (uint) (uchar) from[i]; + p[0]= _dig_vec_upper[tmp >> 4]; + p[1]= _dig_vec_upper[tmp & 15]; + } + *p= 0; + return p; // pointer to end 0 of 'to' +} diff --git a/sql/item.cc b/sql/item.cc index b3d2932acf6..79579eeeb67 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1443,7 +1443,7 @@ String *Item_param::val_str(String* str) and avoid one more memcpy/alloc between str and log string. */ -const String *Item_param::query_val_str(String* str) const +const String *Item_param::query_val_str(String* str, THD *thd) const { switch (state) { case INT_VALUE: @@ -1482,10 +1482,18 @@ const String *Item_param::query_val_str(String* str) const buf= str->c_ptr_quick(); ptr= buf; - *ptr++= '\''; - ptr+= escape_string_for_mysql(str_value.charset(), ptr, - str_value.ptr(), str_value.length()); - *ptr++= '\''; + if (thd->charset()->escape_with_backslash_is_dangerous) + { + ptr= strmov(ptr, "x\'"); + ptr= bare_str_to_hex(ptr, str_value.ptr(), str_value.length()); + } + else + { + *ptr++= '\''; + ptr+= escape_string_for_mysql(str_value.charset(), ptr, + str_value.ptr(), str_value.length()); + } + *ptr++='\''; str->length(ptr - buf); break; } diff --git a/sql/item.h b/sql/item.h index 825b37fe64c..ee86fb80167 100644 --- a/sql/item.h +++ b/sql/item.h @@ -591,7 +591,7 @@ public: */ void (*set_param_func)(Item_param *param, uchar **pos, ulong len); - const String *query_val_str(String *str) const; + const String *query_val_str(String *str, THD *thd) const; bool convert_str_value(THD *thd); diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 6507de37a71..d0c06a3eaf7 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -601,7 +601,7 @@ static bool insert_params_withlog(Prepared_statement *stmt, uchar *null_array, param->set_param_func(param, &read_pos, data_end - read_pos); } } - res= param->query_val_str(&str); + res= param->query_val_str(&str, thd); if (param->convert_str_value(thd)) DBUG_RETURN(1); /* out of memory */ @@ -749,7 +749,7 @@ static bool emb_insert_params_withlog(Prepared_statement *stmt, String *query) client_param->buffer_length); } } - res= param->query_val_str(&str); + res= param->query_val_str(&str, thd); if (param->convert_str_value(thd)) DBUG_RETURN(1); /* out of memory */ diff --git a/strings/ctype-big5.c b/strings/ctype-big5.c index 73e3efd09a7..76a4e197405 100644 --- a/strings/ctype-big5.c +++ b/strings/ctype-big5.c @@ -6378,6 +6378,7 @@ CHARSET_INFO my_charset_big5_chinese_ci= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_big5_handler, &my_collation_big5_chinese_ci_handler }; @@ -6406,6 +6407,7 @@ CHARSET_INFO my_charset_big5_bin= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_big5_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index 425985e6bc1..1ac79ac9ca0 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -514,6 +514,7 @@ CHARSET_INFO my_charset_bin = 1, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_binary_handler }; diff --git a/strings/ctype-cp932.c b/strings/ctype-cp932.c index be3526519cb..e476130b706 100644 --- a/strings/ctype-cp932.c +++ b/strings/ctype-cp932.c @@ -5520,6 +5520,7 @@ CHARSET_INFO my_charset_cp932_japanese_ci= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler }; @@ -5547,6 +5548,7 @@ CHARSET_INFO my_charset_cp932_bin= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 1, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-czech.c b/strings/ctype-czech.c index 5725e81b15e..4bd2fbddbc4 100644 --- a/strings/ctype-czech.c +++ b/strings/ctype-czech.c @@ -612,6 +612,7 @@ CHARSET_INFO my_charset_latin2_czech_ci = 1, /* mbmaxlen */ 0, /* min_sort_char */ 0, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_8bit_handler, &my_collation_latin2_czech_ci_handler }; diff --git a/strings/ctype-euc_kr.c b/strings/ctype-euc_kr.c index ee792d9c3e4..f15e97de5be 100644 --- a/strings/ctype-euc_kr.c +++ b/strings/ctype-euc_kr.c @@ -8701,6 +8701,7 @@ CHARSET_INFO my_charset_euckr_korean_ci= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler }; @@ -8729,6 +8730,7 @@ CHARSET_INFO my_charset_euckr_bin= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-extra.c b/strings/ctype-extra.c index 3672dcd0b33..1c786c16ec5 100644 --- a/strings/ctype-extra.c +++ b/strings/ctype-extra.c @@ -40,6 +40,7 @@ CHARSET_INFO compiled_charsets[] = { 0, /* mbmaxlen */ 0, /* min_sort_ord */ 0, /* max_sort_ord */ + 0, /* escape_with_backslash_is_dangerous */ NULL, /* cset handler */ NULL /* coll handler */ } diff --git a/strings/ctype-gb2312.c b/strings/ctype-gb2312.c index f17cc94723f..0cbad2d1c55 100644 --- a/strings/ctype-gb2312.c +++ b/strings/ctype-gb2312.c @@ -5752,6 +5752,7 @@ CHARSET_INFO my_charset_gb2312_chinese_ci= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler }; @@ -5779,6 +5780,7 @@ CHARSET_INFO my_charset_gb2312_bin= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-gbk.c b/strings/ctype-gbk.c index 7196d004ad5..82c76b8ee96 100644 --- a/strings/ctype-gbk.c +++ b/strings/ctype-gbk.c @@ -10028,6 +10028,7 @@ CHARSET_INFO my_charset_gbk_chinese_ci= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler }; @@ -10055,6 +10056,7 @@ CHARSET_INFO my_charset_gbk_bin= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index 9b429fea95c..b6e3e300c34 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -438,6 +438,7 @@ CHARSET_INFO my_charset_latin1= 1, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_8bit_simple_ci_handler }; @@ -722,6 +723,7 @@ CHARSET_INFO my_charset_latin1_german2_ci= 1, /* mbmaxlen */ 0, /* min_sort_char */ 247, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_german2_ci_handler }; @@ -750,6 +752,7 @@ CHARSET_INFO my_charset_latin1_bin= 1, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_8bit_bin_handler }; diff --git a/strings/ctype-sjis.c b/strings/ctype-sjis.c index 900acefd4ea..4342fc670df 100644 --- a/strings/ctype-sjis.c +++ b/strings/ctype-sjis.c @@ -4676,6 +4676,7 @@ CHARSET_INFO my_charset_sjis_japanese_ci= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler }; @@ -4703,6 +4704,7 @@ CHARSET_INFO my_charset_sjis_bin= 2, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-tis620.c b/strings/ctype-tis620.c index 6a6c55d214e..208168bb946 100644 --- a/strings/ctype-tis620.c +++ b/strings/ctype-tis620.c @@ -975,6 +975,7 @@ CHARSET_INFO my_charset_tis620_thai_ci= 1, /* mbmaxlen */ 0, /* min_sort_char */ 0, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler }; @@ -1002,6 +1003,7 @@ CHARSET_INFO my_charset_tis620_bin= 1, /* mbmaxlen */ 0, /* min_sort_char */ 0, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_8bit_bin_handler }; diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index 53c4fabaf08..010250521c7 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -8044,6 +8044,7 @@ CHARSET_INFO my_charset_ucs2_general_uca= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8071,6 +8072,7 @@ CHARSET_INFO my_charset_ucs2_icelandic_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8098,6 +8100,7 @@ CHARSET_INFO my_charset_ucs2_latvian_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8125,6 +8128,7 @@ CHARSET_INFO my_charset_ucs2_romanian_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8152,6 +8156,7 @@ CHARSET_INFO my_charset_ucs2_slovenian_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8179,6 +8184,7 @@ CHARSET_INFO my_charset_ucs2_polish_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8206,6 +8212,7 @@ CHARSET_INFO my_charset_ucs2_estonian_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8233,6 +8240,7 @@ CHARSET_INFO my_charset_ucs2_spanish_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8260,6 +8268,7 @@ CHARSET_INFO my_charset_ucs2_swedish_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8287,6 +8296,7 @@ CHARSET_INFO my_charset_ucs2_turkish_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8314,6 +8324,7 @@ CHARSET_INFO my_charset_ucs2_czech_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8342,6 +8353,7 @@ CHARSET_INFO my_charset_ucs2_danish_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8369,6 +8381,7 @@ CHARSET_INFO my_charset_ucs2_lithuanian_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8396,6 +8409,7 @@ CHARSET_INFO my_charset_ucs2_slovak_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8423,6 +8437,7 @@ CHARSET_INFO my_charset_ucs2_spanish2_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8451,6 +8466,7 @@ CHARSET_INFO my_charset_ucs2_roman_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8479,6 +8495,7 @@ CHARSET_INFO my_charset_ucs2_persian_uca_ci= 2, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_uca_handler }; @@ -8552,6 +8569,7 @@ CHARSET_INFO my_charset_utf8_general_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8580,6 +8598,7 @@ CHARSET_INFO my_charset_utf8_icelandic_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8607,6 +8626,7 @@ CHARSET_INFO my_charset_utf8_latvian_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8634,6 +8654,7 @@ CHARSET_INFO my_charset_utf8_romanian_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8661,6 +8682,7 @@ CHARSET_INFO my_charset_utf8_slovenian_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8688,6 +8710,7 @@ CHARSET_INFO my_charset_utf8_polish_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8715,6 +8738,7 @@ CHARSET_INFO my_charset_utf8_estonian_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8742,6 +8766,7 @@ CHARSET_INFO my_charset_utf8_spanish_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8769,6 +8794,7 @@ CHARSET_INFO my_charset_utf8_swedish_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8796,6 +8822,7 @@ CHARSET_INFO my_charset_utf8_turkish_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8823,6 +8850,7 @@ CHARSET_INFO my_charset_utf8_czech_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8851,6 +8879,7 @@ CHARSET_INFO my_charset_utf8_danish_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8878,6 +8907,7 @@ CHARSET_INFO my_charset_utf8_lithuanian_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8905,6 +8935,7 @@ CHARSET_INFO my_charset_utf8_slovak_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8932,6 +8963,7 @@ CHARSET_INFO my_charset_utf8_spanish2_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8959,6 +8991,7 @@ CHARSET_INFO my_charset_utf8_roman_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; @@ -8986,6 +9019,7 @@ CHARSET_INFO my_charset_utf8_persian_uca_ci= 3, /* mbmaxlen */ 9, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_any_uca_handler }; diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 025fdd5a7f6..2761e781724 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1583,6 +1583,7 @@ CHARSET_INFO my_charset_ucs2_general_ci= 2, /* mbmaxlen */ 0, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_general_ci_handler }; @@ -1610,6 +1611,7 @@ CHARSET_INFO my_charset_ucs2_bin= 2, /* mbmaxlen */ 0, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_ucs2_handler, &my_collation_ucs2_bin_handler }; diff --git a/strings/ctype-ujis.c b/strings/ctype-ujis.c index f20e2756810..b3bba85968e 100644 --- a/strings/ctype-ujis.c +++ b/strings/ctype-ujis.c @@ -8571,6 +8571,7 @@ CHARSET_INFO my_charset_ujis_japanese_ci= 3, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_ci_handler }; @@ -8599,6 +8600,7 @@ CHARSET_INFO my_charset_ujis_bin= 3, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_handler, &my_collation_mb_bin_handler }; diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 0bf57967630..b3e78ce27e9 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -2345,6 +2345,7 @@ CHARSET_INFO my_charset_utf8_general_ci= 3, /* mbmaxlen */ 0, /* min_sort_char */ 0xFFFF, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_ci_handler }; @@ -2373,6 +2374,7 @@ CHARSET_INFO my_charset_utf8_bin= 3, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_mb_bin_handler }; @@ -2538,6 +2540,7 @@ CHARSET_INFO my_charset_utf8_general_cs= 3, /* mbmaxlen */ 0, /* min_sort_char */ 255, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_utf8_handler, &my_collation_cs_handler }; diff --git a/strings/ctype-win1250ch.c b/strings/ctype-win1250ch.c index 2a899dfd147..351af3de23e 100644 --- a/strings/ctype-win1250ch.c +++ b/strings/ctype-win1250ch.c @@ -647,6 +647,7 @@ CHARSET_INFO my_charset_cp1250_czech_ci = 1, /* mbmaxlen */ 0, /* min_sort_char */ 0, /* max_sort_char */ + 0, /* escape_with_backslash_is_dangerous */ &my_charset_8bit_handler, &my_collation_czech_ci_handler }; From a80110f7f2c9ecd04f83033c5dc2f66268441711 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Aug 2005 14:40:23 +0200 Subject: [PATCH 3/7] mysql-test-run.pl, mtr_misc.pl: Bug#12615: Host name might not resolve, use short host name mysql-test/lib/mtr_misc.pl: Bug#12615: Host name might not resolve, use short host name mysql-test/mysql-test-run.pl: Bug#12615: Host name might not resolve, use short host name --- mysql-test/lib/mtr_misc.pl | 9 +++++++++ mysql-test/mysql-test-run.pl | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/mysql-test/lib/mtr_misc.pl b/mysql-test/lib/mtr_misc.pl index c1aab340a16..9a12d842998 100644 --- a/mysql-test/lib/mtr_misc.pl +++ b/mysql-test/lib/mtr_misc.pl @@ -7,6 +7,7 @@ use strict; sub mtr_full_hostname (); +sub mtr_short_hostname (); sub mtr_init_args ($); sub mtr_add_arg ($$); sub mtr_path_exists(@); @@ -21,6 +22,7 @@ sub mtr_exe_exists(@); # We want the fully qualified host name and hostname() may have returned # only the short name. So we use the resolver to find out. +# Note that this might fail on some platforms sub mtr_full_hostname () { @@ -35,6 +37,13 @@ sub mtr_full_hostname () { return $hostname; } +sub mtr_short_hostname () { + + my $hostname= hostname(); + $hostname =~ s/\..+$//; + return $hostname; +} + # FIXME move to own lib sub mtr_init_args ($) { diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e976242e726..f3e42ecf755 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -414,7 +414,7 @@ sub initial_setup () { $opt_source_dist= 1; } - $glob_hostname= mtr_full_hostname(); + $glob_hostname= mtr_short_hostname(); # 'basedir' is always parent of "mysql-test" directory $glob_mysql_test_dir= cwd(); From 4830c702768c40bed0c3d808355bc6dd6328770f Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 17 Aug 2005 15:03:29 +0200 Subject: [PATCH 4/7] Increase the version number to 4.1.15 (as 4.1.14 has been cloned off). --- configure.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index b270e5b0013..9e370dfa680 100644 --- a/configure.in +++ b/configure.in @@ -5,7 +5,7 @@ AC_INIT(sql/mysqld.cc) AC_CANONICAL_SYSTEM # The Docs Makefile.am parses this line! # remember to also change ndb version below and update version.c in ndb -AM_INIT_AUTOMAKE(mysql, 4.1.14) +AM_INIT_AUTOMAKE(mysql, 4.1.15) AM_CONFIG_HEADER(config.h) PROTOCOL_VERSION=10 @@ -16,7 +16,7 @@ SHARED_LIB_VERSION=14:0:0 # ndb version NDB_VERSION_MAJOR=4 NDB_VERSION_MINOR=1 -NDB_VERSION_BUILD=14 +NDB_VERSION_BUILD=15 NDB_VERSION_STATUS="" # Set all version vars based on $VERSION. How do we do this more elegant ? From cd737f81c92d9921facad75e56c298a31cf1c871 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Aug 2005 21:22:35 +0300 Subject: [PATCH 5/7] Changes for Netware. This is needed when building against newer Libc than we've used before. --- include/config-netware.h | 12 ++++++++++++ sql/mysqld.cc | 1 + 2 files changed, 13 insertions(+) diff --git a/include/config-netware.h b/include/config-netware.h index c8eba43b86f..1b24655ee89 100644 --- a/include/config-netware.h +++ b/include/config-netware.h @@ -51,6 +51,18 @@ extern "C" { #define HAVE_PTHREAD_YIELD_ZERO_ARG 1 #define HAVE_BROKEN_REALPATH 1 +/* changes made to make use of LibC-June-2004 for building purpose */ +#undef HAVE_POSIX_SIGNALS +#undef HAVE_PTHREAD_ATTR_SETSCOPE +#undef HAVE_ALLOC_A +#undef HAVE_FINITE +#undef HAVE_GETPWNAM +#undef HAVE_GETPWUID +#undef HAVE_PTHREAD_SETSCHEDPARAM +#undef HAVE_READLINK +#undef HAVE_STPCPY +/* changes end */ + /* no libc crypt() function */ #ifdef HAVE_OPENSSL #define HAVE_CRYPT 1 diff --git a/sql/mysqld.cc b/sql/mysqld.cc index b5a292fec28..55995a71980 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -152,6 +152,7 @@ int deny_severity = LOG_WARNING; #define zVOLSTATE_MAINTENANCE 3 #ifdef __NETWARE__ +#include #include #include #include From 9b76bca8cf6dc34facb07c99428ea219fae037fb Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Aug 2005 21:26:25 +0300 Subject: [PATCH 6/7] Some minor fixes for Netware. These were required after we started building against a later version of libc. include/config-netware.h: Changes for Netware. Needed to build against newer libc. netware/BUILD/nwbootstrap: Fix to build script. sql/mysqld.cc: Added an include. --- include/config-netware.h | 12 ++++++++++++ netware/BUILD/nwbootstrap | 8 +------- sql/mysqld.cc | 1 + 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/include/config-netware.h b/include/config-netware.h index 3e145f566a1..578975a1cea 100644 --- a/include/config-netware.h +++ b/include/config-netware.h @@ -50,6 +50,18 @@ extern "C" { #define HAVE_PTHREAD_YIELD_ZERO_ARG 1 #define HAVE_BROKEN_REALPATH 1 +/*required adjustments with LibC-June-2004 */ +#undef HAVE_POSIX_SIGNALS +#undef HAVE_PTHREAD_ATTR_SETSCOPE +#undef HAVE_ALLOCA_H +#undef HAVE_FINITE +#undef HAVE_GETPWNAM +#undef HAVE_GETPWUID +#undef HAVE_PTHREAD_SETSCHEDPARAM +#undef HAVE_READLINK +#undef HAVE_STPCPY +/*required adjustments with LibC-June-2004 */ + /* no libc crypt() function */ #ifdef HAVE_OPENSSL #define HAVE_CRYPT 1 diff --git a/netware/BUILD/nwbootstrap b/netware/BUILD/nwbootstrap index 2ba90e32fa7..a420aa8b64c 100755 --- a/netware/BUILD/nwbootstrap +++ b/netware/BUILD/nwbootstrap @@ -171,15 +171,9 @@ do rm $file.org done -# create the libmysql.imp file in netware folder from libmysql/libmysql.def -# file -echo "generating llibmysql.imp file..." -awk 'BEGIN{x=0;} x==1 {print $1;next} /EXPORTS/{x=1}' libmysql/libmysql.def > netware/libmysql.imp - # create the libmysql.imp file in netware folder from libmysql/libmysql.def file echo "generating llibmysql.imp file..." -awk 'BEGIN{x=0;} x==1 {print $1;next} /EXPORTS/{x=1}' libmysql/libmysql.def > netware/libmysql.imp - +awk 'BEGIN{x=0;} END{printf("\n");} x==1 {printf(" %s",$1); x++; next} x>1 {printf(",\n %s", $1);next} /EXPORTS/{x=1}' libmysql/libmysql.def > netware/libmysql.imp # build linux tools echo "compiling linux tools..." diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 82335e7d706..ac66874888b 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -114,6 +114,7 @@ int deny_severity = LOG_WARNING; #endif #ifdef __NETWARE__ +#include #include #include #include From 1b970e94e0a736a2056cb94cfcba0b50133da1d6 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 19 Aug 2005 14:49:34 -0400 Subject: [PATCH 7/7] Bug#11338 Fixes from review (identical functionality). include/my_sys.h: Fixes from review (use version in log_event.cc instead) mysql-test/r/ctype_cp932.result: Updated test for bug#11338 (logging of prepared statement w/ blob type) mysql-test/t/ctype_cp932.test: udpated test for bug#11338 (logging of prepared statement w/ blob type) mysys/charset.c: Fixes from review (use version in log_event.cc instead) sql/item.cc: Fixes from review (store character_set_client differently so that fix can be merged forward to 5.0) sql/item.h: Fixes from review sql/log_event.cc: Fixes from review, str_to_hex is now used by item.cc sql/log_event.h: Added prototype for str_to_hex (now used by item.cc) sql/sql_prepare.cc: Fixes from review, store character_set_client differently so that Item_param::query_val_str can use it. --- include/my_sys.h | 1 - mysql-test/r/ctype_cp932.result | 14 ++++++++++++++ mysql-test/t/ctype_cp932.test | 20 ++++++++++++++++++++ mysys/charset.c | 18 ------------------ sql/item.cc | 15 +++++++-------- sql/item.h | 3 ++- sql/log_event.cc | 2 +- sql/log_event.h | 2 +- sql/sql_prepare.cc | 9 ++++++--- 9 files changed, 51 insertions(+), 33 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index eafa41a05c8..8752aa30772 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -788,7 +788,6 @@ extern my_bool init_compiled_charsets(myf flags); extern void add_compiled_collation(CHARSET_INFO *cs); extern ulong escape_string_for_mysql(CHARSET_INFO *charset_info, char *to, const char *from, ulong length); -extern char *bare_str_to_hex(char *to, const char *from, uint len); #ifdef __WIN__ #define BACKSLASH_MBTAIL /* File system character set */ diff --git a/mysql-test/r/ctype_cp932.result b/mysql-test/r/ctype_cp932.result index 0e28edc6df3..85e317481d1 100644 --- a/mysql-test/r/ctype_cp932.result +++ b/mysql-test/r/ctype_cp932.result @@ -8576,6 +8576,20 @@ FC4B DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; +CREATE TABLE t1(f1 blob); +PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)'; +SET @var1= x'8300'; +EXECUTE stmt1 USING @var1; +SHOW BINLOG EVENTS FROM 27642; +Log_name Pos Event_type Server_id Orig_log_pos Info +master-bin.000001 27642 Query 1 27642 use `test`; CREATE TABLE t1(f1 blob) +master-bin.000001 27701 Query 1 27701 use `test`; SET ONE_SHOT CHARACTER_SET_CLIENT=95,COLLATION_CONNECTION=95,COLLATION_DATABASE=95,COLLATION_SERVER=8 +master-bin.000001 27837 User var 1 27837 @`var1`=_binary 0x8300 COLLATE binary +master-bin.000001 27876 Query 1 27876 use `test`; INSERT INTO t1 VALUES(@'var1') +SELECT HEX(f1) FROM t1; +HEX(f1) +8300 +DROP table t1; SET collation_connection='cp932_japanese_ci'; create table t1 select repeat('a',4000) a; delete from t1; diff --git a/mysql-test/t/ctype_cp932.test b/mysql-test/t/ctype_cp932.test index 7060d917ab0..34bf7965248 100644 --- a/mysql-test/t/ctype_cp932.test +++ b/mysql-test/t/ctype_cp932.test @@ -401,6 +401,26 @@ DROP TABLE t2; DROP TABLE t3; #DROP TABLE t4; +# Test prepared statement with 0x8300 sequence in parameter while +# running with cp932 client character set. +CREATE TABLE t1(f1 blob); +PREPARE stmt1 FROM 'INSERT INTO t1 VALUES(?)'; +SET @var1= x'8300'; +# TODO: Note that this doesn't actually test the code which was added for +# bug#11338 because this syntax for prepared statements causes the PS to +# be replicated differently than if we executed the PS from C or Java. +# Using this syntax, variable names are inserted into the binlog instead +# of values. The real goal of this test is to check the code that was +# added to Item_param::query_val_str() in order to do hex encoding of +# PS parameters when the client character set is cp932; +# Bug#11338 has an example java program which can be used to verify this +# code (and I have used it to test the fix) until there is some way to +# exercise this code from mysql-test-run. +EXECUTE stmt1 USING @var1; +SHOW BINLOG EVENTS FROM 27642; +SELECT HEX(f1) FROM t1; +DROP table t1; +# end test for bug#11338 SET collation_connection='cp932_japanese_ci'; -- source include/ctype_filesort.inc diff --git a/mysys/charset.c b/mysys/charset.c index df3f1cfa279..3a39fce9437 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -663,21 +663,3 @@ CHARSET_INFO *fs_character_set() return fs_cset_cache; } #endif - -/* - Transforms a string into hex form. - */ -char *bare_str_to_hex(char *to, const char *from, uint len) -{ - char *p= to; - uint i; - for (i= 0; i < len; i++, p+= 2) - { - /* val[i] is char. Casting to uchar helps greatly if val[i] < 0 */ - uint tmp= (uint) (uchar) from[i]; - p[0]= _dig_vec_upper[tmp >> 4]; - p[1]= _dig_vec_upper[tmp & 15]; - } - *p= 0; - return p; // pointer to end 0 of 'to' -} diff --git a/sql/item.cc b/sql/item.cc index 79579eeeb67..2ae56d17b07 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -1230,7 +1230,7 @@ bool Item_param::set_from_user_var(THD *thd, const user_var_entry *entry) CHARSET_INFO *tocs= thd->variables.collation_connection; uint32 dummy_offset; - value.cs_info.character_set_client= fromcs; + value.cs_info.character_set_of_placeholder= fromcs; /* Setup source and destination character sets so that they are different only if conversion is necessary: this will @@ -1443,7 +1443,7 @@ String *Item_param::val_str(String* str) and avoid one more memcpy/alloc between str and log string. */ -const String *Item_param::query_val_str(String* str, THD *thd) const +const String *Item_param::query_val_str(String* str) const { switch (state) { case INT_VALUE: @@ -1482,18 +1482,17 @@ const String *Item_param::query_val_str(String* str, THD *thd) const buf= str->c_ptr_quick(); ptr= buf; - if (thd->charset()->escape_with_backslash_is_dangerous) + if (value.cs_info.character_set_client->escape_with_backslash_is_dangerous) { - ptr= strmov(ptr, "x\'"); - ptr= bare_str_to_hex(ptr, str_value.ptr(), str_value.length()); + ptr= str_to_hex(ptr, str_value.ptr(), str_value.length()); } else { *ptr++= '\''; ptr+= escape_string_for_mysql(str_value.charset(), ptr, str_value.ptr(), str_value.length()); + *ptr++='\''; } - *ptr++='\''; str->length(ptr - buf); break; } @@ -1523,10 +1522,10 @@ bool Item_param::convert_str_value(THD *thd) here only if conversion is really necessary. */ if (value.cs_info.final_character_set_of_str_value != - value.cs_info.character_set_client) + value.cs_info.character_set_of_placeholder) { rc= thd->convert_string(&str_value, - value.cs_info.character_set_client, + value.cs_info.character_set_of_placeholder, value.cs_info.final_character_set_of_str_value); } else diff --git a/sql/item.h b/sql/item.h index ff34dfad025..080b804c730 100644 --- a/sql/item.h +++ b/sql/item.h @@ -532,6 +532,7 @@ public: struct CONVERSION_INFO { CHARSET_INFO *character_set_client; + CHARSET_INFO *character_set_of_placeholder; /* This points at character set of connection if conversion to it is required (i. e. if placeholder typecode is not BLOB). @@ -591,7 +592,7 @@ public: */ void (*set_param_func)(Item_param *param, uchar **pos, ulong len); - const String *query_val_str(String *str, THD *thd) const; + const String *query_val_str(String *str) const; bool convert_str_value(THD *thd); diff --git a/sql/log_event.cc b/sql/log_event.cc index 4d260763491..66c732e8cb0 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -207,7 +207,7 @@ static inline int read_str(char * &buf, char *buf_end, char * &str, /* Transforms a string into "" or its expression in 0x... form. */ -static char *str_to_hex(char *to, char *from, uint len) +char *str_to_hex(char *to, const char *from, uint len) { char *p= to; if (len) diff --git a/sql/log_event.h b/sql/log_event.h index 7ae4e863fc2..5c81d0c92f0 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -1069,5 +1069,5 @@ public: bool is_valid() { return 1; } }; #endif - +char *str_to_hex(char *to, const char *from, uint len); #endif /* _log_event_h */ diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index d0c06a3eaf7..8a50d0bd50e 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -528,7 +528,9 @@ static void setup_one_conversion_function(THD *thd, Item_param *param, case MYSQL_TYPE_LONG_BLOB: case MYSQL_TYPE_BLOB: param->set_param_func= set_param_str; - param->value.cs_info.character_set_client= &my_charset_bin; + param->value.cs_info.character_set_of_placeholder= &my_charset_bin; + param->value.cs_info.character_set_client= + thd->variables.character_set_client; param->value.cs_info.final_character_set_of_str_value= &my_charset_bin; param->item_type= Item::STRING_ITEM; param->item_result_type= STRING_RESULT; @@ -544,6 +546,7 @@ static void setup_one_conversion_function(THD *thd, Item_param *param, CHARSET_INFO *tocs= thd->variables.collation_connection; uint32 dummy_offset; + param->value.cs_info.character_set_of_placeholder= fromcs; param->value.cs_info.character_set_client= fromcs; /* @@ -601,7 +604,7 @@ static bool insert_params_withlog(Prepared_statement *stmt, uchar *null_array, param->set_param_func(param, &read_pos, data_end - read_pos); } } - res= param->query_val_str(&str, thd); + res= param->query_val_str(&str); if (param->convert_str_value(thd)) DBUG_RETURN(1); /* out of memory */ @@ -749,7 +752,7 @@ static bool emb_insert_params_withlog(Prepared_statement *stmt, String *query) client_param->buffer_length); } } - res= param->query_val_str(&str, thd); + res= param->query_val_str(&str); if (param->convert_str_value(thd)) DBUG_RETURN(1); /* out of memory */