NAME
dbselect, dbselect_hdr - print selected values from a view
SYNOPSIS
int dbselect ( Dbptr db, Tbl *expressions, FILE *file, char* separator, int strip_blanks )
int dbselect_hdr ( Dbptr db, Tbl *expressions, FILE *file, char* separator, int strip_blanks )
DESCRIPTION
Given a database pointer to a table
dbselect prints a report to the specified
file.
There is a line for
each input record, containing the value of each of the
expressions for the corresponding row.
This is simply an easy way to print some selected values from a view.
The separator character defaults to a single-space if left NULL. Otherwise, this character
(for example, a tab or a comma) is inserted between each field during printing.
If strip_blanks is non-zero, whitespace characters are removed from fields before printing.
dbselect_hdr prints some simple headers corresponding to the expressions.
EXAMPLE
See dbprocess(3) for a more complete example.
list = strtbl( "sta", "chan", "strtime(time)", 0 ) ;
db = dblookup ( db, 0, "wfdisc", 0, 0 ) ;
dbselect ( db, list, stderr, " ", 0 ) ;
RETURN VALUES
Returns a negative value if any errors occurred during evaluation,
otherwise 0. When an expression can't be compiled, the expression is printed
instead of the value; if a requested field is not present in the view,
then "*no 'field'*" is printed instead of the value.
LIBRARY
$(DBLIBS)
SEE ALSO
pf(3)
dbprocess(3)
tbl(3)
AUTHOR
Daniel Quinlan