Re: DataObject Inserts and Sequences
| From: | Alan Knowles | Date: | Sat, 28 Feb 2004 01:42:34 +0000 |
| Subject: | Re: DataObject Inserts and Sequences | ||
| References: | 1 2 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-11007@lists.php.net to get a copy of this message | ||
define the method
function sequenceKey() {
return array(
$keyname=false,
$use_native=false,
$sequence_name=false
);
// thats not an associative array..
// - it just written like that to make it clearer :)
}
in the extended class..
The problem with changing the behaviour (which is to assume the primary key is a sequence column).. is that it may break alot of existing code...
Regards
Alan
Justin Patrin wrote:
Michael Kunze wrote:-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.comhi, i have this simple code: $player_has_stats = new Player_has_stats(); $player_has_stats->player_id = 13; $player_has_stats->insert(); with debug enabled i get this: player_has_stats: CONNECT: USING CACHED CONNECTION player_has_stats: CONNECT: USING CACHED CONNECTION player_has_stats: QUERY: INSERT INTO player_has_stats (player_id ) VALUES ( 1 ) player_has_stats: query: QUERY DONE IN 0.000581979751587 seconds player_has_stats: 1: Clearing Cache for player_has_stats whats wrong here? why does it generate the sql statement with ...VALUES(1) ? i clearly said that player_id should be 13. CREATE TABLEWhen you have a field set as a primary key, DB_DataObject won't allow you to manually set it (I believe). Why are you trying to set the primary key manually?player_has_stats(player_idint(10) unsigned NOT NULL default '0',deathsint(10) unsigned NOT NULL default '0',killsint(10) unsigned NOT NULL default '0', PRIMARY KEY (player_id) ) TYPE=MyISAM; i'm using: $Id: DataObject.php,v 1.208 2004/01/29 09:53:18 alan_k Exp $ for some strange reason it tries to create a sequence for that table. i have absolut no idea why it tries todo that. please help. best regards, michael