diff options
author | unknown <vva@eagle.mysql.r18.ru> | 2004-03-13 23:13:31 +0400 |
---|---|---|
committer | unknown <vva@eagle.mysql.r18.ru> | 2004-03-13 23:13:31 +0400 |
commit | 5a67c11c1890edd331df70c33df45f791d8aa92a (patch) | |
tree | e13473a9ff7e860a9284023ca3cd4d3aaf7c632c /sql | |
parent | 8b11f1c10620b40c9fa654f3738daeab4369f8b6 (diff) | |
download | mariadb-git-5a67c11c1890edd331df70c33df45f791d8aa92a.tar.gz |
fixed bug #1427 "enum allows duplicate values in the list"
include/mysqld_error.h:
added ER_DUPLICATED_VALUE_IN_TYPE
mysql-test/r/create.result:
added test for bug #1427 "enum allows duplicate values in the list"
mysql-test/t/create.test:
added test for bug #1427 "enum allows duplicate values in the list"
sql/share/czech/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/danish/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/dutch/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/english/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/estonian/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/french/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/german/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/greek/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/hungarian/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/italian/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/japanese/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/korean/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/norwegian-ny/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/norwegian/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/polish/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/portuguese/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/romanian/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/russian/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/serbian/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/slovak/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/spanish/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/swedish/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/share/ukrainian/errmsg.txt:
added message for ER_DUPLICATED_VALUE_IN_TYPE
sql/sql_table.cc:
added function check_duplicates_in_interval and
calling it from mysql_create_table for enum and set
Diffstat (limited to 'sql')
-rw-r--r-- | sql/share/czech/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/danish/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/dutch/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/english/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/estonian/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/french/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/german/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/greek/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/hungarian/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/italian/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/japanese/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/korean/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/norwegian-ny/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/norwegian/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/polish/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/portuguese/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/romanian/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/russian/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/serbian/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/slovak/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/spanish/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/swedish/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/share/ukrainian/errmsg.txt | 1 | ||||
-rw-r--r-- | sql/sql_table.cc | 48 |
24 files changed, 71 insertions, 0 deletions
diff --git a/sql/share/czech/errmsg.txt b/sql/share/czech/errmsg.txt index f3e2cf16cad..3a2d7a44c44 100644 --- a/sql/share/czech/errmsg.txt +++ b/sql/share/czech/errmsg.txt @@ -303,3 +303,4 @@ character-set=latin2 "The target table %-.100s of the %s is not updatable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/danish/errmsg.txt b/sql/share/danish/errmsg.txt index caf0a765e20..917ea3bf407 100644 --- a/sql/share/danish/errmsg.txt +++ b/sql/share/danish/errmsg.txt @@ -297,3 +297,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/dutch/errmsg.txt b/sql/share/dutch/errmsg.txt index ba32e34f01a..16cf2fd15de 100644 --- a/sql/share/dutch/errmsg.txt +++ b/sql/share/dutch/errmsg.txt @@ -305,3 +305,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/english/errmsg.txt b/sql/share/english/errmsg.txt index a82662835f8..8c4e0530ed4 100644 --- a/sql/share/english/errmsg.txt +++ b/sql/share/english/errmsg.txt @@ -294,3 +294,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updatable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/estonian/errmsg.txt b/sql/share/estonian/errmsg.txt index 01dbf4de869..8c7cc53ef06 100644 --- a/sql/share/estonian/errmsg.txt +++ b/sql/share/estonian/errmsg.txt @@ -299,3 +299,4 @@ character-set=latin7 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/french/errmsg.txt b/sql/share/french/errmsg.txt index c194d0d74fe..78d729fc9f8 100644 --- a/sql/share/french/errmsg.txt +++ b/sql/share/french/errmsg.txt @@ -294,3 +294,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/german/errmsg.txt b/sql/share/german/errmsg.txt index bb69a5e59c9..142076a1f14 100644 --- a/sql/share/german/errmsg.txt +++ b/sql/share/german/errmsg.txt @@ -306,3 +306,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/greek/errmsg.txt b/sql/share/greek/errmsg.txt index eaddf453d41..b9f47a54b35 100644 --- a/sql/share/greek/errmsg.txt +++ b/sql/share/greek/errmsg.txt @@ -294,3 +294,4 @@ character-set=greek "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/hungarian/errmsg.txt b/sql/share/hungarian/errmsg.txt index 4cfd68b3870..9deb3da88a2 100644 --- a/sql/share/hungarian/errmsg.txt +++ b/sql/share/hungarian/errmsg.txt @@ -296,3 +296,4 @@ character-set=latin2 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/italian/errmsg.txt b/sql/share/italian/errmsg.txt index 1c106bb489c..9b5a081ec9d 100644 --- a/sql/share/italian/errmsg.txt +++ b/sql/share/italian/errmsg.txt @@ -294,3 +294,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/japanese/errmsg.txt b/sql/share/japanese/errmsg.txt index 535719faf39..1a17277cb90 100644 --- a/sql/share/japanese/errmsg.txt +++ b/sql/share/japanese/errmsg.txt @@ -296,3 +296,4 @@ character-set=ujis "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/korean/errmsg.txt b/sql/share/korean/errmsg.txt index eee3431b2b6..9b07afd16c9 100644 --- a/sql/share/korean/errmsg.txt +++ b/sql/share/korean/errmsg.txt @@ -294,3 +294,4 @@ character-set=euckr "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/norwegian-ny/errmsg.txt b/sql/share/norwegian-ny/errmsg.txt index 300cca0d13b..aaba0f1afbe 100644 --- a/sql/share/norwegian-ny/errmsg.txt +++ b/sql/share/norwegian-ny/errmsg.txt @@ -296,3 +296,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/norwegian/errmsg.txt b/sql/share/norwegian/errmsg.txt index 58b8f8ca7a0..f205e07b3bb 100644 --- a/sql/share/norwegian/errmsg.txt +++ b/sql/share/norwegian/errmsg.txt @@ -296,3 +296,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/polish/errmsg.txt b/sql/share/polish/errmsg.txt index 829a489cb6e..2c942d40f80 100644 --- a/sql/share/polish/errmsg.txt +++ b/sql/share/polish/errmsg.txt @@ -298,3 +298,4 @@ character-set=latin2 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/portuguese/errmsg.txt b/sql/share/portuguese/errmsg.txt index 819904b826c..f3a8a484696 100644 --- a/sql/share/portuguese/errmsg.txt +++ b/sql/share/portuguese/errmsg.txt @@ -295,3 +295,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/romanian/errmsg.txt b/sql/share/romanian/errmsg.txt index 9ec9524838b..72df2447f99 100644 --- a/sql/share/romanian/errmsg.txt +++ b/sql/share/romanian/errmsg.txt @@ -298,3 +298,4 @@ character-set=latin2 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/russian/errmsg.txt b/sql/share/russian/errmsg.txt index d19fab63cc3..3d37b2d60ce 100644 --- a/sql/share/russian/errmsg.txt +++ b/sql/share/russian/errmsg.txt @@ -296,3 +296,4 @@ character-set=koi8r "ôÁÂÌÉÃÁ %-.100s × %s ÎÅ ÍÏÖÅÔ ÉÚÍÅÎÑÔÓÑ", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/serbian/errmsg.txt b/sql/share/serbian/errmsg.txt index 02531521a2f..c68f9538dd2 100644 --- a/sql/share/serbian/errmsg.txt +++ b/sql/share/serbian/errmsg.txt @@ -288,3 +288,4 @@ character-set=cp1250 "The target table %-.100s of the %s is not updatable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working" "The MySQL server is running with the %s option so it cannot execute this statement" +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/slovak/errmsg.txt b/sql/share/slovak/errmsg.txt index 6fe36c14c56..35263024bb8 100644 --- a/sql/share/slovak/errmsg.txt +++ b/sql/share/slovak/errmsg.txt @@ -302,3 +302,4 @@ character-set=latin2 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/spanish/errmsg.txt b/sql/share/spanish/errmsg.txt index 45529118544..3e0f67b453a 100644 --- a/sql/share/spanish/errmsg.txt +++ b/sql/share/spanish/errmsg.txt @@ -296,3 +296,4 @@ character-set=latin1 "The target table %-.100s of the %s is not updateable", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/swedish/errmsg.txt b/sql/share/swedish/errmsg.txt index e26626931f9..dc6759f91e0 100644 --- a/sql/share/swedish/errmsg.txt +++ b/sql/share/swedish/errmsg.txt @@ -294,3 +294,4 @@ character-set=latin1 "'%s' är inte aktiverad; För att aktivera detta måste du bygga om MySQL med '%s' definerad", "MySQL är started i --skip-grant-tables mod. Pga av detta kan du inte använda detta program", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/share/ukrainian/errmsg.txt b/sql/share/ukrainian/errmsg.txt index d88c5594e1d..fbf31744dca 100644 --- a/sql/share/ukrainian/errmsg.txt +++ b/sql/share/ukrainian/errmsg.txt @@ -299,3 +299,4 @@ character-set=koi8u "ôÁÂÌÉÃÑ %-.100s Õ %s ÎÅ ÍÏÖÅ ÏÎÏ×ÌÀ×ÁÔÉÓØ", "The '%s' feature was disabled; you need MySQL built with '%s' to have it working", "The MySQL server is running with the %s option so it cannot execute this statement", +"Column '%-.100s' has duplicated value '%-.64s' in %s" diff --git a/sql/sql_table.cc b/sql/sql_table.cc index ee11b7b9da0..e22d8f022da 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -342,6 +342,50 @@ static int sort_keys(KEY *a, KEY *b) 0); } +/* + Check TYPELIB (set or enum) for duplicates + + SYNOPSIS + check_duplicates_in_interval() + set_or_name "SET" or "ENUM" string for warning message + name name of the checked column + typelib list of values for the column + + DESCRIPTION + This function prints an warning for each value in list + which has some duplicates on its right + + RETURN VALUES + void +*/ + +void check_duplicates_in_interval(const char *set_or_name, + const char *name, TYPELIB *typelib) +{ + unsigned int old_count= typelib->count; + const char **old_type_names= typelib->type_names; + + if (typelib->count <= 1) + return; + + old_count= typelib->count; + old_type_names= typelib->type_names; + const char **cur_value= typelib->type_names; + for ( ; typelib->count > 1; cur_value++) + { + typelib->type_names++; + typelib->count--; + if (find_type((char*)*cur_value,typelib,1)) + { + push_warning_printf(current_thd,MYSQL_ERROR::WARN_LEVEL_ERROR, + ER_DUPLICATED_VALUE_IN_TYPE, + ER(ER_DUPLICATED_VALUE_IN_TYPE), + name,*cur_value,set_or_name); + } + } + typelib->count= old_count; + typelib->type_names= old_type_names; +} /* Create a table @@ -546,6 +590,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, if (sql_field->charset->state & MY_CS_BINSORT) sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->unireg_check=Field::INTERVAL_FIELD; + check_duplicates_in_interval("ENUM",sql_field->field_name, + sql_field->interval); break; case FIELD_TYPE_SET: sql_field->pack_flag=pack_length_to_packflag(sql_field->pack_length) | @@ -553,6 +599,8 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, if (sql_field->charset->state & MY_CS_BINSORT) sql_field->pack_flag|=FIELDFLAG_BINARY; sql_field->unireg_check=Field::BIT_FIELD; + check_duplicates_in_interval("SET",sql_field->field_name, + sql_field->interval); break; case FIELD_TYPE_DATE: // Rest of string types case FIELD_TYPE_NEWDATE: |