define-in-transaction added by andyjpb on Thu Jul 12 16:50:08 2018

(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)))))))