summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authorunknown <andrey@example.com>2006-12-02 00:30:10 +0100
committerunknown <andrey@example.com>2006-12-02 00:30:10 +0100
commit65da49e6a8aa50a30d45257c1035b43f7b98c6fb (patch)
treea9852e405c93538c9af1c4f736e79f5d172d12da /myisam
parent48595c284dd5bebbc513f611811f8d2cb4ee658e (diff)
parentc429ca8498cbd8f6402403c5f8396c49f60c1d70 (diff)
downloadmariadb-git-65da49e6a8aa50a30d45257c1035b43f7b98c6fb.tar.gz
Merge ahristov@bk-internal.mysql.com:/home/bk/mysql-5.0-maint
into example.com:/work/bug24395-v2/my50 myisam/mi_open.c: Auto merged sql/sql_table.cc: Auto merged
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_open.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/myisam/mi_open.c b/myisam/mi_open.c
index bf20eb3f270..ab004ef8b5f 100644
--- a/myisam/mi_open.c
+++ b/myisam/mi_open.c
@@ -1264,13 +1264,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;
}