Transaction management functions (Neo4J 2.0+ only).
Transaction management functions (Neo4J 2.0+ only).
(begin connection)
(begin connection xs)
Starts a transaction with the given cypher statements and returns a transaction record along with the result of the cypher statements. 0-arity function call starts a transaction without any cypher statements.
For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-begin-a-transaction
Starts a transaction with the given cypher statements and returns a transaction record along with the result of the cypher statements. 0-arity function call starts a transaction without any cypher statements. For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-begin-a-transaction
(begin-tx connection)
Starts a transaction without any cypher statements and returns it.
Starts a transaction without any cypher statements and returns it.
(commit connection transaction)
(commit connection transaction xs)
Commits an existing transaction with optional cypher statements which are applied before the transaction is committed. It returns the result of the cypher statements.
For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-commit-an-open-transaction
Commits an existing transaction with optional cypher statements which are applied before the transaction is committed. It returns the result of the cypher statements. For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-commit-an-open-transaction
(execute connection transaction)
(execute connection transaction xs)
Executes cypher statements in an existing transaction and returns the new transaction record along with the cypher results. If no cypher statements are give, the effect is to keep the transaction alive (prevent it from timing out).
For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-execute-statements-in-an-open-transaction
Executes cypher statements in an existing transaction and returns the new transaction record along with the cypher results. If no cypher statements are give, the effect is to keep the transaction alive (prevent it from timing out). For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-execute-statements-in-an-open-transaction
(in-transaction connection & coll)
It takes multiple statements and starts a transaction and commits them in a single HTTP request.
For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-begin-and-commit-a-transaction-in-one-request
A simple example is given below:
(tx/in-transaction connection (tx/statement "CREATE (n {props}) RETURN n" {:props {:name "My Node"}}) (tx/statement "CREATE (n {props}) RETURN n" {:props {:name "My Another Node"}}))
It takes multiple statements and starts a transaction and commits them in a single HTTP request. For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-begin-and-commit-a-transaction-in-one-request A simple example is given below: (tx/in-transaction connection (tx/statement "CREATE (n {props}) RETURN n" {:props {:name "My Node"}}) (tx/statement "CREATE (n {props}) RETURN n" {:props {:name "My Another Node"}}))
(rollback connection transaction)
Rolls back an existing transaction.
For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-rollback-an-open-transaction
Rolls back an existing transaction. For more information, see http://docs.neo4j.org/chunked/milestone/rest-api-transactional.html#rest-api-rollback-an-open-transaction
(statement query)
(statement query parameters)
(statement query parameters result-data-contents)
Populates a Cypher statement to be sent as part of a transaction.
Populates a Cypher statement to be sent as part of a transaction.
(with-transaction connection transaction commit-on-success? & body)
A basic macro which gives a fine grained control of working in a transaction without manually committing or checking for exceptions.
If commit-on-success? is true, then the given transaction is committed on success. Else the user is responsible for manually committing/rolling back the transaction. At any stage if there is an error, the transaction is rolled back if necessary.
A simple example is given below:
(let [transaction (tx/begin-tx connection)] (tx/with-transaction connection transaction true (let [[_ result] (tx/execute connection transaction [(tx/statement "CREATE (n) RETURN ID(n)")])] (println result))))
A basic macro which gives a fine grained control of working in a transaction without manually committing or checking for exceptions. If commit-on-success? is true, then the given transaction is committed on success. Else the user is responsible for manually committing/rolling back the transaction. At any stage if there is an error, the transaction is rolled back if necessary. A simple example is given below: (let [transaction (tx/begin-tx connection)] (tx/with-transaction connection transaction true (let [[_ result] (tx/execute connection transaction [(tx/statement "CREATE (n) RETURN ID(n)")])] (println result))))
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close