-/* $Id: isamb.c,v 1.73 2005-03-08 14:02:15 adam Exp $
+/* $Id: isamb.c,v 1.74 2005-03-18 12:05:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
}
}
}
- maxp = dst_buf + b->file[b->no_cat-1].head.block_max + quater;
+
/* this loop runs when we are "appending" to a leaf page. That is
either it's empty (new) or all file items have been read in
previous loop */
+
+ /* determine maximum ptr for tail */
+ if (half2)
+ {
+ /* split already. No more splits - fill up to one full (Extra) block */
+ maxp = half2 + b->file[b->no_cat-1].head.block_max;
+ }
+ else
+ {
+ /* no split. Fill up to 1+1/4 block */
+ maxp = dst_buf + b->file[b->no_cat-1].head.block_max + quater;
+ }
while (lookahead_item)
{
char *dst_item;
const char *src = lookahead_item;
char *dst_0 = dst;
- /* compare lookahead with max item */
+ /* if we have a lookahead item, we stop if we exceed the value of it */
if (max_item &&
(*b->method->compare_item)(max_item, lookahead_item) <= 0)
{
-/* $Id: tstisamb.c,v 1.17 2005-01-16 23:38:34 adam Exp $
+/* $Id: tstisamb.c,v 1.18 2005-03-18 12:05:11 adam Exp $
Copyright (C) 1995-2005
Index Data ApS
isamb_unlink(isb, isamc_p);
}
+void tst_append(ISAMB isb, int n)
+{
+ ISAMC_I isamc_i;
+ ISAMB_P isamb_p = 0;
+ struct read_info ri;
+ int i;
+ int chunk = 10;
+
+ for (i = 0; i < n; i += chunk)
+ {
+ /* insert a number of entries */
+ ri.no = 0;
+ ri.step = 1;
+ ri.max = i + chunk;
+ ri.insertMode = 1;
+
+ isamc_i.clientData = &ri;
+ isamc_i.read_item = code_read;
+
+ isamb_p = isamb_merge (isb, isamb_p , &isamc_i);
+ }
+}
+
int main(int argc, char **argv)
{
BFiles bfs;
tst_insert(isb, 100);
tst_insert(isb, 500);
tst_insert(isb, 10000);
+
tst_forward(isb, 10000);
+
+ tst_append(isb, 10000);
/* close isam handle */
isamb_close(isb);