Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/opt/local/work/mysql-4.1-root
This commit is contained in:
commit
40b368af16
@ -733,3 +733,17 @@ count(*)
|
|||||||
5
|
5
|
||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
prepare stmt from 'create table t1 (a varchar(10) character set utf8)';
|
||||||
|
execute stmt;
|
||||||
|
insert into t1 (a) values (repeat('a', 20));
|
||||||
|
select length(a) from t1;
|
||||||
|
length(a)
|
||||||
|
10
|
||||||
|
drop table t1;
|
||||||
|
execute stmt;
|
||||||
|
insert into t1 (a) values (repeat('a', 20));
|
||||||
|
select length(a) from t1;
|
||||||
|
length(a)
|
||||||
|
10
|
||||||
|
drop table t1;
|
||||||
|
deallocate prepare stmt;
|
||||||
|
@ -763,5 +763,26 @@ execute stmt using @like;
|
|||||||
deallocate prepare stmt;
|
deallocate prepare stmt;
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
|
||||||
# End of 4.1 tests
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Bug#13134 "Length of VARCHAR() utf8 column is increasing when table is
|
||||||
|
# recreated with PS/SP"
|
||||||
|
#
|
||||||
|
|
||||||
|
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
|
||||||
|
@ -6516,13 +6516,11 @@ bool Field_num::eq_def(Field *field)
|
|||||||
create_field::create_length_to_internal_length()
|
create_field::create_length_to_internal_length()
|
||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Convert create_field::length from number of characters to number of bytes,
|
Convert create_field::length from number of characters to number of bytes.
|
||||||
save original value in chars_length.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void create_field::create_length_to_internal_length(void)
|
void create_field::create_length_to_internal_length(void)
|
||||||
{
|
{
|
||||||
chars_length= length;
|
|
||||||
switch (sql_type) {
|
switch (sql_type) {
|
||||||
case MYSQL_TYPE_TINY_BLOB:
|
case MYSQL_TYPE_TINY_BLOB:
|
||||||
case MYSQL_TYPE_MEDIUM_BLOB:
|
case MYSQL_TYPE_MEDIUM_BLOB:
|
||||||
@ -6775,6 +6773,7 @@ create_field::create_field(Field *old_field,Field *orig_field)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char_length= length;
|
||||||
decimals= old_field->decimals();
|
decimals= old_field->decimals();
|
||||||
if (sql_type == FIELD_TYPE_STRING)
|
if (sql_type == FIELD_TYPE_STRING)
|
||||||
{
|
{
|
||||||
|
@ -1188,7 +1188,7 @@ public:
|
|||||||
/*
|
/*
|
||||||
The value of 'length' before a call to create_length_to_internal_length
|
The value of 'length' before a call to create_length_to_internal_length
|
||||||
*/
|
*/
|
||||||
uint32 chars_length;
|
uint32 char_length;
|
||||||
uint decimals,flags,pack_length;
|
uint decimals,flags,pack_length;
|
||||||
Field::utype unireg_check;
|
Field::utype unireg_check;
|
||||||
TYPELIB *interval; // Which interval to use
|
TYPELIB *interval; // Which interval to use
|
||||||
|
@ -4480,6 +4480,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
|||||||
NOT_FIXED_DEC-1) : 0;
|
NOT_FIXED_DEC-1) : 0;
|
||||||
new_field->sql_type=type;
|
new_field->sql_type=type;
|
||||||
new_field->length=0;
|
new_field->length=0;
|
||||||
|
new_field->char_length= 0;
|
||||||
new_field->change=change;
|
new_field->change=change;
|
||||||
new_field->interval=0;
|
new_field->interval=0;
|
||||||
new_field->pack_length=0;
|
new_field->pack_length=0;
|
||||||
@ -4750,6 +4751,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
|
|||||||
FIELD_TYPE_STRING :
|
FIELD_TYPE_STRING :
|
||||||
new_field->sql_type,
|
new_field->sql_type,
|
||||||
new_field->length);
|
new_field->length);
|
||||||
|
new_field->char_length= new_field->length;
|
||||||
lex->create_list.push_back(new_field);
|
lex->create_list.push_back(new_field);
|
||||||
lex->last_field=new_field;
|
lex->last_field=new_field;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
|
@ -488,6 +488,12 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
|
|
||||||
for (field_no=0; (sql_field=it++) ; field_no++)
|
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)
|
if (!sql_field->charset)
|
||||||
sql_field->charset= create_info->default_table_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 ?
|
sql_field->charset= (dup_field->charset ?
|
||||||
dup_field->charset :
|
dup_field->charset :
|
||||||
create_info->default_table_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->pack_length= dup_field->pack_length;
|
||||||
sql_field->create_length_to_internal_length();
|
sql_field->create_length_to_internal_length();
|
||||||
sql_field->decimals= dup_field->decimals;
|
sql_field->decimals= dup_field->decimals;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user