Console - ROLLBACK

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

Syntax

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:

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

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

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

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

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

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

For more information on other commands, see Console Commands.

results matching ""

    No results matching ""