SQLROLLBACK( ) Function Example
The following example assumes SQLCONNECT( ) is successfully issued, and its return value is stored to a memory variable named gnConnHandle
. SQLSETPROP( ) is used to set the Transactions property to 2 (manual), allowing you to use SQLCOMMIT( ) and SQLROLLBACK( ).
The authors
table is modified with SQLEXEC( ), and the changes to the table are cancelled with SQLROLLBACK( ).
= SQLSETPROP(gnConnHandle, 'Transactions', 2) && manual
= SQLEXEC(gnConnHandle, "INSERT INTO authors (au_id, au_lname);
VALUES ('aupoe', 'Poe')")
= SQLROLLBACK(gnConnHandle)