X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=interfaces%2Fpostgresql%2Fpostgresql-loader.cl;h=981f5b79aa2f63e3b79fc56112be3cc942b7bd88;hb=b4f641e256405778029888b10727095ce35055e0;hp=4db5fd426a63054a5e2b6f77075a191380d2fb3c;hpb=8213ff48f5362c3d4792444c929f50bd128bd044;p=clsql.git diff --git a/interfaces/postgresql/postgresql-loader.cl b/interfaces/postgresql/postgresql-loader.cl index 4db5fd4..981f5b7 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.1 2002/03/23 14:04:53 kevin Exp $ +;;;; $Id: postgresql-loader.cl,v 1.5 2002/04/06 19:54:14 kevin Exp $ ;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg ;;;; @@ -19,30 +19,31 @@ (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 load the PostgresSQL client library succesfully. If this differs at your site, set to the right path before compiling or loading the system.") -(defmethod database-type-load-foreign ((database-type (eql :postgresql))) - (uffi:load-foreign-library *postgresql-library-filename* - :module "postgresql" - :supporting-libraries - *postgresql-supporting-libraries*)) +(defvar *postgresql-library-loaded* nil + "T if foreign library was able to be loaded successfully") -(database-type-load-foreign :postgresql) +(defmethod clsql-sys:database-type-library-loaded ((database-type + (eql :postgresql))) + *postgresql-library-loaded*) + +(defmethod clsql-sys:database-type-load-foreign ((database-type + (eql :postgresql))) + (when + (uffi:load-foreign-library + (uffi:find-foreign-library "libpq" + '("/opt/postgresql/lib/" "/usr/local/lib/" + "/usr/lib/" "/postgresql/lib/") + :drive-letters '("C" "D" "E")) + + :module "postgresql" + :supporting-libraries + *postgresql-supporting-libraries*) + (setq *postgresql-library-loaded* t))) + +(clsql-sys:database-type-load-foreign :postgresql)