Re: DataObject: createtables doesn't overwrite after DBMS change

From: Date: Tue, 30 Sep 2003 09:23:11 +0000
Subject: Re: DataObject: createtables doesn't overwrite after DBMS change
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-22211@lists.php.net to get a copy of this message
I guess this may be due to the regex bug in createTables that didnt handle files with \r\n very well.. (hence didnt update the var's section) - should be fixed in cvs.. Regards Alan Jeroen Houben wrote:
Alan Knowles wrote:
It's worth investigating the output from $db->tableInfo('player_track') - as that where dataobjects get's its information from. The comments are built up from the return value of tableInfo - I think for postgres it looks for 'next_val' or similar in the table info to determine if it's a key column. although it might also test for primary_key..
Hi Alan, I think didn't explained myself right. Let me try again. Everything works fine if I delete the old file and regenerate it. The problem *only* occured because I initially created the DO classes for MySql. I then switched my tables Postgres, changed the DSN in the configfiles and regenerated the classes. That's when the comments didn't get overwritten. hope I've explained myself properly here :-) jeroen
Regards Alan Jeroen Houben wrote:
Hi This is really a minor thing but I thought I should mentioned it anyway.. My table in pgsql looks like this. Notice there are no keys defnied. CREATE TABLE "player_track" ( "player_id" SMALLINT DEFAULT '0' NOT NULL, "position" SMALLINT DEFAULT '0' NOT NULL, "altered" TIMESTAMP WITHOUT TIME ZONE NOT NULL ) WITH OIDS; [player_track] player_id = 1 position = 1 altered = 2 [player_track__keys] Now in the comments of the auto generated code below it says there are two Primary Keys: player_id and altered. This is a result of the code generated for MySql. I however switched to PG but the auto code isn't overwritten properly I don't think. I don't know if DO uses those comments for anything (I don't think so) but everything works fine as far as I can tell. Easy solution is to delete the classes generated for MySql and re-run createTables.php, but in some other classes I have a lot of handwritten code I don't want to delete. ###START_AUTOCODE /* the code below is auto generated do not remove the above tag */
   var $__table = 'player_track';                    // table name
   var $player_id;                       // int(5)  not_null primary_key unsigned
   var $position;                       // int(3)  not_null unsigned
   var $altered;                         // timestamp(14)  not_null primary_key unsigned zerofill timestamp
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.dev (#22211) next »