summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
authoringo@mysql.com <>2004-03-18 16:47:16 +0100
committeringo@mysql.com <>2004-03-18 16:47:16 +0100
commit7216c3b272845a08d17caa94b2d96935e5a0c923 (patch)
tree2c2200028f63cb26455388c2d9a6aed239fa05f2 /myisam
parent1e0ccbd9b07f62051f8f5910c500932f0caae147 (diff)
downloadmariadb-git-7216c3b272845a08d17caa94b2d96935e5a0c923.tar.gz
WL#1648 - Start/Stop Inserting Duplicates Into a Table
Diffstat (limited to 'myisam')
-rw-r--r--myisam/mi_extra.c31
1 files changed, 31 insertions, 0 deletions
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 <sys/mman.h>
#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;
+ }
+ }
+}
+