DataObjects: No keys set... unexpected update() behavior

From: Date: Tue, 26 Nov 2002 02:08:04 +0000
Subject: DataObjects: No keys set... unexpected update() behavior
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-2830@lists.php.net to get a copy of this message
In several of my objects, I have no primary keys defined in the .ini file, because the actual keys contain multiple columns, and I'm incrementing them manually. However, though things have been going fine for the most part, calling the update() is essentially useless, because the object's _condition variable is always set to include every field in the table. Here is an example query, output while debugging: UPDATE ship_address SET user_id = 1 , address_id = 20 , address1 = '12345 1st Ave NE' , address2 = '' , city = 'Bellevue' , state = 'WA' , zip = '98006' , country_id = 226 , active = 1 WHERE user_id = 1 AND address_id = 20 AND address1 = '12345 1st Ave NE' AND address2 = '' AND city = 'Bellevue' AND state = 'WA' AND zip = '98006' AND country_id = 226 AND active = 1 As you can imagine, it's impossible to actually update, because the WHERE condition will only match an imaginary row which already contains the data you want to put into it. I tried overriding the DataObjects update() method, but for some reason, this didn't seem to work, and the parent method seemed to have been called instead. Does anyone have any ideas on how I might solve this dilemma? Thanks, Leigh Caplan maelman@u.washington.edu

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