X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-mysql%2Fmysql-loader.lisp;h=cdf28cd4f907725d54a18a2fc5b3e918a61cfbbf;hp=b5d6b9f499134722c0c76b7cbe3a50e2f74111dd;hb=d2d49ab13c98bc7a1819a0fd3968268a5567bdc3;hpb=c0f15eada06c0c53437a5b3acc72ab1cd3c72df1 diff --git a/db-mysql/mysql-loader.lisp b/db-mysql/mysql-loader.lisp index b5d6b9f..cdf28cd 100644 --- a/db-mysql/mysql-loader.lisp +++ b/db-mysql/mysql-loader.lisp @@ -7,8 +7,6 @@ ;;;; Author: Kevin M. Rosenberg ;;;; Created: Feb 2002 ;;;; -;;;; $Id$ -;;;; ;;;; This file, part of CLSQL, is Copyright (c) 2002-2004 by Kevin M. Rosenberg ;;;; ;;;; CLSQL users are granted the rights to distribute and use this software @@ -18,27 +16,13 @@ (in-package #:mysql) -(defparameter *clsql-mysql-library-path* - (uffi:find-foreign-library - '(#+(or 64bit x86-64) "mysql64" "mysql") - `(,clsql-mysql-system::*library-file-dir* - "/usr/lib/clsql/" - "/sw/lib/clsql/") - :drive-letters '("C"))) +;; searches clsql_mysql64 to accomodate both 32-bit and 64-bit libraries on same system +(defparameter *clsql-mysql-library-candidate-names* + `(,@(when (> most-positive-fixnum (expt 2 32)) (list "clsql_mysql64")) + "clsql_mysql")) (defvar *mysql-library-candidate-names* - '("libmysqlclient" "libmysql")) - -(defparameter *mysql-library-candidate-directories* - `(,(pathname-directory *load-pathname*) - "/opt/mysql/lib/mysql/" "/usr/local/lib/" - #+(or 64bit x86-64) "/usr/lib64/" #+(or 64bit x86-64) "/usr/local/lib64/mysql/" - #+(or 64bit x86-64) "/usr/local/lib64/" - #+(or 64bit x86-64) "/usr/local/lib64/mysql/" - - "/usr/lib/" "/usr/local/lib/mysql/" "/usr/lib/mysql/" "/mysql/lib/opt/" "/sw/lib/mysql/" "/opt/local/lib/mysql/")) - -(defvar *mysql-library-candidate-drive-letters* '("C" "D" "E")) + '("libmysqlclient" "libmysql")) (defvar *mysql-supporting-libraries* '("c") "Used only by CMU. List of library flags needed to be passed to ld to @@ -50,23 +34,17 @@ set to the right path before compiling or loading the system.") (defmethod clsql-sys:database-type-library-loaded ((database-type (eql :mysql))) *mysql-library-loaded*) - + (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :mysql))) - (let ((mysql-path - (uffi:find-foreign-library *mysql-library-candidate-names* - *mysql-library-candidate-directories* - :drive-letters - *mysql-library-candidate-drive-letters*))) - (unless (probe-file mysql-path) - (error "Can't find mysql client library to load")) - (uffi:load-foreign-library mysql-path - :module "mysql" - :supporting-libraries - *mysql-supporting-libraries*) - (uffi:load-foreign-library *clsql-mysql-library-path* - :module "clsql-mysql" - :supporting-libraries - (append *mysql-supporting-libraries*))) + (clsql:push-library-path clsql-mysql-system::*library-file-dir*) + + (clsql-uffi:find-and-load-foreign-library *mysql-library-candidate-names* + :module "mysql" + :supporting-libraries *mysql-supporting-libraries*) + + (clsql-uffi:find-and-load-foreign-library *clsql-mysql-library-candidate-names* + :module "clsql-mysql" + :supporting-libraries *mysql-supporting-libraries*) (setq *mysql-library-loaded* t))