rollback-transaction
Purpose: Rollbacks a SQL transaction.
rollback-transaction [ @<database> ] [ on-error-continue | on-error-exit ] [ error [ define ] <error> ] [ error-text [ define ] <error text> ]
rollback-transaction will roll back a transaction started with
begin-transaction.
Database
Optional <database> is specified in "@" clause and is the name of the
database_config_file.
Error handling
The error code is available in <error> variable in optional "error" clause - this code is always "0" if successful. The <error> code may or may not be a number but is always returned as a string value. <error> is
allocated memory. In case of error, error text is available in optional "error-text" clause in <error text>, which is
allocated memory.
"on-error-continue" clause specifies that
request processing will continue in case of error, whereas "on-error-exit" clause specifies that it will exit. This setting overrides database-level
on-error for this specific statement only. If you use "on-error-continue", be sure to check the error code.
<error> and <error text> can be created with optional "define".
Note that if database connection was lost, and could not be reestablished, the request will error out (see
error_handling).
Examples
begin-transaction @mydb
run-query @mydb="insert into employee (name, dateOfHire) values ('Terry', now())"
run-query @mydb="insert into payroll (name, salary) values ('Terry', 100000)"
rollback-transaction @mydb
See also
Database (
begin-transaction commit-transaction current-row database_config_file database_queries delete-query on-error prepared_statements query-result rollback-transaction run-query )
SEE ALL (
documentation)