Re: DB_Object->update() : "getLink: row not set"

From: Date: Wed, 17 Nov 2004 03:24:07 +0000
Subject: Re: DB_Object->update() : "getLink: row not set"
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15586@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, Nov 16, 2004 at 10:12:09AM -0800, Justin Patrin wrote: > On Tue, 16 Nov 2004 10:45:19 +0100, toni <toni@pangea.org> wrote: > > No, I haven't overridden the update() method. > > > > I have provisionally solved inserting a row in the table "Proyecto" > > meaning a null value, but I think this is not the way. > > I'd like to see an example of the recommended way to insert links using DB_Object. I have an app with lots of this kind of stuff: create table table_a ( table_a_pkey int(32) not null unique auto_increment, col1 varchar(255), col2 varchar(255), col3 varchar(255), primary key (table_a_pkey) ); create table table_b ( table_b_pkey int(32) not null unique auto_increment, col4 varchar(255), col5 varchar(255), col6 varchar(255), table_a_pkey int(32), primary key (table_b_pkey) ); create table table_c ( table_c_pkey int(32) not null unique auto_increment, col7 varchar(255), col8 varchar(255), col9 varchar(255), table_b_pkey int(32), primary key (table_c_pkey) ); Where the links are like [table_c]: table_b_pkey: table_b:table_b_pkey [table_b]: table_a_pkey: table_a:table_a_pkey And I often have to insert data into tables a, b, and c all in one go, and maintain the links in what I just inserted. So I need to insert table_a's data, then get the last_insert_id(), then insert table_b's data along including the table_a_pkey, and get its last_insert_id(), then insert table_c including the table_b_pkey. In the application I am porting to PEAR, I wrote my own customised database abstraction which did exactly that at insert time. Works great but it is based on a model so different from DB_Object that I basically can't use any of it and would need to start from scratch. Besides, bluntly, my code sucks, and I'd rather use someone else's if it is available. I don't want to reinvent the wheel and want to do it in the most PEAR-like way possible. Is there a clean way to do it in a generic way with DB_Object? - -ken - -- - --------------- The world's most affordable web hosting. http://www.nearlyfreespeech.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFBmsRXe8HF+6xeOIcRAl+CAKC4OPfDhbLBAJr2A/GKc4doaupEHACfUWsQ sCjpV1NSU31a8b23l9asK2o= =aGhx -----END PGP SIGNATURE-----

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