[prev] 17 [next]

Storage Manager Interface (cont)

And nextTuple() might be implemented as:

Tuple nextTuple(Scan s) {
   if (noMoreTuplesIn(s->page,s->tupno))
      if (noMorePagesIn(s->file))
         return NULL;
      s->page = getPage(s->file,s->pageno);
      s->pageno++;
      s->tupno = 0;
   }
   Tuple t = getTuple(s->page,s->tupno);
   s->tupno++;
   return t;
}