Re: [CDBI] Storing integer arrays

Bill Moseley <[email protected]> Tue, 20 Mar 2012 22:48:57 +0700
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <CAKhN_m5Jdx95DCwjm9XE0XA--yE_X-T=p86o6iw4KfQNLdXc9Q@mail.gmail.com>
--===============0979361642==
Content-Type: multipart/alternative; boundary=e89a8fb20170b3f7fc04bbae9e95

--e89a8fb20170b3f7fc04bbae9e95
Content-Type: text/plain; charset=ISO-8859-1

On Tue, Mar 20, 2012 at 7:19 PM, paul trader <fliptop-9C0dvrXKiPZWk0Htik3J/[email protected]> wrote:

> On Tue, 20 Mar 2012 at 16:25, Bill Moseley opined:
>
> BM:I have a column in Postgress:
> BM:
> BM:   list_of_integers    integer[]  NOT NUL,
> BM:
> BM:$foo->list_of_integers( \@ids );
> BM:$foo->update;
> BM:
> BM:Is there a way to store this in Class::DBI?
>
> hi bill - what version of pgsql are you using?
>

2.18.1

Arrays work fine with DBD::Pg.  I use them with DBIx::Class.  But with
Class::DBI DBIx::ContextualFetch has:

sub _disallow_references {
	my $self = shift;
	foreach (@_) {
		next unless ref $_;
		next if overload::Method($_, q{""});
		next if overload::Method($_, q{0+});
		die "Cannot call execute with a reference ($_)\n";
	}
}


which is called before calling $sth->execute to check bind parameters.

I was curious if I was just missing something and there was a easy way to
use integer[] with CDBI.

Thanks,

-- 
Bill Moseley
[email protected]

--e89a8fb20170b3f7fc04bbae9e95
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

<br><br><div class=3D"gmail_quote">On Tue, Mar 20, 2012 at 7:19 PM, paul tr=
ader <span dir=3D"ltr">&lt;<a href=3D"mailto:fliptop-9C0dvrXKiPZWk0Htik3J/[email protected]">fliptop@=
igolinux.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quote" sty=
le=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

On Tue, 20 Mar 2012 at 16:25, Bill Moseley opined:<br>
<br>
BM:I have a column in Postgress:<br>
BM:<br>
BM: =A0 list_of_integers =A0 =A0integer[] =A0NOT NUL,<br>
BM:<br>
BM:$foo-&gt;list_of_integers( \@ids );<br>
BM:$foo-&gt;update;<br>
BM:<br>
BM:Is there a way to store this in Class::DBI?<br>
<br>
hi bill - what version of pgsql are you using?<br></blockquote><div><br></d=
iv><div>2.18.1</div><div><br></div><div>Arrays work fine with DBD::Pg. =A0I=
 use them with DBIx::Class. =A0But with Class::DBI=A0<span style>DBIx::Cont=
extualFetch has:</span></div>

<div><span style><br></span></div><div><pre style=3D"word-wrap:break-word;w=
hite-space:pre-wrap">sub _disallow_references {
	my $self =3D shift;
	foreach (@_) {
		next unless ref $_;
		next if overload::Method($_, q{&quot;&quot;});
		next if overload::Method($_, q{0+});
		die &quot;Cannot call execute with a reference ($_)\n&quot;;
	}
}</pre></div><div><br></div><div>which is called before calling $sth-&gt;ex=
ecute to check bind parameters.</div><div><br></div><div>I was curious if I=
 was just missing something and there was a easy way to use integer[] with =
CDBI.</div>

<div><br></div><div>Thanks,</div><div>=A0</div></div>-- <br>Bill Moseley<br=
><a href=3D"mailto:[email protected]" target=3D"_blank">[email protected]</a>=
<br>

--e89a8fb20170b3f7fc04bbae9e95--


--===============0979361642==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
ClassDBI mailing list
ClassDBI-Ra3b/[email protected]
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

--===============0979361642==--