r1798: Initial support for pooled connections
[clsql.git] / sql / classes.cl
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: classes.cl,v 1.2 2002/04/27 20:58:11 kevin Exp $
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-sys)
23
24
25 (defclass database ()
26   ((name :initarg :name :reader database-name)
27    (connection-spec :initarg :connection-spec :reader connection-spec
28                     :documentation "Require to use connection pool"))
29   (:documentation
30    "This class is the supertype of all databases handled by CLSQL."))
31
32 (defmethod print-object ((object database) stream)
33   (print-unreadable-object (object stream :type t :identity t)
34     (write-string (if (slot-boundp object 'name)
35                       (database-name object)
36                       "<unbound>")
37                   stream)))
38
39
40 (defclass closed-database ()
41   ((name :initarg :name :reader database-name))
42   (:documentation
43    "This class represents all databases after they are closed via
44 `disconnect'."))
45
46 (defmethod print-object ((object closed-database) stream)
47   (print-unreadable-object (object stream :type t :identity t)
48     (write-string (if (slot-boundp object 'name)
49                       (database-name object)
50                       "<unbound>")
51                   stream)))
52