Commit 4f347492 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

Merge abarkov@build.mysql.com:/home/bk/mysql-4.1

into bar.mysql.r18.ru:/usr/home/bar/mysql-4.1
parents b2a1bf2e 6fa45cec
......@@ -5480,6 +5480,27 @@ create_field::create_field(Field *old_field,Field *orig_field)
if (flags & BLOB_FLAG)
pack_length= (pack_length- old_field->table->blob_ptr_size +
portable_sizeof_char_ptr);
switch (sql_type)
{
case FIELD_TYPE_BLOB:
switch (pack_length - portable_sizeof_char_ptr)
{
case 1: sql_type= FIELD_TYPE_TINY_BLOB; break;
case 2: sql_type= FIELD_TYPE_BLOB; break;
case 3: sql_type= FIELD_TYPE_MEDIUM_BLOB; break;
default: sql_type= FIELD_TYPE_LONG_BLOB; break;
}
length /= charset->mbmaxlen;
break;
case FIELD_TYPE_STRING:
case FIELD_TYPE_VAR_STRING:
length /= charset->mbmaxlen;
break;
default:
break;
}
decimals= old_field->decimals();
if (sql_type == FIELD_TYPE_STRING)
{
......
......@@ -2050,14 +2050,6 @@ mysql_execute_command(THD *thd)
(Table_ident *)lex->name);
else
{
List_iterator<create_field> fields(lex->create_list);
create_field *field;
while ((field= fields++))
{
if (!field->charset)
field->charset= lex->create_info.table_charset;
field->create_length_to_internal_length();
}
res= mysql_create_table(thd,tables->db ? tables->db : thd->db,
tables->real_name, &lex->create_info,
lex->create_list,
......
......@@ -422,6 +422,10 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
for (field_no=0; (sql_field=it++) ; field_no++)
{
if (!sql_field->charset)
sql_field->charset= create_info->table_charset;
sql_field->create_length_to_internal_length();
/* Don't pack keys in old tables if the user has requested this */
if ((sql_field->flags & BLOB_FLAG) ||
sql_field->sql_type == FIELD_TYPE_VAR_STRING &&
......@@ -1916,19 +1920,6 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
List<Key> key_list; // Add new keys here
create_field *def;
/*
For each column set charset to the table
default if the column charset hasn't been specified
explicitely. Change CREATE length into internal length
*/
def_it.rewind();
while ((def= def_it++))
{
if (!def->charset)
def->charset= create_info->table_charset;
def->create_length_to_internal_length();
}
/*
First collect all fields from table which isn't in drop_list
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment