Re: [CDBI] Storing integer arrays

Fred Moyer <fred-3BbYVzP+qW3iLJGoLe449gC/[email protected]> Tue, 20 Mar 2012 09:44:25 -0700
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <CAHrynWCLAvpMzNS0_RD1wiDayVTPR-tYRf4QwZPu4UY5_2mc_w@mail.gmail.com>
On Tue, Mar 20, 2012 at 2:25 AM, Bill Moseley <[email protected]> wrote:
> I have a column in Postgress:
>
> =A0=A0 list_of_integers =A0 =A0integer[] =A0NOT NUL,
>
> $foo->list_of_integers( \@ids );
> $foo->update;
>
> Is there a way to store this in Class::DBI?

I ran into this exact same problem a couple months ago, and solved it
by adding serialization and deserialization code for the arrays in the
model accessor.  Mostly a '{' . join(',', @ints) . '}' type operation.


>
> DBIx::ContextualFetch complains: =A0die "Cannot call execute with a refer=
ence
> ($_)\n"
>
> --
> Bill Moseley
> [email protected]
>
> _______________________________________________
> ClassDBI mailing list
> ClassDBI-Ra3b/[email protected]
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>