X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9977ED1B172 for ; Thu, 13 May 2004 17:31:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 10723-04 for ; Thu, 13 May 2004 17:31:24 -0300 (ADT) Received: from marsha.pcisys.net (marsha.pcisys.net [216.229.32.146]) by svr1.postgresql.org (Postfix) with ESMTP id AFC6AD1B16A for ; Thu, 13 May 2004 17:31:21 -0300 (ADT) Received: from [192.168.0.6] (moe.rbe45-183.cos.pcisys.net [216.229.45.183]) (authenticated bits=0) by marsha.pcisys.net (8.12.11/8.12.11) with ESMTP id i4DKT3kZ008377 for ; Thu, 13 May 2004 14:29:03 -0600 (MDT) User-Agent: Microsoft-Entourage/10.1.4.030702.0 Date: Thu, 13 May 2004 14:31:20 -0600 Subject: Re: Checking data inserted during a transaction From: Keary Suska To: Postgres-PHP Message-ID: In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=RCVD_IN_SORBS X-Spam-Level: X-Archive-Number: 200405/22 X-Sequence-Number: 2741 on 5/12/04 4:45 PM, lynna@gallery44.org purportedly said: > Because information has to be entered into several different tables for each > exhibition, I've broken down the process of adding new exhibitions to the > databases into several pages, each of which processes the form data sent > from the previous page and then guides users through the next step (artists > featured in the exhibition, etc.). > > I'm using transactions to handle this, so that at the end of the process the > user can (hopefully) review the data they've entered and either commit or > rollback the changes. But I'm having a bit of trouble figuring out whether > the data I'm trying to insert during the transaction is actually being > inserted. > > From what I've read about transactions thus far, it looks to me as though > the data inserted should be visible in the database after the insert is done > but before the commit or rollback happens, and then disappear if rollback is > chosen. But that doesn't seem to be working. As was mentioned, only the connection/process that "owns" the transaction can see information altered within the transaction. In short, the answer to your question is, "you can't." You have a bigger issue, however. Because of the stateless nature of HTTP and how PHP/Apache implements database connections, your multi-page process will likely fail, as there is no guarantee that on any subsequent HTTP requests that you will be using an existing connection/process (see also first paragraph). To use a multi-stage process, you will need to preserve the data yourself (i.e. not insert into DB) at each step until the process is confirmed by the end user. If the data is not too large you can preserve it within session variables. Otherwise you may want to create a "safe" temp file, a reference to which is maintained by the session. Best regards, Keary Suska Esoteritech, Inc. "Leveraging Open Source for a better Internet"