diff options
author | Sergei Golubchik <sergii@pisem.net> | 2010-11-25 18:17:28 +0100 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2010-11-25 18:17:28 +0100 |
commit | 65ca700def99289cc31a7040537f5aa6e12bf485 (patch) | |
tree | 97b3a07299b626c519da0e80c122b5b79b933914 /storage/myisam/mi_key.c | |
parent | 2ab57de38d13d927ddff2d51aed4af34e13998f5 (diff) | |
parent | 6e5bcca7935d3c62f84bb640e5357664a210ee12 (diff) | |
download | mariadb-git-65ca700def99289cc31a7040537f5aa6e12bf485.tar.gz |
merge.
checkpoint.
does not compile.
Diffstat (limited to 'storage/myisam/mi_key.c')
-rw-r--r-- | storage/myisam/mi_key.c | 57 |
1 files changed, 46 insertions, 11 deletions
diff --git a/storage/myisam/mi_key.c b/storage/myisam/mi_key.c index 75038fce070..f64a602e2be 100644 --- a/storage/myisam/mi_key.c +++ b/storage/myisam/mi_key.c @@ -31,7 +31,8 @@ set_if_smaller(char_length,length); \ } while(0) -static int _mi_put_key_in_record(MI_INFO *info,uint keynr,uchar *record); +static int _mi_put_key_in_record(MI_INFO *info,uint keynr, + my_bool unpack_blobs, uchar *record); /* Make a intern key from a record @@ -311,6 +312,9 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, _mi_put_key_in_record() info MyISAM handler keynr Key number that was used + unpack_blobs TRUE <=> Unpack blob columns + FALSE <=> Skip them. This is used by index condition + pushdown check function record Store key here Last read key is in info->lastkey @@ -324,7 +328,7 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old, */ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, - uchar *record) + my_bool unpack_blobs, uchar *record) { reg2 uchar *key; uchar *pos,*key_end; @@ -417,16 +421,19 @@ static int _mi_put_key_in_record(register MI_INFO *info, uint keynr, if (length > keyseg->length || key+length > key_end) goto err; #endif - memcpy(record+keyseg->start+keyseg->bit_start, - (char*) &blob_ptr,sizeof(char*)); - memcpy(blob_ptr,key,length); - blob_ptr+=length; + if (unpack_blobs) + { + memcpy(record+keyseg->start+keyseg->bit_start, + (char*) &blob_ptr,sizeof(char*)); + memcpy(blob_ptr,key,length); + blob_ptr+=length; - /* The above changed info->lastkey2. Inform mi_rnext_same(). */ - info->update&= ~HA_STATE_RNEXT_SAME; + /* The above changed info->lastkey2. Inform mi_rnext_same(). */ + info->update&= ~HA_STATE_RNEXT_SAME; - _my_store_blob_length(record+keyseg->start, - (uint) keyseg->bit_start,length); + _mi_store_blob_length(record+keyseg->start, + (uint) keyseg->bit_start,length); + } key+=length; } else if (keyseg->flag & HA_SWAP_KEY) @@ -470,7 +477,7 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf) { if (info->lastinx >= 0) { /* Read only key */ - if (_mi_put_key_in_record(info,(uint) info->lastinx,buf)) + if (_mi_put_key_in_record(info,(uint) info->lastinx, TRUE, buf)) { mi_print_error(info->s, HA_ERR_CRASHED); my_errno=HA_ERR_CRASHED; @@ -486,6 +493,34 @@ int _mi_read_key_record(MI_INFO *info, my_off_t filepos, uchar *buf) /* + Save current key tuple to record and call index condition check function + + SYNOPSIS + mi_check_index_cond() + info MyISAM handler + keynr Index we're running a scan on + record Record buffer to use (it is assumed that index check function + will look for column values there) + + RETURN + ICP_ERROR Error + ICP_NO_MATCH Index condition is not satisfied, continue scanning + ICP_MATCH Index condition is satisfied + ICP_OUT_OF_RANGE Index condition is not satisfied, end the scan. +*/ + +int mi_check_index_cond(register MI_INFO *info, uint keynr, uchar *record) +{ + if (_mi_put_key_in_record(info, keynr, FALSE, record)) + { + mi_print_error(info->s, HA_ERR_CRASHED); + my_errno=HA_ERR_CRASHED; + return ICP_ERROR; + } + return info->index_cond_func(info->index_cond_func_arg); +} + +/* Retrieve auto_increment info SYNOPSIS |