[prev] 4 [next]

Storage Management (cont)

Consider the query:

select student, course from Enrolments;

How the query executor deals with the database ...

DB db = openDatabase("myDB");
Reln r = openRel(db,"Enrolments");
Scan s = startScan(r);
Tuple t;  Results res = NULL;
while ((t = nextTuple(s)) != NULL)
{
    int stuid = getField(t,"student");
    char *course = getField(t,"course");
    res = addTuple(res, mkTuple(stuid,course));
}