Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id DAD479FBB73 for ; Thu, 1 Mar 2007 08:45:13 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 09063-06 for ; Thu, 1 Mar 2007 08:44:43 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.246]) by postgresql.org (Postfix) with ESMTP id E91F59FB5A4 for ; Thu, 1 Mar 2007 08:45:09 -0400 (AST) Received: by an-out-0708.google.com with SMTP id c24so356959ana for ; Thu, 01 Mar 2007 04:45:08 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=WejPXBjvwHILc3sJ73qkYXwQoux35Qdc1i1w0SdkAY61R/I0TPxD9Zh+NuU4jQ0l6OZJcXKlKT23JK7IB+6EOFqiclO/qCyFFO/MURt1URI59hldVqdAG0j8bEUxQVoFnrd6uHPFkeq3oVwU/Q7Uad5/y0oI2y+lj+VBkWkAflI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=JoD/4E5HslkvK1ewxphiWhZ0gx7WaEiLfqpFq1UCkb8kZn+wRm3AQBZ6f6nSoCg/48RtLhTI0BcQM9+EJa6Wv3+Pd+A4Tfj7j8moS5oXS6JbOzocpYU5ZIupRzqn6+iuAVUDw639pHAwLJDY+931sd8TGacqnQFV24BY/Ofhcsg= Received: by 10.100.123.9 with SMTP id v9mr1392521anc.1172753108834; Thu, 01 Mar 2007 04:45:08 -0800 (PST) Received: by 10.100.165.1 with HTTP; Thu, 1 Mar 2007 04:45:08 -0800 (PST) Message-ID: Date: Thu, 1 Mar 2007 13:45:08 +0100 From: mikie To: pgsql-php@postgresql.org Subject: Re: transactions from PHP - double COMMIT required? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070301131523.fgfm83nb9y2kgo4c@imp3.uta.fi> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/5 X-Sequence-Number: 3717 2007/3/1, David Legault : > If you are using PHP5 (and the PDO PGSQL) I would suggest you use exceptions to trap the error > > try { > > $db->beginTransaction(); > > // other queries here, if one fails, an exception is thrown > > $db->commit(); > } > catch (Exception $e) { > > // do whatever with error > $db->rollback(); > > } Yes, that is nice way to work with databases, but I am on PHP4 and I am not using the PDO. But getting back to my problem - perhaps there is something I misunderstood: is it the client application responsibility to check if the transaction failed or succeeded and issue COMMIT or ROLLBACK accordingly (how do I close the transaction block in that case)? Or is it the database server that is suppose to check if transaction succeded and perform the query, or ROLLBACK if anything went wrong? -- Mike