• Antelope Release 5.10 Linux CentOS release 7.6.1810 (Core) 3.10.0 2020-05-12

 

NAME

dbuntangle, dbfree_untangle - return lists of constituent records of views

SYNOPSIS

int dbuntangle ( Dbptr db, Arr **table_records );

void dbfree_untangle ( Arr *table_records ) ;

DESCRIPTION

It's often convenient (when finding a subset of a database) to find all the rows of all the tables which make up a view. This routine performs that operation.

The input is a database pointer, and the address of an array, table_records; this address should be initialized to zero for the first call. The returned table_records is an array (see arr(3)) indexed by table name of sorted lists (stbl(3)) of record numbers.

dbuntangle may be called repeatedly on different views, and will accumulate lists of all the referenced records.

The input db pointer may either be a pointer to a table, or may specify a range of records in the dbgroup sense, where the range of records is from record #db.record up to (but not including) record #db.field.

RETURN VALUES

Returns zero if no errors occur, dbINVALID if there's something wrong with the input database pointer. The table_records array is always initialized, and should be freed with a call to dbfree_untangle.

LIBRARY

$(DBLIBS)

SEE ALSO

arr(3)
stbl(3)
dbunjoin(1)
dbunjoin(3)

BUGS AND CAVEATS

When run on a grouped view, the result will be a list of all the records (0 to nrecords-1) in the grouped view, not a list of all the records referenced by the groups.

AUTHOR

Daniel Quinlan
Printer icon