diff options
author | monty@mysql.com <> | 2005-01-06 13:00:13 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2005-01-06 13:00:13 +0200 |
commit | d35140a851e0eccc013f18bee7dee45c4f32d774 (patch) | |
tree | ed8b3e5bd637f4d9661ed2ba57849e7e56d5178a /sql/key.cc | |
parent | 7cf8285b3f7ce0f6d85c3d747bd266697a576dbe (diff) | |
download | mariadb-git-d35140a851e0eccc013f18bee7dee45c4f32d774.tar.gz |
First stage of table definition cache
Split TABLE to TABLE and TABLE_SHARE (TABLE_SHARE is still allocated as part of table, will be fixed soon)
Created Field::make_field() and made Field_num::make_field() to call this
Added 'TABLE_SHARE->db' that points to database name; Changed all usage of table_cache_key as database name to use this instead
Changed field->table_name to point to pointer to alias. This allows us to change alias for a table by just updating one pointer.
Renamed TABLE_SHARE->real_name to table_name
Renamed TABLE->table_name to alias
Renamed TABLE_LIST->real_name to table_name
Diffstat (limited to 'sql/key.cc')
-rw-r--r-- | sql/key.cc | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/key.cc b/sql/key.cc index d54b8721cab..aec294e370a 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -38,7 +38,9 @@ int find_ref_key(TABLE *table,Field *field, uint *key_length) /* Test if some key starts as fieldpos */ - for (i=0, key_info=table->key_info ; i < (int) table->keys ; i++, key_info++) + for (i= 0, key_info= table->key_info ; + i < (int) table->s->keys ; + i++, key_info++) { if (key_info->key_part[0].offset == fieldpos) { /* Found key. Calc keylength */ @@ -48,7 +50,9 @@ int find_ref_key(TABLE *table,Field *field, uint *key_length) } /* Test if some key contains fieldpos */ - for (i=0, key_info=table->key_info ; i < (int) table->keys ; i++, key_info++) + for (i= 0, key_info= table->key_info ; + i < (int) table->s->keys ; + i++, key_info++) { uint j; KEY_PART_INFO *key_part; @@ -373,9 +377,9 @@ bool check_if_key_used(TABLE *table, uint idx, List<Item> &fields) If table handler has primary key as part of the index, check that primary key is not updated */ - if (idx != table->primary_key && table->primary_key < MAX_KEY && + if (idx != table->s->primary_key && table->s->primary_key < MAX_KEY && (table->file->table_flags() & HA_PRIMARY_KEY_IN_READ_INDEX)) - return check_if_key_used(table, table->primary_key, fields); + return check_if_key_used(table, table->s->primary_key, fields); return 0; } |