On Tue, Jan 08, 2002 at 10:12:37AM -0600, Nguyen, David M wrote:
> Hi all,
>
> I use DBI and dump_results() to allow users access database and download
> data to view in CSV format. My question is how do I setup dump_results() to
> point the a file to .CSV extension?
The docs say:
=item C<dump_results>
$rows = $sth->dump_results($maxlen, $lsep, $fsep, $fh);
Fetches all the rows from C<$sth>, calls C<DBI::neat_list> for each row, and
prints the results to C<$fh> (defaults to C<STDOUT>) separated by C<$lsep>
(default C<"\n">). C<$fsep> defaults to C<", "> and C<$maxlen> defaults to 35.
This method is designed as a handy utility for prototyping and
testing queries. Since it uses L</neat_list> to
format and edit the string for reading by humans, it is not recomended
for data transfer applications.
So do
open(FH, ">foo.csv") or die "... $!";
$sth->dump_results($maxlen, $lsep, $fsep, \*FH);
Tim.