X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2D378D6F3C for ; Sat, 10 Sep 2005 04:47:41 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 02920-09 for ; Sat, 10 Sep 2005 07:47:38 +0000 (GMT) Received: from floppy.pyrenet.fr (floppy.pyrenet.fr [194.116.145.2]) by svr1.postgresql.org (Postfix) with ESMTP id 865AED6E2A for ; Sat, 10 Sep 2005 04:47:36 -0300 (ADT) Received: by floppy.pyrenet.fr (Postfix, from userid 106) id 2609231F81; Sat, 10 Sep 2005 09:47:38 +0200 (MET DST) From: "WeiShang" X-Newsgroups: pgsql.interfaces.php Subject: commit and rollback Date: Sat, 10 Sep 2005 15:48:38 +0800 Organization: Hub.Org Networking Services Lines: 38 Message-ID: X-Complaints-To: usenet@news.hub.org X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1506 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1506 To: pgsql-php@postgresql.org X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.185 required=5 tests=[PRIORITY_NO_NAME=1.185] X-Spam-Level: * X-Archive-Number: 200509/8 X-Sequence-Number: 3248 Hi, I have a problem about commit and rollback using php. For the script below, if "foo" is called and commit and if rollback statment also run. Will the update statement under foo also rollback? or commit? Thanks in advance! ---------------------------------------------------------------------------- -----------Script starts function foo(var1,var2) { pg_query($db,"begin"); pg_query($db,""); pg_query($db,"commit"); } pg_query($db,"begin"); ..... foo(v1,v2); $result1=pg_query($db,""); if (pg_affected_rows($result)==0) pg_query($db,"rollback"); else pg_query($db,"commit"); ---------------------------------------------------------------------------- -----------Script end --