Cicode Programming Reference > Cicode Function Categories > SQL Functions > SQLRollBack

SQLRollBack

Rolls back (discards) all changes made to the database within the current transaction. If you call the SQLBeginTrans() function to begin a transaction, you are not committed to changes to the database made by the Insert, Delete, and Update commands until you call the SQLCommit() function. You can discard these changes by calling the SQLRollBack() function.

You can only call the SQLRollBack() function if you have called SQLBeginTran() to begin a transaction. You do not need to begin a transaction to modify a database, but any changes you make to a database outside of a transaction are automatically committed.

The SQLRollBack() function could affect different databases in different ways. If the function is not performing as you expect, check that your database is able to service transactions. Refer to the documentation for your database for more information on rolling back transactions.

This function is a blocking function and should not be called from a foreground task.

Syntax

SQLRollBack(hSQL)

hSQL:

The handle to the DB connection object, returned from either SQLCreate() or SQLConnect() function. The handle identifies the DB connection object where details of the associated SQL connection are stored.

Return Value

0 (zero) if successful, otherwise an error number is returned. (For details of the 307 error code, call the SQLErrMsg function).

Related Functions

SQLCreate, SQLOpen, SQLClose, SQLDispose, SQLConnect, SQLDisconnect, SQLInfo, SQLBeginTran, SQLCommit, SQLRollBack

Example

See SQLBeginTran

See Also

SQL Functions

Published June 2018