Re: DB_DataObject and transactions

From: Date: Sat, 02 Nov 2002 02:56:13 +0000
Subject: Re: DB_DataObject and transactions
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-2585@lists.php.net to get a copy of this message
------------------------------------------------------------------------ Subject: DB_DataObject and transactions From: "???????? ?.?." <djachenko@ubrr.ru> Date: Thu, 31 Oct 2002 14:23:22 +0500 To: <pear-general@lists.php.net> Hi, is any way to use several DataObjects within one transaction? As I understand each instance of DataObject creates own connection dataObjects shares 1 connection for each database (it is pooled at the moment in a central static variable.. - although it will probably be moved back to a global array eventually.)
and so new trancaton begins. PostgreSQL doesn't support nested transactions, so I have such situation: $do1 = new DO_Type1; $do1->query('begin work'); ... loop ... $do1->insert(); ... end loop ... $do2 = new DO_Type2; $do2->insert(); $do1->query('rollback'); and $do2 insert operation doesn't rollback. I would switch debugging on DB_DataObject::debugLevel(1); to watch the SQL queries being run. then try running that at the command prompt..
** one thing to note is that PEAR:DB will be doing the insert id (in the background) if the database works like that.. I'm not an expert on transactions in postgres... - although I might have to do something similar with mysql soon... Nice way to implement transactions :) if it works... Regards Alan
May be I do something wrong? Please help. Andrew Djachenko


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