use md5sum-string instead of md5sum-sequence to adjust to upstream changes
[clsql.git] / db-db2 / db2-loader.lisp
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name:          db2-loader.lisp
6 ;;;; Purpose:       Foreign library loader for CLSQL Db2 interface
7 ;;;;
8 ;;;; This file is part of CLSQL.
9 ;;;;
10 ;;;; CLSQL users are granted the rights to distribute and use this software
11 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
12 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
13 ;;;; *************************************************************************
14
15 (in-package #:clsql-db2)
16
17 (defparameter *db2-lib-path*
18   (let ((db2-home (getenv "DB2_HOME")))
19     (when db2-home
20       (make-pathname :directory
21                      (append
22                       (pathname-directory
23                        (parse-namestring (concatenate 'string db2-home "/")))
24                       (list "lib"))))))
25
26 (defparameter *db2-library-filenames*
27   (if *db2-lib-path*
28     (list (merge-pathnames "libdb2" *db2-lib-path*)
29           "libdb2")
30     "libdb2"))
31
32 (defvar *db2-supporting-libraries* '("c")
33   "Used only by CMU. List of library flags needed to be passed to ld to
34 load the Db2 client library succesfully.  If this differs at your site,
35 set to the right path before compiling or loading the system.")
36
37 (defvar *db2-library-loaded* nil
38   "T if foreign library was able to be loaded successfully")
39
40 (defmethod clsql-sys:database-type-library-loaded ((database-type (eql :db2)))
41   *db2-library-loaded*)
42
43 (defmethod clsql-sys:database-type-load-foreign ((database-type (eql :db2)))
44   (clsql-uffi:find-and-load-foreign-library *db2-library-filenames*
45                                             :module "clsql-db2"
46                                             :supporting-libraries
47                                             *db2-supporting-libraries*)
48   (setq *db2-library-loaded* t))
49
50 (clsql-sys:database-type-load-foreign :db2)
51
52