Re: DB_DataObject error ?
| From: | Alan Knowles | Date: | Thu, 29 Jan 2004 03:24:41 +0000 |
| Subject: | Re: DB_DataObject error ? | ||
| References: | 1 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-10417@lists.php.net to get a copy of this message | ||
Can you try the latest version - (and regenerate the schema file) - it should be fixed in the latest release..
Regards
Alan
Patrick Allaert wrote:
Hello, I am using a table named "busy" (MySQL): CREATE TABLE-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.combusy(id_permediumint(6) unsigned NOT NULL default '0',idmediumint(8) unsigned NOT NULL default '0',tstimestamp(14) NOT NULL, PRIMARY KEY (id_per,id), UNIQUE KEYid(id), KEYts(ts) ) TYPE=MyISAM "id_per" is representing a person, and "id" is representing an object both of them are foreign keys ! this table is used to attribute objects (id) to persons (id_per), one person may hold several objects, but an object may not be holded by more than one person (reason of Unique key: "id") so, i am using the following code to say => reserve object id '5' to person id '18': =============== $busy = new DataObjects_Busy; $busy->setid(5); $busy->setid_per(18); $busy->insert(); =============== But DB_DataObject generate this: DB_DataObject: SENT: INSERT INTO busy (id ) VALUES ( 18 ) because it thinks that id_per is an autoincrement !! This is the part of code of function insert() of DataObject.php that skip the autoincrement // if we are using autoincrement - skip the column... if ($key && ($k == $key)) {continue;} I guess this condition test if this is the primary key and not if it is an autoincrement value !! am i right ? Patrick