命令 - COMMIT
关闭事务,提交所有变更。使用BEGIN开启事务,ROLLBACK回退到打开事务的状态。
更多信息,参考事务.
语法
COMMIT
例子
初始化一个事务,使用
BEGIN命令:orientdb>BEGINTransaction 2 is running尝试开启另一个事务:
orientdb>BEGINError: an active transaction is currently open (id=2). Commit or rollback before starting a new one.插入数据
Account, 使用INSERT:orientdb>INSERT INTO Account (name) VALUES ('tx test')Inserted record 'Account#9:-2{name:tx test} v0' in 0,000000 sec(s).提交事务:
orientdb>COMMITTransaction 2 has been committed in 4ms展示新内容,使用
SELECT查询:orientdb>SELECT FROM Account WHERE name LIKE 'tx%'---+---------+---------- # | RID | name ---+---------+---------- 0 | #9:1107 | tx test ---+---------+---------- 1 item(s) found. Query executed in 0.041 sec(s).
事务开启后,所有记录有临时的负数的RID。提交后,会生成永久的正数的RID。
更多信息,参考