1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
5 ;;;; Name: initialize.cl
6 ;;;; Purpose: Initializion routines for backend
7 ;;;; Programmers: Kevin M. Rosenberg
8 ;;;; Date Started: May 2002
10 ;;;; $Id: initialize.lisp,v 1.2 2002/10/16 11:51:04 kevin Exp $
12 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
13 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
15 ;;;; CLSQL users are granted the rights to distribute and use this software
16 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
17 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
18 ;;;; *************************************************************************
20 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
21 (in-package :clsql-base-sys)
23 (defvar *loaded-database-types* nil
24 "Contains a list of database types which have been defined/loaded.")
26 (defmethod database-type-load-foreign (x)
27 (error "No generic function defined for database-type-load-foreign with parameters of %S" x))
29 (defmethod database-type-load-foreign :after (database-type)
30 (when (database-type-library-loaded database-type)
31 (pushnew database-type *loaded-database-types*)))
33 (defun reload-database-types ()
34 "Reloads any foreign code for the loaded database types after a dump."
35 (mapc #'database-type-load-foreign *loaded-database-types*))
37 (defvar *default-database-type* nil
38 "Specifies the default type of database. Currently only :mysql is
41 (defvar *initialized-database-types* nil
42 "Contains a list of database types which have been initialized by calls
43 to initialize-database-type.")
45 (defun initialize-database-type (&key (database-type *default-database-type*))
46 "Initialize the given database-type, if it is not already
47 initialized, as indicated by `*initialized-database-types*'."
48 (if (member database-type *initialized-database-types*)
50 (when (database-initialize-database-type database-type)
51 (push database-type *initialized-database-types*)