r7061: initial property settings
[clsql.git] / base / classes.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          classes.cl
6 ;;;; Purpose:       Classes for High-level SQL interface
7 ;;;; Programmers:   Kevin M. Rosenberg based on
8 ;;;;                 original code by Pierre R. Mai 
9 ;;;; Date Started:  Feb 2002
10 ;;;;
11 ;;;; $Id$
12 ;;;;
13 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
14 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
15 ;;;;
16 ;;;; CLSQL users are granted the rights to distribute and use this software
17 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
18 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
19 ;;;; *************************************************************************
20
21 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
22 (in-package :clsql-base-sys)
23
24
25 (defclass database ()
26   ((name :initform nil :initarg :name :reader database-name)
27    (connection-spec :initform nil :initarg :connection-spec :reader connection-spec
28                     :documentation "Require to use connection pool")
29    (transaction-level :initform 0 :accessor transaction-level)
30    (transaction :initform nil :accessor transaction)
31    (conn-pool :initform nil :initarg :conn-pool :accessor conn-pool))
32   (:documentation
33    "This class is the supertype of all databases handled by CLSQL."))
34
35 (defmethod print-object ((object database) stream)
36   (print-unreadable-object (object stream :type t :identity t)
37     (write-string (if (slot-boundp object 'name)
38                       (database-name object)
39                       "<unbound>")
40                   stream)))
41
42 ;; Closed database idea and original code comes from UncommonSQL
43
44 (defclass closed-database ()
45   ((name :initarg :name :reader database-name))
46   (:documentation
47    "This class represents databases after they are closed via 'disconnect'."))
48
49 (defmethod print-object ((object closed-database) stream)
50   (print-unreadable-object (object stream :type t :identity t)
51     (write-string (if (slot-boundp object 'name)
52                       (database-name object)
53                       "<unbound>")
54                   stream)))
55