diff options
author | unknown <monty@work.mysql.com> | 2001-05-20 12:38:19 +0200 |
---|---|---|
committer | unknown <monty@work.mysql.com> | 2001-05-20 12:38:19 +0200 |
commit | 17fbf163c0d3a9ef769b6237df9c4033a0c0439f (patch) | |
tree | 65d07974d1958323c45101a68d5cea7a0f7f319a /myisammrg | |
parent | 83e3058c3e6ebd1ec2ffa03854eaf1388bb4c484 (diff) | |
parent | 112ad6720539a0bfc6dec31db64b619298a52deb (diff) | |
download | mariadb-git-17fbf163c0d3a9ef769b6237df9c4033a0c0439f.tar.gz |
merge
BitKeeper/etc/ignore:
auto-union
BitKeeper/etc/logging_ok:
auto-union
client/mysql.cc:
Auto merged
myisam/mi_search.c:
Auto merged
sql/sql_select.cc:
Auto merged
Diffstat (limited to 'myisammrg')
-rw-r--r-- | myisammrg/mymrgdef.h | 1 | ||||
-rw-r--r-- | myisammrg/myrg_rkey.c | 11 | ||||
-rw-r--r-- | myisammrg/myrg_rnext.c | 45 | ||||
-rw-r--r-- | myisammrg/myrg_rprev.c | 13 | ||||
-rw-r--r-- | myisammrg/myrg_rrnd.c | 2 |
5 files changed, 11 insertions, 61 deletions
diff --git a/myisammrg/mymrgdef.h b/myisammrg/mymrgdef.h index 564900614e2..aae1d07cd64 100644 --- a/myisammrg/mymrgdef.h +++ b/myisammrg/mymrgdef.h @@ -29,4 +29,3 @@ extern pthread_mutex_t THR_LOCK_open; #endif int _myrg_init_queue(MYRG_INFO *info,int inx,enum ha_rkey_function search_flag); -int _myrg_finish_scan(MYRG_INFO *info, int inx, enum ha_rkey_function type); diff --git a/myisammrg/myrg_rkey.c b/myisammrg/myrg_rkey.c index 6560380622a..cd2c73c8ec2 100644 --- a/myisammrg/myrg_rkey.c +++ b/myisammrg/myrg_rkey.c @@ -44,7 +44,6 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key, MYRG_TABLE *table; MI_INFO *mi; int err; - byte *buf=((search_flag == HA_READ_KEY_EXACT) ? record: 0); LINT_INIT(key_buff); LINT_INIT(pack_key_length); @@ -57,14 +56,14 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key, if (table == info->open_tables) { - err=mi_rkey(mi,buf,inx,key,key_len,search_flag); + err=mi_rkey(mi,0,inx,key,key_len,search_flag); key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length; pack_key_length=mi->last_rkey_length; } else { mi->use_packed_key=1; - err=mi_rkey(mi,buf,inx,key_buff,pack_key_length,search_flag); + err=mi_rkey(mi,0,inx,key_buff,pack_key_length,search_flag); mi->use_packed_key=0; } info->last_used_table=table+1; @@ -78,12 +77,6 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key, /* adding to queue */ queue_insert(&(info->by_key),(byte *)table); - /* if looking for KEY_EXACT, return first matched now */ - if (buf) - { - info->current_table=table; - return 0; - } } if (!info->by_key.elements) diff --git a/myisammrg/myrg_rnext.c b/myisammrg/myrg_rnext.c index d5bc9c54339..5a3fbdfb299 100644 --- a/myisammrg/myrg_rnext.c +++ b/myisammrg/myrg_rnext.c @@ -29,7 +29,11 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx) if ((err=mi_rnext(info->current_table->table,NULL,inx))) { if (err == HA_ERR_END_OF_FILE) + { queue_remove(&(info->by_key),0); + if (!info->by_key.elements) + return HA_ERR_END_OF_FILE; + } else return err; } @@ -40,48 +44,7 @@ int myrg_rnext(MYRG_INFO *info, byte *buf, int inx) queue_replaced(&(info->by_key)); } - /* next, let's finish myrg_rkey's initial scan */ - if ((err=_myrg_finish_scan(info, inx, HA_READ_KEY_OR_NEXT))) - return err; - - if (!info->by_key.elements) - return HA_ERR_END_OF_FILE; - /* now, mymerge's read_next is as simple as one queue_top */ mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; return mi_rrnd(mi,buf,mi->lastpos); } - - -/* let's finish myrg_rkey's initial scan */ - -int _myrg_finish_scan(MYRG_INFO *info, int inx, enum ha_rkey_function type) -{ - int err; - MYRG_TABLE *table=info->last_used_table; - if (table < info->end_table) - { - MI_INFO *mi= table[-1].table; - byte *key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length; - uint pack_key_length= mi->last_rkey_length; - - for (; table < info->end_table ; table++) - { - mi=table->table; - mi->use_packed_key=1; - err=mi_rkey(mi,NULL,inx,key_buff,pack_key_length,type); - mi->use_packed_key=0; - if (err) - { - if (err == HA_ERR_KEY_NOT_FOUND) /* If end of file */ - continue; - return err; - } - /* Found here, adding to queue */ - queue_insert(&(info->by_key),(byte *) table); - } - /* All tables are now used */ - info->last_used_table=table; - } - return 0; -} diff --git a/myisammrg/myrg_rprev.c b/myisammrg/myrg_rprev.c index c63c73b4200..d8089e80498 100644 --- a/myisammrg/myrg_rprev.c +++ b/myisammrg/myrg_rprev.c @@ -29,7 +29,11 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx) if ((err=mi_rprev(info->current_table->table,NULL,inx))) { if (err == HA_ERR_END_OF_FILE) + { queue_remove(&(info->by_key),0); + if (!info->by_key.elements) + return HA_ERR_END_OF_FILE; + } else return err; } @@ -40,16 +44,7 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx) queue_replaced(&(info->by_key)); } - /* next, let's finish myrg_rkey's initial scan */ - if ((err=_myrg_finish_scan(info, inx, HA_READ_KEY_OR_PREV))) - return err; - - if (!info->by_key.elements) - return HA_ERR_END_OF_FILE; - /* now, mymerge's read_prev is as simple as one queue_top */ mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; return mi_rrnd(mi,buf,mi->lastpos); } - - diff --git a/myisammrg/myrg_rrnd.c b/myisammrg/myrg_rrnd.c index 46bd3850bb5..de731e58d5b 100644 --- a/myisammrg/myrg_rrnd.c +++ b/myisammrg/myrg_rrnd.c @@ -88,7 +88,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos) isam_info->update&= HA_STATE_CHANGED; DBUG_RETURN((*isam_info->s->read_rnd) (isam_info, (byte*) buf, - (ha_rows) (filepos - info->current_table->file_offset), + (my_off_t) (filepos - info->current_table->file_offset), 0)); } |