summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2004-12-02 14:43:51 +0200
committerunknown <monty@mysql.com>2004-12-02 14:43:51 +0200
commit9589175a02d93a3f99077155ecaa158e7b9239b8 (patch)
tree8f90ede7dbeae77977acb6dee6d00daeb9081399 /sql/sql_table.cc
parentbf98c9795921bf82b96470ad89c1768f03271ed9 (diff)
downloadmariadb-git-9589175a02d93a3f99077155ecaa158e7b9239b8.tar.gz
Cleanups during review stage
Added auto-correct of field length for enum/set tables for ALTER TABLE This is becasue of a bug in previous MySQL 4.1 versions where the length for enum/set was set incorrectly after ALTER TABLE mysql-test/r/rpl_start_stop_slave.result: Fixed wrong test mysql-test/r/type_enum.result: Added test for wrong enum/set length after alter table mysql-test/t/ps.test: removed empty line mysql-test/t/type_enum.test: Added test for wrong enum/set length after alter table sql/field.cc: Added auto-correct of field length for enum/set tables. This is becasue of a bug in previous MySQL 4.1 versions where the length for enum/set was set incorrectly after ALTER TABLE sql/item_cmpfunc.cc: Simple optimization sql/mysql_priv.h: Made local function global sql/set_var.cc: Simple cleanup sql/sql_table.cc: Simple cleanups & optimizations
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc14
1 files changed, 4 insertions, 10 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index eedd9388877..2260877fc05 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -814,8 +814,7 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
DBUG_RETURN(-1);
}
}
- else
- if (key_info->algorithm == HA_KEY_ALG_RTREE)
+ else if (key_info->algorithm == HA_KEY_ALG_RTREE)
{
#ifdef HAVE_RTREE_KEYS
if ((key_info->key_parts & 1) == 1)
@@ -839,6 +838,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
CHARSET_INFO *ft_key_charset=0; // for FULLTEXT
for (uint column_nr=0 ; (column=cols++) ; column_nr++)
{
+ key_part_spec *dup_column;
+
it.rewind();
field=0;
while ((sql_field=it++) &&
@@ -853,9 +854,8 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
column->field_name);
DBUG_RETURN(-1);
}
- for (uint dup_nr= 0; dup_nr < column_nr; dup_nr++)
+ while ((dup_column= cols2++) != column)
{
- key_part_spec *dup_column= cols2++;
if (!my_strcasecmp(system_charset_info,
column->field_name, dup_column->field_name))
{
@@ -866,12 +866,6 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
}
}
cols2.rewind();
- /* for fulltext keys keyseg length is 1 for blobs (it's ignored in
- ft code anyway, and 0 (set to column width later) for char's.
- it has to be correct col width for char's, as char data are not
- prefixed with length (unlike blobs, where ft code takes data length
- from a data prefix, ignoring column->length).
- */
if (key->type == Key::FULLTEXT)
{
if ((sql_field->sql_type != FIELD_TYPE_STRING &&