(setf (transaction database)
(make-instance 'transaction :previous-autocommit
(database-autocommit database))))
+ ;; TODO: database-autocommit might get lost in some scenarios
+ ;; when pooling connections
(setf (database-autocommit database) nil)
(when (= (incf (transaction-level database)) 1)
(let ((transaction (transaction database)))
(:mssql (execute-command "BEGIN TRANSACTION" :database database))
(t (execute-command "BEGIN" :database database))))))
-;;ODBC should potentially be using it's scheme for transactions:
+;;ODBC should potentially be using the following scheme for transactions:
;; turn off autocommit for begin. then use sqlendtran (or maybe sqltransact)
;; whatever is appropriate for this version of odbc.
(defmethod database-commit-transaction ((database database))
(not (transaction-status (transaction database))))
(setf (transaction-status (transaction database)) :committed)))
-(defmacro with-transaction ((&key (database '*default-database*)) &rest body)
+(defmacro with-transaction ((&key (database '*default-database*)) &body body)
"Starts a transaction in the database specified by DATABASE,
which is *DEFAULT-DATABASE* by default, and executes BODY within
that transaction. If BODY aborts or throws, DATABASE is rolled