Re: How to access arrays from DBD::Pg?

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to access arrays from DBD::Pg?
Date: 2001-06-02 09:06:27
Message-ID: 20010602040627.B10951@serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message will trillich 2001-06-02 09:11:12 Re: UPDATE keyword
Previous Message Gerald Gutierrez 2001-06-02 03:25:03 Toggling logging output