diff options
author | ram@mysql.r18.ru <> | 2002-10-07 17:49:03 +0500 |
---|---|---|
committer | ram@mysql.r18.ru <> | 2002-10-07 17:49:03 +0500 |
commit | 2e1a0c031a0ea3d7505690c6999d5d13e2a3dfe6 (patch) | |
tree | ebf4b60cc6d75288281e8c8da41994ba6bc7d89f /heap/hp_update.c | |
parent | 6976c7cf3c83e3c51770ebd7304b7f69a76a28f0 (diff) | |
download | mariadb-git-2e1a0c031a0ea3d7505690c6999d5d13e2a3dfe6.tar.gz |
auto_increment for heap tables
test case
Diffstat (limited to 'heap/hp_update.c')
-rw-r--r-- | heap/hp_update.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/heap/hp_update.c b/heap/hp_update.c index dd47e04ebc2..dd7374f506c 100644 --- a/heap/hp_update.c +++ b/heap/hp_update.c @@ -22,7 +22,8 @@ int heap_update(HP_INFO *info, const byte *old, const byte *heap_new) { HP_KEYDEF *keydef, *end, *p_lastinx; byte *pos; - HP_SHARE *share=info->s; + bool auto_key_changed= 0; + HP_SHARE *share= info->s; DBUG_ENTER("heap_update"); test_active(info); @@ -33,20 +34,23 @@ int heap_update(HP_INFO *info, const byte *old, const byte *heap_new) if (--(share->records) < share->blength >> 1) share->blength>>= 1; share->changed=1; - p_lastinx = share->keydef + info->lastinx; - for (keydef = share->keydef, end = keydef + share->keys; keydef < end; - keydef++) + p_lastinx= share->keydef + info->lastinx; + for (keydef= share->keydef, end= keydef + share->keys; keydef < end; keydef++) { if (hp_rec_key_cmp(keydef, old, heap_new)) { if ((*keydef->delete_key)(info, keydef, old, pos, keydef == p_lastinx) || (*keydef->write_key)(info, keydef, heap_new, pos)) goto err; + if (share->auto_key == (uint) (keydef - share->keydef + 1)) + auto_key_changed= 1; } } memcpy(pos,heap_new,(size_t) share->reclength); if (++(share->records) == share->blength) share->blength+= share->blength; + if (auto_key_changed) + heap_update_auto_increment(info, heap_new); DBUG_RETURN(0); err: |