1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
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
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
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 ;;;; *************************************************************************
21 (in-package #:clsql-sys
)
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 (autocommit :initform t
:accessor database-autocommit
)
33 (command-recording-stream :accessor command-recording-stream
:initform nil
)
34 (result-recording-stream :accessor result-recording-stream
:initform nil
)
35 (record-caches :accessor record-caches
:initform nil
)
36 (view-classes :accessor database-view-classes
:initform nil
)
37 (transaction-level :initform
0 :accessor transaction-level
)
38 (transaction :initform nil
:accessor transaction
)
39 (conn-pool :initform nil
:initarg
:conn-pool
:accessor conn-pool
)
40 (attribute-cache :initform
(make-hash-table :size
100 :test
'equal
)
41 :accessor attribute-cache
42 :documentation
"Internal cache of table attributes. It is keyed by table-name. Values
43 are a list of ACTION specified for table and any cached value of list-attributes-types."))
45 "This class is the supertype of all databases handled by CLSQL."))
47 (defmethod print-object ((object database
) stream
)
48 (print-unreadable-object (object stream
:type t
:identity t
)
49 (format stream
"~A ~A"
50 (if (slot-boundp object
'name
)
51 (database-name object
)
53 (database-state object
)))
56 (setf (documentation 'database-name
'function
)
57 "Returns the name of a database.")