MySQL Forums
Forum List  »  PHP

Transactions+locks+insert+update
Posted by: Blai Francés Perigüell
Date: July 20, 2005 03:25AM

Hello you all,

I'm developing an aplication and I want to perform some inserts and updates with the option to recover the previous status if any error. So it is:

set autocommit = 0;
savepoint namesavepoint;
...
Retrieve information from db (select)
if no information retrieved
{
perform an insert with some data;
if insert returns error
perform a rollback;
retrieve information of data just stored;
if retrieval returns no data
die("no data retrieved");
}
...
commit;
set autocommit = 1;

This is but a taste of my code. The problem is that the aplication always reaches "die" instruction, so I never succeded in going beyond this point in processing data.

I would like to be able to retrieve data that I've just stored using this aplication and I must strongly be able to rollback at any error to a savepoint that I set at the very begining in this aplication.

Could anybody help me with that problem to be able to do what I want?

Thank you very much in advance for your help.
Regards,
Blai.

Options: ReplyQuote


Subject
Written By
Posted
Transactions+locks+insert+update
July 20, 2005 03:25AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.