NAME
db2ptolemy - convert a database view to a Ptolemy II expression
SYNOPSIS
#include "dbptolemy.h"
int db2ptolemy(Dbptr db,
Tbl *fields, Tbl *expressions, void **ptexp,
int flags)
SUPPORT
Contributed code: NO BRTT support.
THIS PIECE OF SOFTWARE WAS CONTRIBUTED BY THE ANTELOPE USER COMMUNITY. BRTT DISCLAIMS ALL OWNERSHIP, LIABILITY, AND SUPPORT FOR THIS PIECE OF SOFTWARE.
FOR HELP WITH THIS PIECE OF SOFTWARE, PLEASE CONTACT THE CONTRIBUTING AUTHOR.
DESCRIPTION
db2ptolemy returns a Ptolemy II expression which evaluates to an array
of records, with one record for each row of the view,
returning 0 for success and negative values on error.
By default (i.e. with
flags set to 0) the result is
returned as a string in the
ptexp pointer. This string
is freshly allocated on each call. Previous contents of the pointer are
ignored. Freeing the returned string is the responsibility of the user. If the
flags argument is set to DBXML_BNS, the returned argument
ptexp is the address of a pointer to a Buffered Network Stream
object, which allows the result to be read out in pieces. For
further detail see
bns(3). Once again, freeing the returned Bns structure is
the responsibility of the user.
RETURN VALUES
db2ptolemy returns 0 upon success, -1 upon error. Any errors encountered
are registered with the
elog(3) facility.
LIBRARY
-ldbptolemy $(DBLIBS)
SEE ALSO
db2xml(3), dbselect(3)
BUGS AND CAVEATS
The
ptexp pointer is a void pointer to support multiple return
types.
This program could be reimplemented with a combination of db2xml and an
XSLT stylesheet. Or a more general program could be implemented which
would transform a database view into a textual representation given a recipe
contained in a parameter file, using
morph(3) (for instance) and sprintf to
perform the transformation.
AUTHOR
Tobin Fricke, University of California
This program is a rather trivial modification of Kent Lindquist's db2xml
Antelope User Group Contributed Software