#include "db.h" ; Dbptr dbjoin(Dbptr db1, Dbptr db2, Tbl **pattern1, Tbl **pattern2, int outer, Tbl **nojoin, char *name) Dbptr dbtheta(Dbptr db1, Dbptr db2, char *ex_str, int outer, char *name)
dbtheta creates a new view which is a theta join of the two database tables specified by db1 and db2. A new record is created in the new view whenever the expression specified by ex_str evaluates to true.
For some records in the first table, there may be no matching record in the second table. This would normally mean that there would be no corresponding record in the joined table. However, you may force an entry for every record in the first table by setting outer non-zero. If there is no matching record in the second table, then the null record is used.
The new view is named as specified by name; if this is zero, then a unique name is generated.
The join keys may be explicitly specified with pattern1 and pattern2. Alternatively, if pattern1 and pattern2 are pointers to zero, the inferred join keys are returned in pattern1 and pattern2. Finally, if pattern1 and pattern2 are zero, the join keys are inferred, but not returned.
Dbptr db1, db2 ; . . . db = dbjoin ( db, db2, 0, 0, 1, 0, 0 ) ; if ( db.table == dbINVALID ) die ( 1, "Join fails at table: %s\n", db2_table_name ) ;
freetbl(pattern1,0) ; freetbl(pattern2,0) ;
dbintro(3) dbsort(3) shellsort(3) quicksort(3)