r9475: testing new oracle library lookup
authorKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 25 May 2004 08:26:43 +0000 (08:26 +0000)
committerKevin M. Rosenberg <kevin@rosenberg.net>
Tue, 25 May 2004 08:26:43 +0000 (08:26 +0000)
db-oracle/oracle-loader.lisp

index 0af49cc..d9259e0 100644 (file)
 
 (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
-   "oracle"
-   `(,(make-pathname :directory (pathname-directory *load-truename*))
-     "/9i/lib/"
-     "/usr/lib/clsql/"
-     "/sw/lib/clsql/"
-     "/home/kevin/debian/src/clsql/db-oracle/")
-   :drive-letters '("C")))
+    (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")))
 
 (defvar *oracle-library-candidate-drive-letters* '("C" "D" "E"))
 
@@ -38,8 +48,13 @@ 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*)