1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

A fix and a test case for Bug#13134 "Length of VARCHAR() utf8

column is increasing when table is recreated with PS/SP":
make use of create_field::char_length more consistent in the code.
Reinit create_field::length from create_field::char_length
for every execution of a prepared statement (actually fixes the 
bug).
This commit is contained in:
konstantin@mysql.com
2006-02-21 19:52:20 +03:00
parent 736faf4730
commit 442c2ba8af
6 changed files with 52 additions and 6 deletions

View File

@@ -488,6 +488,12 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
for (field_no=0; (sql_field=it++) ; field_no++)
{
/*
Initialize length from its original value (number of characters),
which was set in the parser. This is necessary if we're
executing a prepared statement for the second time.
*/
sql_field->length= sql_field->char_length;
if (!sql_field->charset)
sql_field->charset= create_info->default_table_charset;
/*
@@ -665,7 +671,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->charset= (dup_field->charset ?
dup_field->charset :
create_info->default_table_charset);
sql_field->length= dup_field->chars_length;
sql_field->length= dup_field->char_length;
sql_field->pack_length= dup_field->pack_length;
sql_field->create_length_to_internal_length();
sql_field->decimals= dup_field->decimals;