Re: DB_Dataobject Insert Problem with getting id

From: Date: Mon, 24 Oct 2005 16:36:35 +0000
Subject: Re: DB_Dataobject Insert Problem with getting id
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21615@lists.php.net to get a copy of this message
On 10/24/05, Sebastian Ganschow <sebastian@ganschow.net> wrote: > > Justin Patrin schrieb: > > >On 10/23/05, Sebastian Ganschow <sebastian@ganschow.net> wrote: > > > > > >>Hi, > >> > >>we've got a Problem with getting an id when we call $do->insert(). > >> > >>The Dataobject is configured with ignore_sequence_keys = ALL and the field > >> > >> > > > >Well...this is happening *because* you have ignore_sequence_keys set > >to 'ALL'. Perhaps you have this set wrong? > > > > > > > Hi, > > but i thought, if I set ignore_sequence_keys to ALL, Dataobject will use > the native support > for getting the id of the last inserted element. > > The documentation of this configuration option says: > " If you do not want to use pear's nextval(), for automatically filling > in sequences, > this can disable it for "ALL", or a list of tables > "person,cart,group"" > > And the phpDoc for method insert() says: > > "*Return:* false on failure, int when auto increment or sequence used, > otherwise true on success" > > So I don't want to use sequence keys, but the auto increment. > If this behavior is correct, how can I use auto increment. > If you're using mysql you don't have to do anything. It will work without any options set. If you're using another DB try it. If it doesn't work you probably need to override sequenceKey() for your DOs and return the correct values. -- Justin Patrin

« previous php.pear.general (#21615) next »