From 5b540f0555f556009fd64e4bb48147435785cc25 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 18 Mar 2004 16:47:16 +0100 Subject: WL#1648 - Start/Stop Inserting Duplicates Into a Table --- myisam/mi_extra.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'myisam/mi_extra.c') diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c index ce072d7d57e..4b011ca424f 100644 --- a/myisam/mi_extra.c +++ b/myisam/mi_extra.c @@ -19,6 +19,9 @@ #include #endif +static void mi_extra_keyflag(MI_INFO *info, enum ha_extra_function function); + + /* Set options and buffers to optimize table handling @@ -355,6 +358,10 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) case HA_EXTRA_PRELOAD_BUFFER_SIZE: info->preload_buff_size= *((ulong *) extra_arg); break; + case HA_EXTRA_CHANGE_KEY_TO_UNIQUE: + case HA_EXTRA_CHANGE_KEY_TO_DUP: + mi_extra_keyflag(info, function); + break; case HA_EXTRA_KEY_CACHE: case HA_EXTRA_NO_KEY_CACHE: default: @@ -367,3 +374,27 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) } DBUG_RETURN(error); } /* mi_extra */ + + +/* + Start/Stop Inserting Duplicates Into a Table, WL#1648. + */ +static void mi_extra_keyflag(MI_INFO *info, enum ha_extra_function function) +{ + uint idx; + + for (idx= 0; idx< info->s->base.keys; idx++) + { + switch (function) { + case HA_EXTRA_CHANGE_KEY_TO_UNIQUE: + info->s->keyinfo[idx].flag|= HA_NOSAME; + break; + case HA_EXTRA_CHANGE_KEY_TO_DUP: + info->s->keyinfo[idx].flag&= ~(HA_NOSAME); + break; + default: + break; + } + } +} + -- cgit v1.2.1