MAN page from Old RedHat 5.X DBI-1.08-1.i386.rpm
lib::DBI::Format
Section: User Contributed Perl Documentation (3)
Updated: perl 5.005, patch 03
Index NAME
DBI::Format - A package for displaying result tables
SYNOPSIS
# create a new result object $r = DBI::Format->new('var1' => 'val1', ...); # Prepare it for output by creating a header $r->header($sth, $fh);
# In a loop, display rows while ($ref = $sth->fetchrow_arrayref()) { $r->row($ref); } # Finally create a trailer $r->trailer();
DESCRIPTION
THIS PACKAGE IS STILL VERY EXPERIMENTAL. THINGS WILL CHANGE.
This package is used for making the output of DBI::Shell configurable.The idea is to derive a subclass for any kind of output table you mightcreate. Examples are
- *
- a very simple output format as offered by DBI::neat_list().the section on AVAILABLE SUBCLASSES.
- *
- a box format, as offered by the Data::ShowTable module.
- *
- HTML format, as used in CGI binaries
- *
- postscript, to be piped into lpr or something similar
In the future the package should also support interactive methods, forexample tab completion.
These are the available methods:
- new(@attr)
- new(\%attr)
- (Class method) This is the constructor. You'd rather call a subclassconstructor. The construcor is accepting either a list of key/valuepairs or a hash ref.
- header($sth, $fh)
- (Instance method) This is called when a new result table should becreated to display the results of the statement handle $sth. The(optional) argument $fh is an IO handle (or any object supportinga print method), usually you use an IO::Wrap object for STDIN.
The method will query the $sth for its NAME, NUM_OF_FIELDS,TYPE, SCALE and PRECISION attributes and typically print aheader. In general you should not assume that $sth is indeed a DBIstatement handle and better treat it as a hash ref with the aboveattributes.
- row($ref)
- (Instance method) Prints the contents of the array ref $ref. Usuallyyou obtain this array ref by calling $sth->fetchrow_arrayref().
- trailer
- (Instance method) Once you have passed all result rows to the resultpackage, you should call the trailer method. This method can, forexample print the number of result rows.
AVAILABLE SUBCLASSES
First of all, you can use the DBI::Format package itself: It'snot an abstract base class, but a very simple default using
DBI::neat_list().
Ascii boxes
This subclass is using the
Box mode of the
Data::ShowTable moduleinternally. the
Data::ShowTable(3) manpage.
AUTHOR AND COPYRIGHT
This module is Copyright (c) 1997, 1998
Jochen Wiedmann Am Eisteich 9 72555 Metzingen Germany
Email: joeAATTispsoft.de Phone: +49 7123 14887
The DBD::Proxy module is free software; you can redistribute it and/ormodify it under the same terms as Perl itself.
SEE ALSO
the
DBI::Shell(3) manpage, the
DBI(3) manpage, the
dbish(1) manpage
Index
- NAME
- SYNOPSIS
- DESCRIPTION
- AVAILABLE SUBCLASSES
- Ascii boxes
- AUTHOR AND COPYRIGHT
- SEE ALSO
This document was created byman2html,using the manual pages.