X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-odbc%2Fodbc-loader.lisp;fp=db-odbc%2Fodbc-loader.lisp;h=658da2e53faaca1ea403429d35535f2e063189ae;hp=0000000000000000000000000000000000000000;hb=2f1e9becafa048960362bd6f9bb0f327045807cd;hpb=8fb55434ea4d6e0a0775b0012c83a2b27061bb59 diff --git a/db-odbc/odbc-loader.lisp b/db-odbc/odbc-loader.lisp new file mode 100644 index 0000000..658da2e --- /dev/null +++ b/db-odbc/odbc-loader.lisp @@ -0,0 +1,50 @@ +;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*- +;;;; ************************************************************************* +;;;; FILE IDENTIFICATION +;;;; +;;;; Name: odbc-loader.sql +;;;; Purpose: ODBC library loader using UFFI +;;;; Programmers: Kevin M. Rosenberg +;;;; Date Started: April 2004 +;;;; +;;;; $Id: odbc-loader.lisp 8270 2003-11-25 06:37:14Z kevin $ +;;;; +;;;; This file, part of CLSQL, is Copyright (c) 2004 by Kevin M. Rosenberg +;;;; +;;;; CLSQL users are granted the rights to distribute and use this software +;;;; as governed by the terms of the Lisp Lesser GNU Public License +;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL. +;;;; ************************************************************************* + +(in-package #:odbc) + +(defparameter *odbc-library-path* + (uffi:find-foreign-library + '("odbc32" "libodbc" "libiodbc") + `(,(make-pathname :directory (pathname-directory *load-truename*)) + "/usr/lib/" + "/sw/lib/" + "/usr/local/lib/" + "/home/kevin/debian/src/clsql/db-odbc/" + "/odbc/lib/opt/") + :drive-letters '("C"))) + +(defvar *odbc-supporting-libraries* '("c") + "Used only by CMU. List of library flags needed to be passed to ld to +load the Odbc client library succesfully. If this differs at your site, +set to the right path before compiling or loading the system.") + +(defvar *odbc-library-loaded* nil + "T if foreign library was able to be loaded successfully") + +(defmethod clsql-base-sys:database-type-library-loaded ((database-type (eql :odbc))) + *odbc-library-loaded*) + +(defmethod clsql-base-sys:database-type-load-foreign ((database-type (eql :odbc))) + (uffi:load-foreign-library *odbc-library-path*) + (setq *odbc-library-loaded* t)) + +(clsql-base-sys:database-type-load-foreign :odbc) + + +