Re: Need help with finding solution to CDBI bug

[prev] [thread] [next] [Date index for 2004/06/21]

From: Yuval Kogman
Subject: Re: Need help with finding solution to CDBI bug
Date: 18:04 on 21 Jun 2004
--1Ow488MNN9B9o/ov
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jun 21, 2004 at 13:41:58 -0400, William McKee wrote:

> I meant map in the sense of using a map function like the one that
> Charles B. suggested which converts object references into literal
> values.

My reply to him explains how this breaks - stringification does not
always use the id, and furthermore, has_a relationships in the fields
returned by id are stringified into it. See below.

> No, I mean multiple primary keys which could hold a foreign key as in a
> many-to-many relationship. Is this considered multiple foreign keys? If
> so, the docs for doing Many-to-many relationships seem to me to suggest
> using multiple foreign keys via the following table definition:
>=20
>     Role->table('role');
>     Role->columns(Primary =3D> qw/film actor/);

That's one primary key... You can't be assured by the database that only
one row will have film so and so. You need both the field and the actor
to retreive the rrole.

>     Role->has_a(film =3D> 'Film');
>     Role->has_a(actor =3D> 'Actor');

And these are foreign keys. In this case the fields for the primary key
are also foreign keys themselves - each one contains the value of a
primary key in another table. I think (i hate this jargon, it's not 100%
logical).

> > See the failing test case I mailed Tony - it retreives an object whose
> > primary key has_a. I can give the numerical IDs of the key fields, or I
> > can give the objects that were inflated. I'm not sure if this is
> > documented, desired, or whatever - i just found that out when I noticed
> > i forgot to ->id, but it still worked.

I meant that

my $film =3D Film->retreive(1);
my $actor =3D Actor->retreive(1);

Role->retreive(film =3D> $film->id, actor =3D> $actor->id) =3D=3D # this wo=
rks
Role->retreive(film =3D> $film, actor =3D> $actor); # and so does this

Is the second way of doing this logically consistent?

> I tried to run your test but do not have MySQL installed. From my
> understanding, I think the inflation is a desired behavior (from the
> Overloaded Operations section of the pod):
>=20
>     When a Class::DBI object reference is used in a string context it
>     will, by default, return the value of the primary key. (Composite
>     primary key values will be separated by a slash).

But sometimes Class->columns(Stringify =3D> 'foo_is_not_primary') is given
which will stringify to something else.

Also note, that has_a is inflated when stringifying - my script outputs

	"Britney Spears/Kind of Blue"

when that link is stringified, and also sends

	delete from links where artist=3D"Britney Spears" and album=3D"Kind of ABl=
ue"

when I tell it that such commercialism was not yet popular in the
1950s. The primary key for $link is the two IDs - an album and an
artist. Try looking at the source if I'm not sounding logical - I
usually fail miserably in this respect...

> My problem is that DBD::Pg does not like to receive an object even if
> calling it in scalar context will return a value.

Is it just passing it unstringified to XS?

--=20
 ()  Yuval Kogman <nothingmuch@xxxxxxxx.xxx> 0xEBD27418  perl hacker &
 /\  kung foo master: /me dodges cabbages like macalypse log N: neeyah!


--1Ow488MNN9B9o/ov
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFA1yNKVCwRwOvSdBgRAluVAJ9wehDbtgT+gA/VXKY5ZAsTbEan+QCgskbe
kx7CcAoka2P99mZE5wjSNkA=
=iwH3
-----END PGP SIGNATURE-----

--1Ow488MNN9B9o/ov--

(message missing)

Need help with finding solution to CDBI bug
William McKee 11:40 on 19 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 13:19 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 14:06 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 15:14 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 15:23 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 17:07 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
Yuval Kogman 15:30 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
Yuval Kogman 15:37 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 16:12 on 25 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 16:33 on 25 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 21:47 on 25 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 08:34 on 26 Jun 2004

Re: Need help with finding solution to CDBI bug
Takes Tea at Half Past Three 17:06 on 25 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 22:13 on 25 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 00:10 on 26 Jun 2004

RE: Need help with finding solution to CDBI bug
robert_creager 04:34 on 03 Jul 2004

Re: Need help with finding solution to CDBI bug
William McKee 17:17 on 05 Jul 2004

Re: Need help with finding solution to CDBI bug
Robert Creager 20:57 on 05 Jul 2004

Re: Need help with finding solution to CDBI bug
Robert Creager 00:22 on 06 Jul 2004

Re: Need help with finding solution to CDBI bug
William McKee 12:50 on 06 Jul 2004

Re: Need help with finding solution to CDBI bug
William McKee 17:05 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
Yuval Kogman 17:18 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 17:41 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
Yuval Kogman 18:04 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 19:20 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
Yuval Kogman 20:16 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 07:34 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
Yuval Kogman 14:25 on 21 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 20:03 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 22:44 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 15:16 on 24 Oct 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 22:15 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 12:33 on 23 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 17:17 on 23 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 11:38 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
merlyn (Randal L. Schwartz) 16:10 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 13:19 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 22:04 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 12:43 on 23 Jun 2004

Re: Need help with finding solution to CDBI bug
Yuval Kogman 19:52 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 19:56 on 23 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 12:48 on 23 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 22:12 on 23 Jun 2004

Re: Need help with finding solution to CDBI bug
Yuval Kogman 23:30 on 22 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 07:08 on 24 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 13:53 on 24 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 14:51 on 24 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 07:12 on 24 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 13:50 on 24 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 14:55 on 24 Jun 2004

Re: Need help with finding solution to CDBI bug
Tony Bowden 16:04 on 27 Jun 2004

Re: Need help with finding solution to CDBI bug
Charles Bailey 17:53 on 27 Jun 2004

Re: Need help with finding solution to CDBI bug
William McKee 12:58 on 06 Jul 2004

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