Re: Stolen Ideas

[prev] [thread] [next] [Date index for 2004/08/11]

From: Perrin Harkins
Subject: Re: Stolen Ideas
Date: 03:45 on 11 Aug 2004
[ Please keep it on the list. ]

Scott McWhirter wrote:
>> SELECT cd.cd_id
>> FROM   cd, artist_cd
>> WHERE  artist_cd.cd_id = cd.cd_id
>> AND    artist_cd.artist_id = ?
>> AND    artist_cd.year      = ?
>>
>> That is not what Class::DBI does right now with a mapping table (it uses
>> two queries), but when many-to-many is improved, it should.
>>  
>>
> Okay... uniqueness cannot be acheived using a combination of WHERE 
> clauses... the data changes!

You're just getting distracted by the wording of Tony's example.  Go 
back to your own example: my $cd = $supplier1->{'cds'}{'CD00001'}

Assuming that supplier_cd is a mapping table with primary key 
(supplier_id, cd_id) and a unique constraint on (supplier_id, code), 
this would require SQL like this:
SELECT cd.cd_id
FROM   cd, supplier_cd
WHERE  supplier_cd.cd_id = cd.cd_id
AND    supplier_cd.supplier_id = ?
AND    supplier_cd.code        = ?

It's the same as the other example, and those keys should not change, 
since they are database keys, not object data.  If you change the value 
of "code" for this supplier, it means you WANT it to change.  You can't 
change the value of cd_id or supplier_id, since Class::DBI doesn't 
support modifying an object's primary key.

>    with the sql clauses your doing:
>       get z where a=b, c=d, e=f
>          this is resource intensive and does not garantee the outcome
> 
>    with a hash:
>       get foo where key=bar
>          less resource intensive and garantees the outcome

It's not possible to fulfill the hash lookup you did above using a 
single key SQL lookup like that.  Your statement 
"$supplier1->{'cds'}{'CD00001'}" implies two keys: the supplier's ID and 
the hash key (which I called code).  I also don't think it can be done 
(unless you repeat data) without a join table, although you'll notice my 
SQL did not include a join to the supplier table.

- Perrin

(message missing)

Stolen Ideas
Tony Bowden 18:58 on 10 Aug 2004

Re: Stolen Ideas
ed-cdbi 19:03 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 19:06 on 10 Aug 2004

Re: Stolen Ideas
ed-cdbi 19:08 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 19:11 on 10 Aug 2004

Re: Stolen Ideas
ed-cdbi 19:19 on 10 Aug 2004

RE: Stolen Ideas
Thomas, Mark - BLS CTR 19:11 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 19:27 on 10 Aug 2004

Re: Stolen Ideas
Nelson C. T. Ferraz 15:14 on 12 Aug 2004

Re: Stolen Ideas
Scott McWhirter 19:18 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 19:28 on 10 Aug 2004

Re: Stolen Ideas
Scott McWhirter 20:42 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 21:08 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 21:33 on 10 Aug 2004

Re: Stolen Ideas
Scott McWhirter 22:58 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 23:23 on 10 Aug 2004

Re: Stolen Ideas
Gregory P. Smith 19:55 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 20:02 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 21:47 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 22:23 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:37 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 22:57 on 10 Aug 2004

Re: Stolen Ideas
Yuval Kogman 15:39 on 11 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:02 on 10 Aug 2004

Re: Stolen Ideas
ed-cdbi 22:11 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:25 on 10 Aug 2004

Re: Stolen Ideas
Tim Bunce 08:53 on 24 Aug 2004

Re: Stolen Ideas
Perrin Harkins 22:16 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:42 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 22:16 on 10 Aug 2004

Re: Stolen Ideas
Tony Bowden 23:18 on 10 Aug 2004

Re: Stolen Ideas
Scott McWhirter 23:48 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 00:22 on 11 Aug 2004

Re: Stolen Ideas
Perrin Harkins 03:45 on 11 Aug 2004

Re: Stolen Ideas
Tony Bowden 08:36 on 11 Aug 2004

Re: Stolen Ideas
Aaron Trevena 19:05 on 13 Aug 2004

Re: Stolen Ideas
Aaron Trevena 17:13 on 15 Aug 2004

Re: Stolen Ideas
Dan Friedman 04:47 on 11 Aug 2004

Re: Stolen Ideas
Tony Bowden 08:39 on 11 Aug 2004

Re: Stolen Ideas
Branislav Zahradnik 15:21 on 11 Aug 2004

RE: Stolen Ideas
Thomas, Mark - BLS CTR 19:13 on 13 Aug 2004

Re: Stolen Ideas
Tony Bowden 23:16 on 10 Aug 2004

Re: Stolen Ideas
Perrin Harkins 23:42 on 10 Aug 2004

Re: Stolen Ideas
Tim Bunce 08:48 on 24 Aug 2004

Re: Stolen Ideas
Tony Bowden 21:57 on 11 Aug 2004

Re: Stolen Ideas
Simon Cozens 09:03 on 24 Aug 2004

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