Bug #12363 | character_set_results is nullable, but value_ptr returns string "NULL" | ||
---|---|---|---|
Submitted: | 3 Aug 2005 23:41 | Modified: | 13 Sep 2005 22:45 |
Reporter: | Timothy Smith | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | 4.1 | OS: | Any (any) |
Assigned to: | Alexander Barkov | CPU Architecture: | Any |
[3 Aug 2005 23:41]
Timothy Smith
[4 Aug 2005 0:33]
Timothy Smith
This patch makes it work - but I bet it's not quite correct. 12:31 ~/m/41/a$ bk diffs -u sql ===== sql/set_var.cc 1.169 vs edited ===== --- 1.169/sql/set_var.cc 2005-07-29 10:37:00 +12:00 +++ edited/sql/set_var.cc 2005-08-04 12:29:21 +12:00 @@ -1603,8 +1603,14 @@ Item_string *tmp; pthread_mutex_lock(&LOCK_global_system_variables); char *str= (char*) value_ptr(thd, var_type, base); - tmp= new Item_string(str, strlen(str), - system_charset_info, DERIVATION_SYSCONST); + if (!str) + { + tmp= new Item_empty_string("", 0); + tmp->null_value= 1; + } + else + tmp= new Item_string(str, strlen(str), + system_charset_info, DERIVATION_SYSCONST); pthread_mutex_unlock(&LOCK_global_system_variables); return tmp; } @@ -1894,7 +1900,7 @@ LEX_STRING *base) { CHARSET_INFO *cs= ci_ptr(thd,type)[0]; - return cs ? (byte*) cs->csname : (byte*) "NULL"; + return cs ? (byte*) cs->csname : NULL; }
[30 Aug 2005 12:15]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/internals/29026
[5 Sep 2005 7:48]
Alexander Barkov
Fixed in 4.1.15 and 5.0.13
[13 Sep 2005 22:45]
Mike Hillyer
Documented in 5.0.13 and 4.1.15 changelogs: <listitem> <para> The value of <literal>character_set_results</literal> could be set to <literal>NULL</literal>, but returned the string <literal>"NULL"</literal> when retrieved. (Bug #12363) </para> </listitem>