diff options
author | unknown <bar@mysql.com> | 2005-08-30 17:11:59 +0500 |
---|---|---|
committer | unknown <bar@mysql.com> | 2005-08-30 17:11:59 +0500 |
commit | bda02a17e79f3346ce2680ed04670e11f2bfcf63 (patch) | |
tree | c58f94fee2fbe590aecabf9195f49dd997b30d9c /sql | |
parent | ffcaabe36ed2fa3bea78f80fb2624688c56ada78 (diff) | |
download | mariadb-git-bda02a17e79f3346ce2680ed04670e11f2bfcf63.tar.gz |
Bug#12363
character_set_results is nullable, but value_ptr returns string "NULL"
set_var.cc:
Create Item_null instead of Item_string for NULL values
variables.result, variables.test:
adding test case
sql/set_var.cc:
Bug#12363
character_set_results is nullable, but value_ptr returns string "NULL"
Create Item_null instead of Item_string for NULL values
mysql-test/t/variables.test:
fixing tests accordingly
mysql-test/r/variables.result:
fixing tests accordingly
Diffstat (limited to 'sql')
-rw-r--r-- | sql/set_var.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index 99985c3647c..50f5c6b840e 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -1598,11 +1598,17 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base) return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type, base),1); case SHOW_CHAR: { - Item_string *tmp; + Item *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_string(str, strlen(str), + system_charset_info, DERIVATION_SYSCONST); + else + { + tmp= new Item_null(); + tmp->collation.set(system_charset_info, DERIVATION_SYSCONST); + } pthread_mutex_unlock(&LOCK_global_system_variables); return tmp; } @@ -1892,7 +1898,7 @@ byte *sys_var_character_set::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base) { CHARSET_INFO *cs= ci_ptr(thd,type)[0]; - return cs ? (byte*) cs->csname : (byte*) "NULL"; + return cs ? (byte*) cs->csname : (byte*) NULL; } |