NAME
dbsubset - create a subset view
SYNOPSIS
Dbptr dbsubset ( Dbptr db, char *s, char *name );
DESCRIPTION
Dbsubset creates a new view of a database table, containing
only records which satisfy the expression represented by s.
The new view is named after the name parameter; if it is zero,
a unique name is generated.
EXAMPLE
The following finds only the Z channels in a sitechan table.
Tbl *fields ;
Dbptr db ;
.
.
.
db = dblookup ( db, 0, "sitechan", 0, 0 ) ;
db = dbsubset ( db, "chan =~ /.*Z/", 0 ) ;
RETURN VALUES
The return value is a database pointer to the new view.
LIBRARY
$(DBLIBS)
SEE ALSO
dbintro(3)
dbex_compile(3)
Contains a variety of examples of expressions
dbmatches(3)
dbgroup(3)
dbsort(3)
BUGS AND CAVEATS
Many people seize on dbsubset as a method for working through a
large database, one subset after another. This is extremely inefficient,
because every dbsubset tests
every record of the table being subsetted. In addition, each subset
takes more memory, some of which can be reclaimed with dbfree, but
is likely to lead to fragmentation.
A better approach is to use dbmatches or dbsort and dbgroup
to work your way through a large table.
AUTHOR
Daniel Quinlan