Re: Checking data inserted during a transaction

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



on 5/12/04 4:45 PM, lynna@xxxxxxxxxxxxx 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"



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux