X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=base%2Fclasses.lisp;h=32f48a7e4d07c3fc844a3f7c8b295a36ddaf6683;hb=2ae9ee745ff9e17806178e1999b880acc64ab894;hp=26655d8668f1833d3887435e864f9ae07827fc9b;hpb=43ec897ec7d84892fa59cc9b7858ce23d64a8a1a;p=clsql.git diff --git a/base/classes.lisp b/base/classes.lisp index 26655d8..32f48a7 100644 --- a/base/classes.lisp +++ b/base/classes.lisp @@ -2,7 +2,7 @@ ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; -;;;; Name: classes.cl +;;;; Name: classes.lisp ;;;; Purpose: Classes for High-level SQL interface ;;;; Programmers: Kevin M. Rosenberg based on ;;;; original code by Pierre R. Mai @@ -10,7 +10,7 @@ ;;;; ;;;; $Id$ ;;;; -;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg +;;;; This file, part of CLSQL, is Copyright (c) 2002-2004 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 @@ -18,8 +18,7 @@ ;;;; (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-base-sys) +(in-package #:clsql-base-sys) (defclass database () @@ -27,8 +26,12 @@ (connection-spec :initform nil :initarg :connection-spec :reader connection-spec :documentation "Require to use connection pool") + (database-type :initarg :database-type :reader database-type + :initform :unknown) + (state :initform :closed :reader database-state) (command-recording-stream :accessor command-recording-stream :initform nil) (result-recording-stream :accessor result-recording-stream :initform nil) + (query-recording-stream :accessor query-recording-stream :initform nil) (view-classes :accessor database-view-classes :initform nil) (schema :accessor database-schema :initform nil) (transaction-level :initform 0 :accessor transaction-level) @@ -39,22 +42,9 @@ (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) - "") - stream))) - -;; Closed database idea and original code comes from UncommonSQL - -(defclass closed-database () - ((name :initarg :name :reader database-name)) - (:documentation - "This class represents 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) - "") - stream))) + (format stream "~A ~A" + (if (slot-boundp object 'name) + (database-name object) + "") + (database-state object))))