diff options
author | unknown <monty@mysql.com> | 2004-05-12 00:29:52 +0300 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-05-12 00:29:52 +0300 |
commit | d3fcd8d4c0e0425433924987afbd5b43bec8e93e (patch) | |
tree | 11c75fdf1dd0dbc84178dbfbb39f5a584d19d581 /sql/sql_class.h | |
parent | 7b4cbde8edeb461ddacdc4d06d33fb8705380f40 (diff) | |
download | mariadb-git-d3fcd8d4c0e0425433924987afbd5b43bec8e93e.tar.gz |
Don't automaticly generate a new key for a foreign key constraint if there is already a usable key.
Prefer not automatic keys before automatic keys. If there is two conf
BitKeeper/etc/ignore:
added *.d
include/my_base.h:
Added flag for automaticly generated key
mysql-test/r/constraints.result:
Update tests after bug fix
mysql-test/r/create.result:
Update tests after bug fix
mysql-test/r/innodb.result:
Added test of automatic creation of foreign keys
mysql-test/t/innodb.test:
Added test of automatic creation of foreign keys
mysql-test/t/key_cache.test:
Portability fixes (64 BIT os)
sql/sql_acl.cc:
Indentation fixes
sql/sql_class.cc:
Fix key comparison to handle prefix and optionally key segments in different order.
sql/sql_class.h:
Added flag for automaticly generated keys
sql/sql_parse.cc:
Added flag for automaticly generated keys
sql/sql_table.cc:
Don't automaticly generate a new key for a foreign key constraint if there is already a usable key.
Prefer not automatic keys before automatic keys. If there is two conflicting automatic keys, prefer the longer one.
sql/sql_yacc.yy:
Added flag for automaticly generated keys
strings/strings-x86.s:
Portability fix.
Diffstat (limited to 'sql/sql_class.h')
-rw-r--r-- | sql/sql_class.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h index a2094d8fe7c..e602b7d6d5f 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -240,14 +240,16 @@ public: enum ha_key_alg algorithm; List<key_part_spec> columns; const char *name; + bool generated; Key(enum Keytype type_par, const char *name_arg, enum ha_key_alg alg_par, - List<key_part_spec> &cols) - :type(type_par), algorithm(alg_par), columns(cols), name(name_arg) + bool generated_arg, List<key_part_spec> &cols) + :type(type_par), algorithm(alg_par), columns(cols), name(name_arg), + generated(generated_arg) {} ~Key() {} /* Equality comparison of keys (ignoring name) */ - bool operator==(Key& other); + friend bool foreign_key_prefix(Key *a, Key *b); }; class Table_ident; @@ -265,7 +267,7 @@ public: foreign_key(const char *name_arg, List<key_part_spec> &cols, Table_ident *table, List<key_part_spec> &ref_cols, uint delete_opt_arg, uint update_opt_arg, uint match_opt_arg) - :Key(FOREIGN_KEY, name_arg, HA_KEY_ALG_UNDEF, cols), + :Key(FOREIGN_KEY, name_arg, HA_KEY_ALG_UNDEF, 0, cols), ref_table(table), ref_columns(cols), delete_opt(delete_opt_arg), update_opt(update_opt_arg), match_opt(match_opt_arg) |