r9335: Automated commit for Debian build of clsql upstream-version-2.10.16
[clsql.git] / base / transaction.lisp
index 9a914551d74c0db051499fadcd1594708e5655c3..61438edf2a48be4f8edda77e5480a132cd92f7d5 100644 (file)
@@ -1,9 +1,18 @@
 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
 ;;;; *************************************************************************
 ;;;;
-;;;; $Id: transactions.lisp 7061 2003-09-07 06:34:45Z kevin $
+;;;; $Id$
+;;;;
+;;;; Transaction support
+;;;;
+;;;; This file is part of CLSQL.
+;;;;
+;;;; CLSQL users are granted the rights to distribute and use this software
+;;;; as governed by the terms of the Lisp Lesser GNU Public License
+;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
+;;;; *************************************************************************
 
-(in-package #:clsql-base-sys)
+(in-package #:clsql-base)
 
 (defclass transaction ()
   ((commit-hooks :initform () :accessor commit-hooks)
   (when (transaction database)
     (push rollback-hook (rollback-hooks (transaction database)))))
 
-(defmethod database-start-transaction ((database closed-database))
-  (signal-closed-database-error database))
-
 (defmethod database-start-transaction (database)
-  (unless database (error 'clsql-nodb-error))
+  (unless database (error 'clsql-no-database-error))
   (unless (transaction database)
     (setf (transaction database) (make-instance 'transaction)))
   (when (= (incf (transaction-level database) 1))
@@ -37,9 +43,6 @@
             (transaction-status transaction) nil)
       (execute-command "BEGIN" :database database))))
 
-(defmethod database-commit-transaction ((database closed-database))
-  (signal-closed-database-error database))
-
 (defmethod database-commit-transaction (database)
     (if (> (transaction-level database) 0)
         (when (zerop (decf (transaction-level database)))
@@ -49,9 +52,6 @@
               :format-control "Cannot commit transaction against ~A because there is no transaction in progress."
               :format-arguments (list database))))
 
-(defmethod database-abort-transaction ((database closed-database))
-  (signal-closed-database-error database))
-
 (defmethod database-abort-transaction (database)
     (if (> (transaction-level database) 0)
         (when (zerop (decf (transaction-level database)))
@@ -63,7 +63,7 @@
               :format-arguments (list database))))
 
 
-(defmacro with-transaction ((&key (database *default-database*)) &rest body)
+(defmacro with-transaction ((&key (database '*default-database*)) &rest body)
   "Executes BODY within a transaction for DATABASE (which defaults to
 *DEFAULT-DATABASE*). The transaction is committed if the body finishes
 successfully (without aborting or throwing), otherwise the database is