Re: Dataobject insert fails but succeeds!?

From: Date: Fri, 04 Jul 2003 15:08:50 +0000
Subject: Re: Dataobject insert fails but succeeds!?
References: 1  Groups: php.pear.general php.pear.general 
Request: Send a blank email to pear-general+get-6479@lists.php.net to get a copy of this message
Mike Carter wrote:
Hi, If I attempt to do insert() a populated dataobject which has a id (primary key) attribute set to NULL I get a PEAR error "DB Error: already exists" but at the same time the record gets inserted in to the database anyway. what does DB_DataObject::debugLevel() show.
The row gets assigned the ID '2147483647' too.
I suspect that's the same as using -1.. (eg. it's the maximum number looped) Why?
How can I make my DataObject get assigned the next free id by MySQL?
from what I remember if you insert a large number it puts the increment pointer at that number.. - and all 'auto insertes after that will match it..'
I've tried setting the $dbobj->id = 0 or $dbobj->id = NULL and unset($dbobj->id) before calling the $dbobj->insert() but no luck! what's the debug show - and what happens when you run the same sql at the prompt..?
Regards Alan
Am using $Id: DataObject.php,v 1.68 2003/03/12 07:33:39 alan_k Exp $ Suggestions apreciated,


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