Page 1 of 1

Possible use of mysql rollback?

Posted: Fri May 14, 2021 8:38 pm
by slobodan
Is it possible to rollback last save(update), using AS(after save) php code?

Re: Possible use of mysql rollback?

Posted: Fri May 14, 2021 9:12 pm
by kev1n
Can't you use the BS event to prevent the saving in the first place?

To rollback a saving operation you'd have to retrieve the values that are stored in the table in BS, store their values in a session variable and then UPDATE your record with the old values in AS.

Re: Possible use of mysql rollback?

Posted: Fri May 14, 2021 11:17 pm
by slobodan
The idea is to consistently perform all related updates on the database or, if any of that gets stuck, to restore the database to its previous state. If this cannot be done in the same dbase transaction, the closest option is your suggestion. So, if mysql saved procedure started in AS, did rollback, data that was updated by the form, should be returned to the state stored in BS. Is it correct?

Re: Possible use of mysql rollback?

Posted: Sat May 15, 2021 7:58 am
by kev1n
slobodan wrote: or, if any of that gets stuck, to restore the database to its previous state.
Either all data is saved or none. In which scenario would data not be fully stored ?
slobodan wrote: So, if mysql saved procedure started in AS, did rollback, data that was updated by the form, should be returned to the state stored in BS. Is it correct?
yes

Re: Possible use of mysql rollback?

Posted: Sat May 15, 2021 8:04 pm
by slobodan
I used to work on an application for a manufacturing company, where dynamic part reservations were done in warehouses. On the principle of competition, where it was necessary to maintain the synchronized conditions in several accompanying tables. This was done strictly in database transactions, in order to maintain the consistency of the data. Most forms do not require such complex processing, but it is better to make an effort to learn new software, if it allows such things.
It seems to me that nuBuilder is worth the effort, although online sources of information are much rarer than for some others, such as for Oracle APEX for example. In that sense, thank you for your quick answers on this forum.

Slobodan