r9456: relax type for server-version
[clsql.git] / sql / base-classes.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          classes.lisp
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-2004 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 (in-package #:clsql-sys)
22
23
24 (defclass database ()
25   ((name :initform nil :initarg :name :reader database-name)
26    (connection-spec :initform nil :initarg :connection-spec
27                     :reader connection-spec
28                     :documentation "Require to use connection pool")
29    (database-type :initarg :database-type :initform :unknown
30                   :reader database-type)
31    (state :initform :closed :reader database-state)
32    (command-recording-stream :accessor command-recording-stream :initform nil)
33    (result-recording-stream :accessor result-recording-stream :initform nil)
34    (record-caches :accessor record-caches :initform nil)
35    (view-classes :accessor database-view-classes :initform nil)
36    (transaction-level :initform 0 :accessor transaction-level)
37    (transaction :initform nil :accessor transaction)
38    (conn-pool :initform nil :initarg :conn-pool :accessor conn-pool)
39    (attribute-cache :initform (make-hash-table :size 100 :test 'equal) 
40                     :accessor attribute-cache
41                     :documentation "Internal cache of table attributes. It is keyed by table-name. Values
42 are a list of ACTION specified for table and any cached value of list-attributes-types."))
43   (:documentation
44    "This class is the supertype of all databases handled by CLSQL."))
45
46 (defmethod print-object ((object database) stream)
47   (print-unreadable-object (object stream :type t :identity t)
48     (format stream "~A ~A"
49             (if (slot-boundp object 'name)
50                 (database-name object)
51               "<unbound>")
52             (database-state object))))
53
54