r10575: 09 Jun 2005 Kevin Rosenberg <kevin@rosenberg.net>
[clsql.git] / db-sqlite3 / sqlite3-loader.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          sqlite3-loader.lisp
6 ;;;; Purpose:       Sqlite3 library loader using UFFI
7 ;;;; Programmer:    Aurelio Bignoli
8 ;;;; Date Started:  Oct 2004
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of CLSQL, is Copyright (c) 2004 by Aurelio Bignoli
13 ;;;;
14 ;;;; CLSQL users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
18
19 (in-package #:clsql-sqlite3)
20
21 (defvar *sqlite3-supporting-libraries* '("c")
22   "Used only by CMU. List of library flags needed to be passed to ld
23 to load the Sqlite3 library succesfully.  If this differs at your site,
24 set to the right path before compiling or loading the system.")
25
26 (defvar *sqlite3-library-loaded* nil
27   "T if foreign library was able to be loaded successfully")
28
29 (defmethod database-type-library-loaded ((database-type (eql :sqlite3)))
30   "T if foreign library was able to be loaded successfully. "
31   *sqlite3-library-loaded*)
32
33 (defmethod database-type-load-foreign ((database-type (eql :sqlite3)))
34   (clsql-uffi:find-and-load-foreign-library '("libsqlite3" "sqlite3")
35                                             :module "sqlite3"
36                                             :supporting-libraries *sqlite3-supporting-libraries*)
37   (setq *sqlite3-library-loaded* t))
38
39 (clsql-sys:database-type-load-foreign :sqlite3)