[CDBI] Storing integer arrays

Fred Moyer fred at redhotpenguin.com
Tue Mar 20 16:44:25 GMT 2012


On Tue, Mar 20, 2012 at 2:25 AM, Bill Moseley <moseley at hank.org> wrote:
> I have a column in Postgress:
>
>    list_of_integers    integer[]  NOT 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:  die "Cannot call execute with a reference
> ($_)\n"
>
> --
> Bill Moseley
> moseley at hank.org
>
> _______________________________________________
> ClassDBI mailing list
> ClassDBI at lists.digitalcraftsmen.net
> http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi
>



More information about the ClassDBI mailing list