r9335: Automated commit for Debian build of clsql upstream-version-2.10.16
[clsql.git] / base / initialize.lisp
index ffa08b29d7331fe6bb2a94d12c823bc57e0f1a12..32115123b7a9887b685d4da32dc7c435c5e2ffc2 100644 (file)
@@ -2,14 +2,14 @@
 ;;;; *************************************************************************
 ;;;; FILE IDENTIFICATION
 ;;;;
-;;;; Name:          initialize.cl
+;;;; Name:          initialize.lisp
 ;;;; Purpose:       Initializion routines for backend
 ;;;; Programmers:   Kevin M. Rosenberg 
 ;;;; Date Started:  May 2002
 ;;;;
 ;;;; $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
@@ -17,8 +17,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)
 
 (defvar *loaded-database-types* nil
   "Contains a list of database types which have been defined/loaded.")
@@ -44,10 +43,16 @@ to initialize-database-type.")
 (defun initialize-database-type (&key (database-type *default-database-type*))
   "Initialize the given database-type, if it is not already
 initialized, as indicated by `*initialized-database-types*'."
-  (if (member database-type *initialized-database-types*)
-      t
-      (when (database-initialize-database-type database-type)
-       (push database-type *initialized-database-types*)
-       t)))
-
+  (when (member database-type *initialized-database-types*)
+    (return-from initialize-database-type database-type))
+  
+  (let ((system (intern (concatenate 'string 
+                         (symbol-name '#:clsql-)
+                         (symbol-name database-type)))))
+    (when (not (find-package system))
+      (asdf:operate 'asdf:load-op system)))
+  
+  (when (database-initialize-database-type database-type)
+    (push database-type *initialized-database-types*)
+    database-type))