r1697: *** empty log message ***
authorKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 29 Mar 2002 08:13:02 +0000 (08:13 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Fri, 29 Mar 2002 08:13:02 +0000 (08:13 +0000)
VERSION
clsql.system
sql/classes.cl [new file with mode: 0644]
sql/conditions.cl
sql/db-interface.cl
sql/sql.cl

diff --git a/VERSION b/VERSION
index 4f7397e468d60b5bb78cbbca36f1707d037ef001..48aed105721f87516340b181d27b34e492c13311 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,3 +1,4 @@
-0.6.0
+0.6.1
+
 
 
index 52c55fd513f066f78a27d309a546e84c9e389dd7..867d69b9af5e15736c3d296ce45f05e392002f58 100644 (file)
@@ -7,7 +7,7 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: clsql.system,v 1.3 2002/03/29 07:42:10 kevin Exp $
+;;;; $Id: clsql.system,v 1.4 2002/03/29 08:12:15 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;;
@@ -37,7 +37,8 @@
     :source-extension "cl"
     :binary-pathname "CLSQL:sql;bin;"
     :components ((:file "package")
-                (:file "conditions" :depends-on ("package"))
+                (:file "classes")
+                (:file "conditions" :depends-on ("classes"))
                 (:file "db-interface" :depends-on ("conditions"))
                 (:file "sql" :depends-on ("db-interface"))
                 (:file "utils" :depends-on ("package"))
diff --git a/sql/classes.cl b/sql/classes.cl
new file mode 100644 (file)
index 0000000..8ba8c26
--- /dev/null
@@ -0,0 +1,50 @@
+;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
+;;;; *************************************************************************
+;;;; FILE IDENTIFICATION
+;;;;
+;;;; Name:          classes.cl
+;;;; Purpose:       Classes for High-level SQL interface
+;;;; Programmers:   Kevin M. Rosenberg based on
+;;;;                 Original code by Pierre R. Mai 
+;;;; Date Started:  Feb 2002
+;;;;
+;;;; $Id: classes.cl,v 1.1 2002/03/29 08:13:02 kevin Exp $
+;;;;
+;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
+;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
+;;;;
+;;;; 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.
+;;;; *************************************************************************
+
+(declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
+(in-package :clsql-sys)
+
+
+(defclass database ()
+  ((name :initarg :name :reader database-name))
+  (:documentation
+   "This class is the supertype of all databases handled by CLSQL."))
+
+(defmethod print-object ((object database) stream)
+  (print-unreadable-object (object stream :type t :identity t)
+    (write-string (if (slot-boundp object 'name)
+                     (database-name object)
+                     "<unbound>")
+                 stream)))
+
+
+(defclass closed-database ()
+  ((name :initarg :name :reader database-name))
+  (:documentation
+   "This class represents all databases after they are closed via
+`disconnect'."))
+
+(defmethod print-object ((object closed-database) stream)
+  (print-unreadable-object (object stream :type t :identity t)
+    (write-string (if (slot-boundp object 'name)
+                     (database-name object)
+                     "<unbound>")
+                 stream)))
+
index af6822cafccc2a5444fe456584a4eaaebc0d8b68..c669cddc059fe6e07d861fdbdda0990bb49f3e01 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                 Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: conditions.cl,v 1.1 2002/03/29 07:42:10 kevin Exp $
+;;;; $Id: conditions.cl,v 1.2 2002/03/29 08:12:16 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -138,3 +138,23 @@ although there is an existing connection (~A)."
             (format stream "The database ~A has already been closed."
                     (clsql-closed-error-database c)))))
 
+(define-condition clsql-nodb-error (clsql-error)
+  ((database :initarg :database :reader clsql-nodb-error-database))
+  (:report (lambda (c stream)
+            (format stream "No such database ~S is open." 
+                    (clsql-nodb-error-database c)))))
+
+
+;; Signal conditions
+
+
+(defun signal-closed-database-error (database)
+  (cerror "Ignore this error and return nil."
+         'clsql-closed-error
+         :database database))
+
+(defun signal-nodb-error (database)
+  (cerror "Ignore this error and return nil."
+         'clsql-nodb-error
+         :database database))
+
index 5f4f805c7da8eaf23727505cf6d001e2325c54cc..ca6a5159ef25cf3a66571e3386220c956f470188 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                 Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: db-interface.cl,v 1.1 2002/03/29 07:42:10 kevin Exp $
+;;;; $Id: db-interface.cl,v 1.2 2002/03/29 08:12:16 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -48,12 +48,17 @@ was called with the connection-spec."))
 (defgeneric database-disconnect (database)
   (:method ((database closed-database))
           (signal-closed-database-error database))
+  (:method ((database t))
+          (signal-nodb-error database))
   (:documentation "Internal generic implementation of disconnect."))
 
 (defgeneric database-query (query-expression database types)
   (:method (query-expression (database closed-database) types)
           (declare (ignore query-expression types))
-          (signal-closed-database-error database))
+          (signal-closed-database-error database))  
+  (:method (query-expression (database t) types)
+          (declare (ignore query-expression types))
+          (signal-nodb-error database))
   (:documentation "Internal generic implementation of query."))
 
 
@@ -61,6 +66,9 @@ was called with the connection-spec."))
   (:method (sql-expression (database closed-database))
           (declare (ignore sql-expression))
           (signal-closed-database-error database))
+  (:method (sql-expression (database t))
+          (declare (ignore sql-expression))
+          (signal-nodb-error database))
   (:documentation "Internal generic implementation of execute-command."))
 
 ;;; Mapping and iteration
@@ -70,6 +78,10 @@ was called with the connection-spec."))
           (declare (ignore query-expression full-set types))
           (signal-closed-database-error database)
           (values nil nil nil))
+  (:method (query-expression (database t) &key full-set types)
+          (declare (ignore query-expression full-set types))
+          (signal-nodb-error database)
+          (values nil nil nil))
   (:documentation
    "Internal generic implementation of query mapping.  Starts the
 query specified by query-expression on the given database and returns
@@ -89,12 +101,18 @@ function should signal a clsql-sql-error."))
   (:method (result-set (database closed-database))
           (declare (ignore result-set))
           (signal-closed-database-error database))
+  (:method (result-set (database t))
+          (declare (ignore result-set))
+          (signal-nodb-error database))
   (:documentation "Dumps the received result-set."))
 
 (defgeneric database-store-next-row (result-set database list)
   (:method (result-set (database closed-database) list)
           (declare (ignore result-set list))
           (signal-closed-database-error database))
+  (:method (result-set (database t) list)
+          (declare (ignore result-set list))
+          (signal-nodb-error database))
   (:documentation
    "Returns t and stores the next row in the result set in list or
 returns nil when result-set is finished."))
index 2d8ab3f239e6aac3035173992c0ab426b9d2f77e..529925dfed98a1600b28ad67b5c28892a0cf3a41 100644 (file)
@@ -8,7 +8,7 @@
 ;;;;                 Original code by Pierre R. Mai 
 ;;;; Date Started:  Feb 2002
 ;;;;
-;;;; $Id: sql.cl,v 1.8 2002/03/29 07:42:10 kevin Exp $
+;;;; $Id: sql.cl,v 1.9 2002/03/29 08:12:16 kevin Exp $
 ;;;;
 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
@@ -73,35 +73,7 @@ initialized, as indicated by `*initialized-database-types*'."
 (defvar *default-database* nil
   "Specifies the default database to be used.")
 
-(defclass database ()
-  ((name :initarg :name :reader database-name))
-  (:documentation
-   "This class is the supertype of all databases handled by CLSQL."))
-
-(defmethod print-object ((object database) stream)
-  (print-unreadable-object (object stream :type t :identity t)
-    (write-string (if (slot-boundp object 'name)
-                     (database-name object)
-                     "<unbound>")
-                 stream)))
-
-(defclass closed-database ()
-  ((name :initarg :name :reader database-name))
-  (:documentation
-   "This class represents all databases after they are closed via
-`disconnect'."))
-
-(defmethod print-object ((object closed-database) stream)
-  (print-unreadable-object (object stream :type t :identity t)
-    (write-string (if (slot-boundp object 'name)
-                     (database-name object)
-                     "<unbound>")
-                 stream)))
-
-(defun signal-closed-database-error (database)
-  (cerror "Ignore this error and return nil."
-         'clsql-closed-error
-         :database database))
+
 
 (defun find-database (database &optional (errorp t))
   (etypecase database