1
0
mirror of https://github.com/MariaDB/server.git synced 2025-09-02 09:41:40 +03:00

Bug#41030 Wrong meta data (incorrect fieldlen)

set user variable max length on
fix_length_and_dec() stage
using real value length.


mysql-test/r/variables.result:
  test result
mysql-test/t/variables.test:
  test case
sql/item_func.cc:
  set user variable max length on
  fix_length_and_dec() stage
  using real value length.
This commit is contained in:
Sergey Glukhov
2009-03-05 15:34:02 +04:00
parent 326de4957a
commit 3ef86918a2
3 changed files with 22 additions and 1 deletions

View File

@@ -4837,7 +4837,10 @@ bool Item_func_get_system_var::is_written_to_binlog()
void Item_func_get_system_var::fix_length_and_dec()
{
char *cptr;
int well_formed_error;
maybe_null=0;
max_length= 0;
if (var->check_type(var_type))
{
@@ -4867,8 +4870,14 @@ void Item_func_get_system_var::fix_length_and_dec()
break;
case SHOW_CHAR:
case SHOW_CHAR_PTR:
pthread_mutex_lock(&LOCK_global_system_variables);
cptr= var->show_type() == SHOW_CHAR_PTR ?
*(char**) var->value_ptr(current_thd, var_type, &component) :
(char*) var->value_ptr(current_thd, var_type, &component);
if (cptr)
max_length= strlen(cptr) * system_charset_info->mbmaxlen;
pthread_mutex_unlock(&LOCK_global_system_variables);
collation.set(system_charset_info, DERIVATION_SYSCONST);
max_length= MAX_BLOB_WIDTH;
decimals=NOT_FIXED_DEC;
break;
case SHOW_BOOL: