(define-syntax define-in-transaction (syntax-rules () ((define-in-transaction signature exp exp* ...) (define signature (let ((body (lambda () exp exp* ...))) (if (internal-call?) (begin (assert (eq? #f (autocommit? (db-ctx))) (conc "define-in-transaction: Internal calls to API procedures must already be inside a transaction by we are not!")) (with-savepoint-transaction (db-ctx) body)) (with-transaction (db-ctx) body)))))))