diff options
author | unknown <konstantin@mysql.com> | 2006-02-21 19:52:20 +0300 |
---|---|---|
committer | unknown <konstantin@mysql.com> | 2006-02-21 19:52:20 +0300 |
commit | 9cf3f255bded9642b6b6b23b4510514c08bcbe84 (patch) | |
tree | 94108427c4a6010330c5f629808e88a1ab43f158 /mysql-test/t/ps.test | |
parent | 1e686ae7702d297cc9fd261c42864653f4fdd7b3 (diff) | |
download | mariadb-git-9cf3f255bded9642b6b6b23b4510514c08bcbe84.tar.gz |
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).
mysql-test/r/ps.result:
Test results fixed (Bug#13134)
mysql-test/t/ps.test:
A test case for Bug#13134 "Length of VARCHAR() utf8 column is
increasing when table is recreated with PS/SP"
sql/field.cc:
Move initialization of create_field::char_length to the constructor
of create_field.
sql/field.h:
Rename chars_length to char_length (to be consistent with
how this term is used throughout the rest of the code).
sql/sql_parse.cc:
Initialize char_length in add_field_to_list. This function
effectively works as another create_field constructor.
sql/sql_table.cc:
Reinit length from char_length for every field in
mysql_prepare_table. This is not needed if we're executing
a statement for the first time, however, at subsequent executions
length contains the number of bytes, not characters (as it's expected
to).
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r-- | mysql-test/t/ps.test | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index b0755d06414..b1f6be819d4 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -763,5 +763,27 @@ execute stmt using @like; deallocate prepare stmt; drop table t1; -# End of 4.1 tests +# +# Bug#13134 "Length of VARCHAR() utf8 column is increasing when table is +# recreated with PS/SP" +# + +drop table if exists t1; +prepare stmt from 'create table t1 (a varchar(10) character set utf8)'; +execute stmt; +--disable_warnings +insert into t1 (a) values (repeat('a', 20)); +--enable_warnings +select length(a) from t1; +drop table t1; +execute stmt; +--disable_warnings +insert into t1 (a) values (repeat('a', 20)); +--enable_warnings +# Check that the data is truncated to the same length +select length(a) from t1; +drop table t1; +deallocate prepare stmt; + +# End of 4.1 tests |