Question Using TRANSACTION to simulate real execution

Adri4GL

New Member
Hello everyone,

I am in a situation in which I must transfer the logic of a procedure to a web environment. The problem that I've encountered with this is that in this procedure there is interaction with the user through the use of MESSAGE with YES-NO buttons. Having these messages in progress does not generate any problems at all since the execution stops and waits for the user response, but on the website side I do not have that flexibility of stopping the process in the server side at a certain point, asking the user from the client side, and resuming the server side process exactly in the state in which it was left off now having the user response.

Mention that I am using WebService and SOAP requests to make the connection between the website and the server.
Also, I cannot modify the way the original procedure works, only adapt it according to the needs of the web execution.

In order to be able to solve this problem, I came up with the idea of simulating the final execution of the process in order to retrieve the questions to ask the user. Once I know the questions to ask, manage them all by website side and once I had all the answers, execute the real procedure omiting the messages and facilitating the answers beforehand.

The thing is that I need this to be only a simulation. All the ASSIGNS, CREATES and DELETES of data that are made throughout this simulation have to have no real effect on the database. This includes both actions carried out directly from the initial procedure, as well as those carried out from calls to external procedures or from the tables triggers themselves.

I came up with two possible solutions for this simulation.

One of them was to make use of TEMP-TABLES to perform all these actions on copies of the real data. The problem I've had is that the actions performed do not launch triggers that would be launched in the real tables, just as the ROWIDs of the records will not be the same as the real ones and therefore there are fractions of code that will never be executed because of not availables records. Because of all this I've already ruled out this possibility.

The second idea I've came up with was to use transactions to execute the real process but at the end of it perform an UNDO to return the records to the BI state. I've been reading the transactions documentation and testing it in a development environment and, although it has worked well, I don't know if I can be 100% confident that any action taken during the simulation will be reverted to the previous state. What I cannot afford is that some of the performed actions will not be reversed and that as a result, in the actual execution of the process, causes the result to change or not complete properly.

Would this second option be a viable and reliable method of simulating a procedure execution without affecting the database records?
If not, are there be any other ways to carry out this simulation in order to recover the points of interaction with the user?

Thanks beforehand
 
Last edited:
The second idea I've came up with was to use transactions to execute the real process but at the end of it perform an UNDO to return the records to the BI state. I've been reading the transactions documentation and testing it in a development environment and, although it has worked well, I don't know if I can be 100% confident that any action taken during the simulation will be reverted to the previous state. What I cannot afford is that some of the performed actions will not be reversed and that as a result, in the actual execution of the process, causes the result to change or not complete properly.

The AVM will undo any transactions that were started during that giant DO TRANSACTION block. You can be 100% of that .... Progress has had 40 years of practice making sure that this works as expected.

There are other non-transaction things you can do like read/write files to disk, make external calls to an AppServer or some other network service, etc that will not be undone when the transaction(s) are rolled back.

All of that said, why not just do this on a local clone of the DB and thrown it away once you've done your tests? You can create new copies for any subsequent tests.
 
Back
Top