added with-transaction

This commit is contained in:
eknauel 2004-11-15 14:09:48 +00:00
parent dcce8de4de
commit bba2de6fae
1 changed files with 8 additions and 2 deletions

View File

@ -41,15 +41,21 @@
(define (with-database-flags flags thunk) (define (with-database-flags flags thunk)
(let-fluid $current-flags flags thunk)) (let-fluid $current-flags flags thunk))
(define (as-transaction options proc) (define (as-transaction db-env flags proc)
(let-fluid (let-fluid
$current-transaction-id $current-transaction-id
(begin-transaction options) (begin-transaction db-env flags)
(lambda () (lambda ()
(proc (lambda () (proc (lambda ()
(abort-transaction (current-transaction-id)))) (abort-transaction (current-transaction-id))))
(commit-transaction (current-transaction-id))))) (commit-transaction (current-transaction-id)))))
(define (with-transaction transaction proc)
(let-fluid
$current-transaction-id
transaction
proc))
;; constants ;; constants
(define (berkeley-db-version) (define (berkeley-db-version)