160ca2c69fede877a264b5b750dd635c87e6ae38
[clsql.git] / db-postgresql / postgresql-loader.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          postgresql-loader.sql
6 ;;;; Purpose:       PostgreSQL library loader using UFFI
7 ;;;; Programmer:    Kevin M. Rosenberg
8 ;;;; Date Started:  Feb 2002
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
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 #:pgsql)
20
21
22 (defvar *postgresql-supporting-libraries* '("crypt" "c")
23   "Used only by CMU. List of library flags needed to be passed to ld to
24 load the PostgresSQL client library succesfully.  If this differs at your site,
25 set to the right path before compiling or loading the system.")
26
27 (defvar *postgresql-library-loaded* nil
28   "T if foreign library was able to be loaded successfully")
29
30 (defmethod clsql-sys:database-type-library-loaded ((database-type
31                                                     (eql :postgresql)))
32   *postgresql-library-loaded*)
33
34 (defmethod clsql-sys:database-type-load-foreign ((database-type
35                                                   (eql :postgresql)))
36   (clsql-uffi:find-and-load-foreign-library "libpq"
37                                             :module "postgresql"
38                                             :supporting-libraries *postgresql-supporting-libraries*)
39   (setq *postgresql-library-loaded* t))
40
41 (clsql-sys:database-type-load-foreign :postgresql)
42