Struct JoinSpec
#include <join.h>
JoinSpec is the structure that specifies the relations to join and which is the join attribute.
struct JoinSpec { char relName[MAX_REL_NAME_LENGTH]; HeapFile *file; int numOfAttr; int recLen; int joinAttr; int offset; };
#define MAX_REL_NAME_LENGTH 6
This structure is not part of Minibase and is designed for the purpose of this assignment only.
relName specifies the name of the relation/HeapFile to be joined. file is a pointer to a HeapFile object with name relName. numOfAttr is the number of attrbutes in the relation and recLen is the size of the record in bytes. joinAttr specifies the column/field to be joinned. Setting joinAttr to 0 means that we will join the first column of this relation with a column from another relation. offset is the offset of the joinAttr from the beginning of the record.
One way to refer to a join attribute's value:
char *rRecPtr;
int *rAdd, r;
rAdd = (int *)(rRecPtr + specOfR.offset);
r = *rAdd;
Not all of these fields are useful. Some are provided to help you debug.