X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=rset%2Frsm_or.c;h=69d0ca5225f926fdd99c9a2a21fbde591eb0e3a8;hb=067b55382bc9916b3f7dcd473512c703d4de4a5d;hp=e8b004733acc4f40a7c5c3efa380170272cbe5fd;hpb=5d20c4e9f612a012313370c82dc8481b9f19d5df;p=idzebra-moved-to-github.git diff --git a/rset/rsm_or.c b/rset/rsm_or.c index e8b0047..69d0ca5 100644 --- a/rset/rsm_or.c +++ b/rset/rsm_or.c @@ -4,14 +4,21 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: rsm_or.c,v $ - * Revision 1.1 1996-12-20 11:07:21 adam + * Revision 1.3 1997-09-09 13:38:16 adam + * Partial port to WIN95/NT. + * + * Revision 1.2 1996/12/23 15:30:49 adam + * Work on truncation. + * + * Revision 1.1 1996/12/20 11:07:21 adam * Implemented Multi-or result set. * */ +#include #include #include -#include +#include #include #include @@ -53,6 +60,7 @@ struct rset_mor_info { ISAM_P *isam_positions; int no_isam_positions; + int no_save_positions; struct rset_mor_rfd *rfd_list; }; @@ -70,6 +78,8 @@ struct trunc_info { struct rset_mor_rfd { int flag; + int position; + int position_max; ISAMC_PP *ispt; struct rset_mor_rfd *next; struct rset_mor_info *info; @@ -171,6 +181,8 @@ static void *r_create (const struct rset_control *sel, void *parms, info->key_size = r_parms->key_size; assert (info->key_size > 1); info->cmp = r_parms->cmp; + + info->no_save_positions = r_parms->no_save_positions; info->isc = r_parms->isc; info->no_isam_positions = r_parms->no_isam_positions; @@ -215,6 +227,7 @@ static RSFD r_open (RSET ct, int flag) rfd->ispt[i] = NULL; } } + rfd->position = info->no_save_positions; r_rewind (rfd); return rfd; } @@ -268,13 +281,32 @@ static int r_read (RSFD rfd, void *buf) if (!ti->heapnum) return 0; memcpy (buf, ti->heap[ti->ptr[1]], ti->keysize); - heap_delete (ti); - if (isc_pp_read (((struct rset_mor_rfd *) rfd)->ispt[n], ti->tmpbuf)) - heap_insert (ti, ti->tmpbuf, n); - else + if (((struct rset_mor_rfd *) rfd)->position) + { + if (isc_pp_read (((struct rset_mor_rfd *) rfd)->ispt[n], ti->tmpbuf)) + { + heap_delete (ti); + if ((*ti->cmp)(ti->tmpbuf, ti->heap[ti->ptr[1]]) > 1) + ((struct rset_mor_rfd *) rfd)->position--; + heap_insert (ti, ti->tmpbuf, n); + } + else + heap_delete (ti); + return 1; + } + while (1) { - isc_pp_close (((struct rset_mor_rfd *) rfd)->ispt[n]); - ((struct rset_mor_rfd*) rfd)->ispt[n] = NULL; + if (!isc_pp_read (((struct rset_mor_rfd *) rfd)->ispt[n], ti->tmpbuf)) + { + heap_delete (ti); + break; + } + if ((*ti->cmp)(ti->tmpbuf, ti->heap[ti->ptr[1]]) > 1) + { + heap_delete (ti); + heap_insert (ti, ti->tmpbuf, n); + break; + } } return 1; }