X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=interfaces%2Fpostgresql%2Fpostgresql-loader.cl;h=30cff4f813112d4a548a57a12d9f43ea1091a7e7;hb=72ec381271fe5f7839d356d26e0716625e3246e9;hp=a2b7988c7bb1513f02850a933c7689bf0b314210;hpb=9a78eef71c902d3b272fb7c777bff6dd0acd8a2b;p=clsql.git diff --git a/interfaces/postgresql/postgresql-loader.cl b/interfaces/postgresql/postgresql-loader.cl index a2b7988..30cff4f 100644 --- a/interfaces/postgresql/postgresql-loader.cl +++ b/interfaces/postgresql/postgresql-loader.cl @@ -7,7 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: Feb 2002 ;;;; -;;;; $Id: postgresql-loader.cl,v 1.2 2002/03/24 04:01:26 kevin Exp $ +;;;; $Id: postgresql-loader.cl,v 1.7 2002/05/13 22:05:21 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -19,20 +19,6 @@ (declaim (optimize (debug 3) (speed 3) (safety 1) (compilation-speed 0))) (in-package :postgresql) -(defvar *postgresql-library-filename* - (cond - ((probe-file "/opt/postgresql/lib/libpq.so") - "/opt/postgresql/lib/libpq.so") - ((probe-file "/usr/local/lib/libpq.so") - "/usr/local/lib/libpq.so") - ((probe-file "/usr/lib/libpq.so") - "/usr/lib/libpq.so") - #+(or win32 mswindows) - ((probe-file "c:/postgresql/lib/libpq.dll") - "c:/postgresql/lib/libpq.dll") - (t - (warn "Can't find PostgresQL client library to load."))) - "Location where the PostgresSQL client library is to be found.") (defvar *postgresql-supporting-libraries* '("crypt" "c") "Used only by CMU. List of library flags needed to be passed to ld to @@ -42,15 +28,27 @@ set to the right path before compiling or loading the system.") (defvar *postgresql-library-loaded* nil "T if foreign library was able to be loaded successfully") -(defmethod database-type-library-loaded ((database-type (eql :postgresql))) +(defmethod clsql-sys:database-type-library-loaded ((database-type + (eql :postgresql))) *postgresql-library-loaded*) -(defmethod database-type-load-foreign ((database-type (eql :postgresql))) +(defmethod clsql-sys:database-type-load-foreign ((database-type + (eql :postgresql))) (when - (uffi:load-foreign-library *postgresql-library-filename* - :module "postgresql" - :supporting-libraries - *postgresql-supporting-libraries*) + (uffi:load-foreign-library + (uffi:find-foreign-library "libpq" + '("/opt/postgresql/lib/" "/usr/local/lib/" + "/usr/lib/" "/postgresql/lib/" + "/usr/local/pgsql/lib/" "/usr/lib/pgsql/" + "/opt/pgsql/lib/pgsql") + :drive-letters '("C" "D" "E")) + + :module "postgresql" + :supporting-libraries + *postgresql-supporting-libraries*) (setq *postgresql-library-loaded* t))) -(database-type-load-foreign :postgresql) +(clsql-sys:database-type-load-foreign :postgresql) +(when (clsql-sys:database-type-library-loaded :postgresql) + (clsql-sys:initialize-database-type :database-type :postgresql) + (pushnew :postgresql cl:*features*))