Re: [PATCH] population bug in create()?

[prev] [thread] [next] [Date index for 2004/10/20]

From: Ricardo SIGNES
Subject: Re: [PATCH] population bug in create()?
Date: 17:35 on 20 Oct 2004
--ZmUaFz6apKcXQszQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

* Tony Bowden <tony-cdbitalk@xxxxx.xxx> [2004-10-19T07:31:04]
> On Tue, Oct 19, 2004 at 05:24:21PM +0900, Tatsuhiko Miyagawa wrote:
> > 519:   if (@primary_columns =3D=3D grep defined, @{$data}{@primary_colu=
mns})
> > grep defined, @{$data}{qw(id)} automatically populates id =3D> undef on
> > $data hashref. So here's a patch.
> >=20
> > - if (@primary_columns =3D=3D grep defined, @{$data}{@primary_columns})=
 {
> > + my $num =3D 0;
> > + for my $pk (@primary_columns) {
> > +     $num++ if defined $data->{$pk};
> > + }
> > + if (@primary_columns =3D=3D $num) {
>=20
> Ouch.
>=20
> I'm curious if there isn't a better way here, though...

I solved this problem by replacing that if with:

 if (@$data{@primary_columns}
     and @primary_columns =3D=3D grep defined, @{$data}{@primary_columns}
 ) {

I sent you this patch, with a failing test that it would fix, on 2004-08-16=
.  A fix for this is needed for Class::DBI support for MSSQL via ODBC.

(I now see that this solution isn't generic enough, but a solution is
needed for us ghetto MSSQL users.)

--=20
rjbs

--ZmUaFz6apKcXQszQ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQFBdqHY5IEwYcR13KMRArG5AJ4jX3bW8oYCEl8Gu3fC7fDiBYjHLACdHngf
qrYl6LH0HGY/95Wmmcz6F4A=
=yV3e
-----END PGP SIGNATURE-----

--ZmUaFz6apKcXQszQ--

[PATCH] population bug in create()?
Tatsuhiko Miyagawa 08:24 on 19 Oct 2004

Re: [PATCH] population bug in create()?
Tony Bowden 11:31 on 19 Oct 2004

Re: [PATCH] population bug in create()?
Tim Bunce 14:06 on 19 Oct 2004

Re: [PATCH] population bug in create()?
William McKee 13:26 on 20 Oct 2004

Re: [PATCH] population bug in create()?
Ricardo SIGNES 17:35 on 20 Oct 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52