-
Notifications
You must be signed in to change notification settings - Fork 135
Transactions
Max De Marzi edited this page Sep 27, 2013
·
8 revisions
Begin a transaction:
@neo.begin_transaction # Begin a transaction
@neo.begin_transaction("start n=node(0) return n") # Begin a transaction with statements
Keep a transaction alive:
tx = @neo.begin_transaction
@neo.keep_transaction(tx) # Keep a transaction alive (extend timeout)
Add to a transaction:
@neo.in_transaction(tx, "start n=node(0) return n") # Add a statement to a transaction
@neo.in_transaction(tx, ["start n=node({id}) return n", # Add a statement to a transaction with
{:id => 0}]) # parameters
@neo.in_transaction(tx, ["start n=node({id}) return n", # Add statements to a transaction with
{:id => 0}, # parameters
"start n=node({id}) return n",
{:id => 1}])
Commit a transaction:
@neo.commit_transaction(tx) # Commit a transaction
@neo.commit_transaction("start n=node(0) return n") # Start and Commit a transaction
@neo.commit_transaction(["start n=node({id}) return n", # Start and Commit a transaction
:id => 0}]) # with a parameter
@neo.commit_transaction(tx, "start n=node(0) return n") # Commit a transaction with a new statement
@neo.commit_transaction(tx, ["start n=node({id}) return n", # Commit a transaction with a new statement
{:id => 0}]) # with parameters
@neo.commit_transaction(tx, ["start n=node({id}) return n", # Commit a transaction with new statements
{:id => 0}, # with parameters
"start n=node({id}) return n",
{:id => 1}])
Rollback a transaction:
@neo.rollback_transaction(tx) # Rollback a transaction