1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
5 ;;;; Name: postgresql-loader.sql
6 ;;;; Purpose: PostgreSQL library loader using UFFI
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: Feb 2002
10 ;;;; $Id: postgresql-loader.cl,v 1.11 2002/05/18 17:37:49 kevin Exp $
12 ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
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 ;;;; *************************************************************************
19 (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0)))
20 (in-package :postgresql)
23 (defvar *postgresql-supporting-libraries* '("crypt" "c")
24 "Used only by CMU. List of library flags needed to be passed to ld to
25 load the PostgresSQL client library succesfully. If this differs at your site,
26 set to the right path before compiling or loading the system.")
28 (defvar *postgresql-library-loaded* nil
29 "T if foreign library was able to be loaded successfully")
31 (defmethod clsql-sys:database-type-library-loaded ((database-type
33 *postgresql-library-loaded*)
35 (defmethod clsql-sys:database-type-load-foreign ((database-type
37 (let ((libpath (uffi:find-foreign-library
39 '("/opt/postgresql/lib/" "/usr/local/lib/"
40 "/usr/lib/" "/postgresql/lib/"
41 "/usr/local/pgsql/lib/" "/usr/lib/pgsql/"
42 "/opt/pgsql/lib/pgsql")
43 :drive-letters '("C" "D" "E"))))
44 (if (uffi:load-foreign-library libpath
47 *postgresql-supporting-libraries*)
48 (setq *postgresql-library-loaded* t)
49 (warn "Can't load PostgreSQL client library ~A" libpath))))
51 (clsql-sys:database-type-load-foreign :postgresql)