summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-12-07 15:47:00 +0200
committerunknown <monty@mysql.com>2004-12-07 15:47:00 +0200
commit9ca50fe1446e3fa955ea0adeefc077b674f36112 (patch)
treeb1c918186908fb490aa860c35dc9e2154aa633c8 /sql/sql_table.cc
parent8379b61efb053da778846416baf23812a26e8f86 (diff)
downloadmariadb-git-9ca50fe1446e3fa955ea0adeefc077b674f36112.tar.gz
Update results for new varchar handling
Fixed compiler warnings String results in CREATE ... SELECT are now created as CHAR(0), VARCHAR(X) or TEXT() depending on item->max_length myisam/myisampack.c: Indentation cleanup mysql-test/r/analyse.result: Update results for new varchar handling mysql-test/r/case.result: Update results for new varchar handling mysql-test/r/cast.result: Update results for new varchar handling mysql-test/r/create.result: Update results for new varchar handling mysql-test/r/ctype_mb.result: Update results for new varchar handling mysql-test/r/ctype_ucs.result: Update results for new varchar handling mysql-test/r/ctype_utf8.result: Update results for new varchar handling mysql-test/r/func_group.result: Update results for new varchar handling mysql-test/r/func_str.result: Update results for new varchar handling mysql-test/r/func_system.result: Update results for new varchar handling mysql-test/r/heap.result: Update results for new varchar handling mysql-test/r/heap_hash.result: Update results for new varchar handling mysql-test/r/information_schema.result: Update results for new varchar handling mysql-test/r/metadata.result: Update results for new varchar handling mysql-test/r/null.result: Update results for new varchar handling mysql-test/r/ps_2myisam.result: Update results for new varchar handling mysql-test/r/ps_3innodb.result: Update results for new varchar handling mysql-test/r/ps_4heap.result: Update results for new varchar handling mysql-test/r/ps_5merge.result: Update results for new varchar handling mysql-test/r/ps_6bdb.result: Update results for new varchar handling mysql-test/r/subselect.result: Update results for new varchar handling mysql-test/r/type_ranges.result: Update results for new varchar handling mysql-test/r/union.result: Update results for new varchar handling mysql-test/t/heap.test: Update results for new varchar handling mysql-test/t/type_ranges.test: Added extra test to test generated type for string functions sql/field.cc: Update results for new varchar handling sql/field.h: Update results for new varchar handling We have to use orig_table instead of table as 'table' may point to a new field in the created table sql/field_conv.cc: Update results for new varchar handling sql/ha_heap.cc: Indentation fixes sql/ha_innodb.cc: Update results for new varchar handling sql/item.cc: Update results for new varchar handling Remove compiler warnings String results in CREATE ... SELECT are now created as CHAR(0), VARCHAR(X) or TEXT() depending on item->max_length sql/item.h: Update results for new varchar handling sql/item_func.cc: Update results for new varchar handling String results in CREATE ... SELECT are now created as CHAR(0), VARCHAR(X) or TEXT() depending on item->max_length sql/item_func.h: ANALYZE now return VARCHAR columns sql/procedure.h: Update results for new varchar handling sql/sql_acl.cc: After merge fixes sql/sql_select.cc: Update results for new varchar handling String results in temporary tables are now created as CHAR(0), VARCHAR(X) or TEXT() depending on item->max_length sql/sql_show.cc: After merge fixes sql/sql_table.cc: After merge fixes strings/ctype-tis620.c: After merge fixes tests/client_test.c: Fixed results, as in MySQL 5.0 strings in CREATE ... SELECT are creates VARCHAR columns
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 29a92e901c8..56605d1c6e0 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -540,6 +540,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
if (sql_field->sql_type == FIELD_TYPE_SET)
{
+ uint32 field_length;
if (sql_field->def)
{
char *not_used;
@@ -555,11 +556,12 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(-1);
}
}
- calculate_interval_lengths(cs, interval, &dummy, &sql_field->length);
- sql_field->length+= (interval->count - 1);
+ calculate_interval_lengths(cs, interval, &dummy, &field_length);
+ sql_field->length= field_length + (interval->count - 1);
}
else /* FIELD_TYPE_ENUM */
{
+ uint32 field_length;
if (sql_field->def)
{
String str, *def= sql_field->def->val_str(&str);
@@ -570,7 +572,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(-1);
}
}
- calculate_interval_lengths(cs, interval, &sql_field->length, &dummy);
+ calculate_interval_lengths(cs, interval, &field_length, &dummy);
+ sql_field->length= field_length;
}
set_if_smaller(sql_field->length, MAX_FIELD_WIDTH-1);
}
@@ -608,13 +611,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
sql_field->length= 0; // Probably from an item
}
- /* Don't pack rows in old tables if the user has requested this */
- if ((sql_field->flags & BLOB_FLAG) ||
- sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
- create_info->row_type != ROW_TYPE_FIXED)
- {
- db_options|=HA_OPTION_PACK_RECORD;
- }
if (!(sql_field->flags & NOT_NULL_FLAG))
null_fields++;
@@ -649,6 +645,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
create_info->default_table_charset);
sql_field->length= dup_field->length;
sql_field->pack_length= dup_field->pack_length;
+ sql_field->key_length= dup_field->key_length;
sql_field->create_length_to_internal_length();
sql_field->decimals= dup_field->decimals;
sql_field->flags= dup_field->flags;
@@ -659,6 +656,11 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
}
}
}
+ /* Don't pack rows in old tables if the user has requested this */
+ if ((sql_field->flags & BLOB_FLAG) ||
+ sql_field->sql_type == MYSQL_TYPE_VARCHAR &&
+ create_info->row_type != ROW_TYPE_FIXED)
+ db_options|= HA_OPTION_PACK_RECORD;
it2.rewind();
}
/* If fixed row records, we need one bit to check for deleted rows */