Re: How to access arrays from DBD::Pg? - Mailing list pgsql-general

From will trillich
Subject Re: How to access arrays from DBD::Pg?
Date
Msg-id 20010602040627.B10951@serensoft.com
Whole thread Raw
In response to How to access arrays from DBD::Pg?  (elwood@agouros.de (Konstantinos Agouros))
List pgsql-general
On Sun, May 27, 2001 at 09:39:12PM +0200, Konstantinos Agouros wrote:
> Hi,
>
> I have some data, that I would like to store in array-columns. How can I access
> this from DBD::Pg? Do I have to parse it manually?

that's how i do it. if there's another way i'd love to hear it.

    sub trim { substr(@_[0],1,length(@_[0])-2) };
    my $r = $sth->fetchrow_arrayref();
    # $r->{arraycolumn} resembles {"one","two","three"} --
    my @a = map{ &trim($_) } split /,/, &trim($r->{arraycolumn});
    # presuming no array element contains a comma...!

--
#95: We are waking up and linking to each other. We are watching. But
we are not waiting.  -- www.cluetrain.com

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

pgsql-general by date:

Previous
From: Gerald Gutierrez
Date:
Subject: Toggling logging output
Next
From: will trillich
Date:
Subject: Re: UPDATE keyword