summaryrefslogtreecommitdiff
path: root/myisammrg/myrg_rprev.c
diff options
context:
space:
mode:
authorunknown <monty@donna.mysql.com>2000-09-14 02:39:07 +0300
committerunknown <monty@donna.mysql.com>2000-09-14 02:39:07 +0300
commitd5964ba20ca4c00a443c185186def44bb90831b3 (patch)
tree47d3199e561726437875c3247556ac5797525366 /myisammrg/myrg_rprev.c
parent9e37676d7cd9ca30a05025b9fcc3424c4e4a1932 (diff)
downloadmariadb-git-d5964ba20ca4c00a443c185186def44bb90831b3.tar.gz
Fixes for MERGE TABLES and HEAP tables
Docs/manual.texi: Updated MERGE table stuff + more extra/perror.c: Added missing error messages include/myisammrg.h: Fixes for MERGE TABLE include/queues.h: Fixes for MERGE TABLE isam/isamlog.c: Fixed hard bug myisam/mi_log.c: cleanup myisam/mi_open.c: Fixed file name format in myisam log myisam/myisamlog.c: Bug fixes myisammrg/mymrgdef.h: Fixes for MERGE TABLE myisammrg/myrg_create.c: Fixes for MERGE TABLE myisammrg/myrg_open.c: Fixes for MERGE TABLE myisammrg/myrg_queue.c: Fixes for MERGE TABLE myisammrg/myrg_rfirst.c: Fixes for MERGE TABLE myisammrg/myrg_rkey.c: Fixes for MERGE TABLE myisammrg/myrg_rlast.c: Fixes for MERGE TABLE myisammrg/myrg_rnext.c: Fixes for MERGE TABLE myisammrg/myrg_rprev.c: Fixes for MERGE TABLE myisammrg/myrg_rrnd.c: Fixes for MERGE TABLE mysql.proj: update mysys/queues.c: Fixed bug when using reverse queues sql-bench/test-insert.sh: Separated some things to get better timings sql/ha_heap.cc: Fixed heap table bug sql/ha_heap.h: Fixed heap table bug sql/ha_myisam.h: Fixed wrong max_keys sql/ha_myisammrg.cc: Fixed MERGE TABLES sql/ha_myisammrg.h: Fixed MERGE TABLES sql/handler.h: Fix for MERGE TABLES and HEAP tables sql/lex.h: Fixed MERGE TABLES sql/mysql_priv.h: Cleanup of code sql/sql_acl.cc: Fixed that privilege tables are flushed at start sql/sql_lex.h: Fixed MERGE TABLES sql/sql_parse.cc: Fixed MERGE TABLES sql/sql_select.cc: Fixes for HEAP tables sql/sql_table.cc: Cleanup sql/sql_yacc.yy: Fixed MERGE TABLES
Diffstat (limited to 'myisammrg/myrg_rprev.c')
-rw-r--r--myisammrg/myrg_rprev.c47
1 files changed, 13 insertions, 34 deletions
diff --git a/myisammrg/myrg_rprev.c b/myisammrg/myrg_rprev.c
index 0523dc7f4e7..8d7a810696f 100644
--- a/myisammrg/myrg_rprev.c
+++ b/myisammrg/myrg_rprev.c
@@ -22,22 +22,21 @@
int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
{
- MYRG_TABLE *table;
- MI_INFO *mi;
- byte *key_buff;
- uint pack_key_length;
int err;
+ MI_INFO *mi;
- /* at first, do rnext for the table found before */
- err=mi_rprev(info->current_table->table,NULL,inx);
- if (err == HA_ERR_END_OF_FILE)
+ /* at first, do rprev for the table found before */
+ if ((err=mi_rprev(info->current_table->table,NULL,inx)))
{
- queue_remove(&(info->by_key),0);
- if (!info->by_key.elements)
- return HA_ERR_END_OF_FILE;
+ 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;
}
- else if (err)
- return err;
else
{
/* Found here, adding to queue */
@@ -46,28 +45,8 @@ int myrg_rprev(MYRG_INFO *info, byte *buf, int inx)
}
/* next, let's finish myrg_rkey's initial scan */
- table=info->last_used_table+1;
- if (table < info->end_table)
- {
- mi=info->last_used_table->table;
- key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length;
- pack_key_length=mi->last_rkey_length;
- for (; table < info->end_table ; table++)
- {
- mi=table->table;
- err=_mi_rkey(mi,NULL,inx,key_buff,pack_key_length,
- HA_READ_KEY_OR_PREV,FALSE);
- info->last_used_table=table;
-
- if (err == HA_ERR_KEY_NOT_FOUND)
- continue;
- if (err)
- return err;
-
- /* Found here, adding to queue */
- queue_insert(&(info->by_key),(byte *)table);
- }
- }
+ if ((err=_myrg_finish_scan(info, inx, HA_READ_KEY_OR_PREV)))
+ return err;
/* now, mymerge's read_prev is as simple as one queue_top */
mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table;