Interesting issue with create()

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

From: Drew Taylor
Subject: Interesting issue with create()
Date: 17:50 on 24 Oct 2004
I had an interesting issue with creating new objects yesterday. After
calling create() I was getting back an object with id==0 when there
was in fact a new row with a positive id in the database. As it turns
out the problem was that the hash passed to create() contained the
key-value pair "id=>0" (id == PK).

My first thought is to patch create() to not accept values for the
primary key(s). But setting the primary keys can also be a useful
feature (for instance if you replace a row via delete() then
create()), so that option is out. Is there any other way I could avoid
this issue in the future? Can I set a constraint for the PK? I'm
unsure if the prohibition of relationships on PK also applies to
constraints.

Drew
        -- 
        ----------------------------------------------------------------
 Drew Taylor                 *  Web development & consulting
 Email: drew@xxxxxxxxxx.xxx  *  Site implementation & hosting
 Web  : www.drewtaylor.com   *  perl/mod_perl/DBI/mysql/postgres
 ----------------------------------------------------------------

(message missing)

Interesting issue with create()
Drew Taylor 17:50 on 24 Oct 2004

Re: Interesting issue with create()
Perrin Harkins 19:24 on 24 Oct 2004

Re: Interesting issue with create()
Jess Robinson 10:24 on 30 Oct 2004

Re: Interesting issue with create()
Drew Taylor 17:14 on 30 Oct 2004

Re: Interesting issue with create()
Jess Robinson 06:37 on 31 Oct 2004

Re: Interesting issue with create()
Drew Taylor 18:07 on 31 Oct 2004

Re: Interesting issue with create()
Lance A. Brown 18:21 on 31 Oct 2004

Re: Interesting issue with create()
Jess Robinson 06:31 on 02 Nov 2004

Re: Interesting issue with create()
Jess Robinson 06:28 on 02 Nov 2004

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