(defmacro with-txn ((txn-var env &key parent txn
no-sync not-durable no-wait sync)
&body body)
(once-only (env txn parent no-sync not-durable no-wait sync)
`(let ((,txn-var (if ,txn
,txn
(db-env-txn-begin ,env
:parent ,parent
:no-sync ,no-sync
:not-durable ,not-durable
:no-wait ,no-wait
:sync ,sync))))
(in-txn (,txn-var :no-sync ,no-sync
:sync ,sync
:do-commit (null ,txn))
,@body))))Source Context