X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-oracle%2Foracle-loader.lisp;h=f1493d3a1a585fb0d8c2d103d92a590f5d13b4c0;hp=d9259e0ad9213b22acc3ca833784ba354b18e5c2;hb=da9282a5c0ce927c613f1706f1c51796c75e16e4;hpb=2a595b27aefd54e9425548f9dd8e303c5bbd5cd4 diff --git a/db-oracle/oracle-loader.lisp b/db-oracle/oracle-loader.lisp index d9259e0..f1493d3 100644 --- a/db-oracle/oracle-loader.lisp +++ b/db-oracle/oracle-loader.lisp @@ -5,8 +5,6 @@ ;;;; Name: oracle-loader.lisp ;;;; Purpose: Foreign library loader for CLSQL Oracle interface ;;;; -;;;; $Id$ -;;;; ;;;; This file is part of CLSQL. ;;;; ;;;; CLSQL users are granted the rights to distribute and use this software @@ -16,27 +14,14 @@ (in-package #:clsql-oracle) -(defparameter *oracle-lib-path* - (let ((oracle-home (getenv "ORACLE_HOME"))) - (when oracle-home - (make-pathname :directory - (append - (pathname-directory - (parse-namestring (concatenate 'string oracle-home "/"))) - (list "lib")))))) - -(defparameter *clsql-oracle-library-path* - (uffi:find-foreign-library - '("libclntsh" "oracle") - `(,@(when *load-truename* (list (make-pathname :directory (pathname-directory *load-truename*)))) - ,@(when *oracle-lib-path* (list *oracle-lib-path*)) - "/9i/lib/" - "/usr/lib/clsql/" - "/sw/lib/clsql/" - "/home/kevin/debian/src/clsql/db-oracle/") - :drive-letters '("C"))) +(defparameter *oracle-home* + (let ((oracle-home (getenv "ORACLE_HOME"))) + (when oracle-home + (parse-namestring (concatenate 'string oracle-home "/")))) + "Pathname of ORACLE_HOME as set in user environment.") -(defvar *oracle-library-candidate-drive-letters* '("C" "D" "E")) +(defparameter *oracle-client-library-filenames* + (list "libclntsh" "oci")) (defvar *oracle-supporting-libraries* '("c") "Used only by CMU. List of library flags needed to be passed to ld to @@ -49,18 +34,20 @@ set to the right path before compiling or loading the system.") (defmethod clsql-sys:database-type-library-loaded ((database-type (eql :oracle))) *oracle-library-loaded*) -(setf *oracle-lib-path* #p"/usr/lib/oracle/10.1.0.2/client/lib/") - (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :oracle))) - #+ignore - (uffi:load-foreign-library - (make-pathname :defaults *oracle-lib-path* :name "libclntsh" :type "so")) - (uffi:load-foreign-library *clsql-oracle-library-path* - :module "clsql-oracle" - :supporting-libraries *oracle-supporting-libraries*) + (when *oracle-home* + (dolist (dir-name '("lib" "bin")) + (dolist (lib-name '("libclntsh" "oci")) + (clsql:push-library-path + (make-pathname :name lib-name + :directory (append (pathname-directory *oracle-home*) + (list dir-name))))))) + + (clsql-uffi:find-and-load-foreign-library *oracle-client-library-filenames* + :module "clsql-oracle" + :supporting-libraries *oracle-supporting-libraries*) (setq *oracle-library-loaded* t)) - (clsql-sys:database-type-load-foreign :oracle)