Console - ROLLBACK

Aborts a transaction, rolling the database back to its save point.

Syntax

  1. BEGIN

For more information on transactions, see Transactions. To initiate a transaction, use the BEGIN command. To save changes, see COMMIT command.

Example

  • Initiate a new transaction:

    1. orientdb> BEGIN
    2.  
    3. Transaction 1 is running
  • Attempt to start a new transaction, while another is open:

    1. orientdb> BEGIN
    2.  
    3. Error: an active transaction is currently open (id=1). Commit or rollback before starting a new one.
  • Make changes to the database:

    1. orientdb> INSERT INTO Account (name) VALUES ('tx test')
    2.  
    3. Inserted record 'Account#9:-2{name:tx test} v0' in 0,004000 sec(s).
  • View changes in database:

    1. orientdb> SELECT FROM Account WHERE name LIKE 'tx%'
    2.  
    3. ---+-------+--------------------
    4. # | RID | name
    5. ---+-------+--------------------
    6. 0 | #9:-2 | tx test
    7. ---+-------+--------------------
    8. 1 item(s) found. Query executed in 0.076 sec(s).
  • Abort the transaction:

    1. orientdb> ROLLBACK
    2.  
    3. Transaction 1 has been rollbacked in 4ms
  • View rolled back database:

    1. orientdb> SELECT FROM Account WHERE name LIKE 'tx%'
    2.  
    3. 0 item(s) found. Query executed in 0.037 sec(s).

For more information on other commands, see Console Commands.