diff options
author | unknown <ram@mysql.r18.ru> | 2002-10-07 17:49:03 +0500 |
---|---|---|
committer | unknown <ram@mysql.r18.ru> | 2002-10-07 17:49:03 +0500 |
commit | 9195963f56122b3ca7fa480607b8da9ae969a364 (patch) | |
tree | ebf4b60cc6d75288281e8c8da41994ba6bc7d89f /heap/hp_hash.c | |
parent | 9e5a4be4605cf71c5e3d6c07283c95fc4f29db70 (diff) | |
download | mariadb-git-9195963f56122b3ca7fa480607b8da9ae969a364.tar.gz |
auto_increment for heap tables
test case
heap/hp_create.c:
auto_increment for heap tables
heap/hp_hash.c:
auto_increment for heap tables
heap/hp_info.c:
auto_increment for heap tables
heap/hp_test1.c:
auto_increment for heap tables
heap/hp_test2.c:
auto_increment for heap tables
heap/hp_update.c:
auto_increment for heap tables
heap/hp_write.c:
auto_increment for heap tables
include/heap.h:
auto_increment for heap tables
mysql-test/r/create.result:
auto_increment for heap tables
mysql-test/t/create.test:
auto_increment for heap tables
sql/ha_heap.cc:
auto_increment for heap tables
sql/ha_heap.h:
auto_increment for heap tables
Diffstat (limited to 'heap/hp_hash.c')
-rw-r--r-- | heap/hp_hash.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/heap/hp_hash.c b/heap/hp_hash.c index 4f7dc956cba..0145e0d503c 100644 --- a/heap/hp_hash.c +++ b/heap/hp_hash.c @@ -537,3 +537,51 @@ my_bool hp_if_null_in_key(HP_KEYDEF *keydef, const byte *record) } return 0; } + +void heap_update_auto_increment(HP_INFO *info, const byte *record) +{ + ulonglong value; + HA_KEYSEG *keyseg= info->s->keydef[info->s->auto_key - 1].seg; + const uchar *key= (uchar*) record + keyseg->start; + + switch (info->s->auto_key_type) { + case HA_KEYTYPE_INT8: + case HA_KEYTYPE_BINARY: + value= (ulonglong) *(uchar*) key; + break; + case HA_KEYTYPE_SHORT_INT: + case HA_KEYTYPE_USHORT_INT: + value= (ulonglong) uint2korr(key); + break; + case HA_KEYTYPE_LONG_INT: + case HA_KEYTYPE_ULONG_INT: + value= (ulonglong) uint4korr(key); + break; + case HA_KEYTYPE_INT24: + case HA_KEYTYPE_UINT24: + value= (ulonglong) uint3korr(key); + break; + case HA_KEYTYPE_FLOAT: /* This shouldn't be used */ + { + float f_1; + float4get(f_1, key); + value= (ulonglong) f_1; + break; + } + case HA_KEYTYPE_DOUBLE: /* This shouldn't be used */ + { + double f_1; + float8get(f_1, key); + value= (ulonglong) f_1; + break; + } + case HA_KEYTYPE_LONGLONG: + case HA_KEYTYPE_ULONGLONG: + value= uint8korr(key); + break; + default: + value= 0; /* Error */ + break; + } + set_if_bigger(info->s->auto_increment, value); +} |