summaryrefslogtreecommitdiff
path: root/storage/myisam/mi_open.c
diff options
context:
space:
mode:
authorunknown <andrey@example.com>2006-12-01 11:37:33 +0100
committerunknown <andrey@example.com>2006-12-01 11:37:33 +0100
commit36a983b89a950374f9322bf7024654f9552ad364 (patch)
treeb4c03ee339d295c065a3bf2c8acbbf6881a00e02 /storage/myisam/mi_open.c
parent5ec298dc192eced9f7b071f0ee14e3b0f0c64b60 (diff)
parentc429ca8498cbd8f6402403c5f8396c49f60c1d70 (diff)
downloadmariadb-git-36a983b89a950374f9322bf7024654f9552ad364.tar.gz
Merge example.com:/work/bug24395-v2/my50
into example.com:/work/bug24395-v2/my51 mysql-test/r/alter_table.result: Auto merged mysql-test/t/alter_table.test: Auto merged storage/myisam/mi_open.c: Auto merged sql/sql_table.cc: manual merge
Diffstat (limited to 'storage/myisam/mi_open.c')
-rw-r--r--storage/myisam/mi_open.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/storage/myisam/mi_open.c b/storage/myisam/mi_open.c
index 010f7233c32..bc705a3bf7a 100644
--- a/storage/myisam/mi_open.c
+++ b/storage/myisam/mi_open.c
@@ -1282,13 +1282,30 @@ int mi_enable_indexes(MI_INFO *info)
RETURN
0 indexes are not disabled
1 all indexes are disabled
- [2 non-unique indexes are disabled - NOT YET IMPLEMENTED]
+ 2 non-unique indexes are disabled
*/
int mi_indexes_are_disabled(MI_INFO *info)
{
MYISAM_SHARE *share= info->s;
- return (! mi_is_any_key_active(share->state.key_map) && share->base.keys);
+ /*
+ No keys or all are enabled. keys is the number of keys. Left shifted
+ gives us only one bit set. When decreased by one, gives us all all bits
+ up to this one set and it gets unset.
+ */
+ if (!share->base.keys ||
+ (mi_is_all_keys_active(share->state.key_map, share->base.keys)))
+ return 0;
+
+ /* All are disabled */
+ if (mi_is_any_key_active(share->state.key_map))
+ return 1;
+
+ /*
+ We have keys. Some enabled, some disabled.
+ Don't check for any non-unique disabled but return directly 2
+ */
+ return 2;
}