diff options
author | andrey@example.com <> | 2006-12-01 23:11:44 +0100 |
---|---|---|
committer | andrey@example.com <> | 2006-12-01 23:11:44 +0100 |
commit | b275089b667e6b2d5b50fc2076e3b95e703fe797 (patch) | |
tree | efbcd8182dc2ad90a10ac7681b291926ccc8192f /myisam/mi_open.c | |
parent | 80d6de7e5698cff48c5f7cc10962196716d0ea91 (diff) | |
parent | 100dd45ec45c7bf6394a1ea0cc2fc865400c4ae3 (diff) | |
download | mariadb-git-b275089b667e6b2d5b50fc2076e3b95e703fe797.tar.gz |
Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-4.1-maint
into example.com:/work/bug24395-v2/my41
Diffstat (limited to 'myisam/mi_open.c')
-rw-r--r-- | myisam/mi_open.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/myisam/mi_open.c b/myisam/mi_open.c index 4cac19a24bd..4efe6f42d5e 100644 --- a/myisam/mi_open.c +++ b/myisam/mi_open.c @@ -1235,13 +1235,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 (! 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 || + (share->state.key_map == (ULL(1) << share->base.keys) - ULL(1))) + return 0; + + /* All are disabled */ + if (!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; } |