getting postgresql"s client output from DBI

getting postgresql"s client output from DBI

am 15.08.2006 01:36:50 von genzhang

instead of getting back an array or hash for each row of my SELECT, I
want the results in one string, so that I can print it just like the
psql shell client:

e.g.

"
id | name | myid | tsid | comment
-----+--------+------+------+---------
(0 rows)
"

is there a way to do this?

-gene

Re: getting postgresql"s client output from DBI

am 15.08.2006 03:12:18 von Tyler

Gene Zhang wrote:
> instead of getting back an array or hash for each row of my SELECT, I
> want the results in one string, so that I can print it just like the
> psql shell client:
>
> e.g.
>
> "
> id | name | myid | tsid | comment
> -----+--------+------+------+---------
> (0 rows)
> "
>
> is there a way to do this?

Not really. You'd have to fetch the rows as an array and print them out
yourself. But remember you're using perl, the practical extraction and
report language; that won't be too hard. :) Perl's formatting system may be
of use; here's a result I found on google that describes that:

http://www.webreference.com/programming/perl/format/

Cheers,
Tyler

Re: getting postgresql"s client output from DBI

am 15.08.2006 07:23:50 von Alexander

DBI has a dump_results() method that may help you. Read the DBI docs for
details. Do not use this method for data transfers.

Alexander

On 15.08.2006 01:36, Gene Zhang wrote:

> instead of getting back an array or hash for each row of my SELECT, I
> want the results in one string, so that I can print it just like the
> psql shell client:
>
> e.g.
>
> "
> id | name | myid | tsid | comment
> -----+--------+------+------+---------
> (0 rows)
> "
>
> is there a way to do this?
>
> -gene
>


--
Alexander Foken
mailto:alexander@foken.de http://www.foken.de/alexander/