diff options
author | unknown <elliot@mysql.com> | 2005-08-19 15:29:30 -0400 |
---|---|---|
committer | unknown <elliot@mysql.com> | 2005-08-19 15:29:30 -0400 |
commit | 452178b79a1e2e4e44e18253164c706d0c80cad9 (patch) | |
tree | df0249492ecffbc91a5e3478685c8f1ad074a428 /sql | |
parent | 1a6a2322ef50ab44cd93c41c9e44d1945044fe57 (diff) | |
parent | 7eecc2d6225e069d9ab96a7fc2b77e4aa5551b7d (diff) | |
download | mariadb-git-452178b79a1e2e4e44e18253164c706d0c80cad9.tar.gz |
Merge mysql.com:/home/emurphy/src/bk-clean/mysql-4.1
into mysql.com:/home/emurphy/src/work/mysql-5.0
BitKeeper/deleted/.del-ctype-cp932.c:
Auto merged
BitKeeper/deleted/.del-ctype_cp932.result:
Auto merged
BitKeeper/deleted/.del-ctype_cp932.test:
Auto merged
include/m_ctype.h:
Auto merged
include/my_sys.h:
Auto merged
innobase/srv/srv0start.c:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysys/charset.c:
Auto merged
netware/BUILD/nwbootstrap:
Auto merged
sql/item.h:
Auto merged
sql/log_event.cc:
Auto merged
sql/log_event.h:
Auto merged
sql/sql_prepare.cc:
Auto merged
strings/ctype-big5.c:
Auto merged
strings/ctype-bin.c:
Auto merged
strings/ctype-czech.c:
Auto merged
strings/ctype-euc_kr.c:
Auto merged
strings/ctype-extra.c:
Auto merged
strings/ctype-gb2312.c:
Auto merged
strings/ctype-gbk.c:
Auto merged
strings/ctype-latin1.c:
Auto merged
strings/ctype-sjis.c:
Auto merged
strings/ctype-tis620.c:
Auto merged
strings/ctype-uca.c:
Auto merged
strings/ctype-ucs2.c:
Auto merged
strings/ctype-ujis.c:
Auto merged
strings/ctype-utf8.c:
Auto merged
strings/ctype-win1250ch.c:
Auto merged
configure.in:
Manual merge from 4.1
include/config-netware.h:
Manual merge from 4.1
sql/item.cc:
Manual merge from 4.1
sql/mysqld.cc:
Manual merge from 4.1
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item.cc | 21 | ||||
-rw-r--r-- | sql/item.h | 1 | ||||
-rw-r--r-- | sql/log_event.cc | 2 | ||||
-rw-r--r-- | sql/log_event.h | 2 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 5 |
5 files changed, 21 insertions, 10 deletions
diff --git a/sql/item.cc b/sql/item.cc index 7575a6a218b..d8f5a7cf9c4 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2138,7 +2138,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 @@ -2456,10 +2456,17 @@ 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, 0, - str_value.ptr(), str_value.length()); - *ptr++= '\''; + if (value.cs_info.character_set_client->escape_with_backslash_is_dangerous) + { + ptr= str_to_hex(ptr, str_value.ptr(), str_value.length()); + } + else + { + *ptr++= '\''; + ptr+= escape_string_for_mysql(str_value.charset(), ptr, 0, + str_value.ptr(), str_value.length()); + *ptr++='\''; + } str->length((uint32) (ptr - buf)); break; } @@ -2489,10 +2496,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 4dfd99e0dbd..ebcd5a9da33 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1026,6 +1026,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). diff --git a/sql/log_event.cc b/sql/log_event.cc index bdf17ba20e3..23a301873cd 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -210,7 +210,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 3ac1cfaf4bc..1d8941e65ac 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -1582,5 +1582,5 @@ public: bool is_valid() const { 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 8c3a61d39de..112c4a3dd47 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -551,7 +551,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; @@ -567,6 +569,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; /* |