Add directory for MacPorts mysql5 port
[clsql/s11.git] / db-mysql / mysql-client-info.lisp
blob54d97243a8bc46e1316809766f6c303a68755c0e
1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10 -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
4 ;;;;
5 ;;;; Name: mysql-client-info.lisp
6 ;;;; Purpose: Check mysql client version
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: April 2004
9 ;;;;
10 ;;;; $Id$
11 ;;;;
12 ;;;; This file, part of CLSQL, is Copyright (c) 2004 by Kevin M. Rosenberg
13 ;;;;
14 ;;;; CLSQL users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
16 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
17 ;;;; *************************************************************************
19 (in-package #:mysql)
21 (declaim (inline mysql-get-client-info))
23 (defvar *mysql-client-info* nil)
25 (eval-when (:compile-toplevel :load-toplevel :execute)
26 (uffi:def-function ("mysql_get_client_info" mysql-get-client-info)
28 :module "mysql"
29 :returning :cstring)
31 (setf *mysql-client-info* (uffi:convert-from-cstring (mysql-get-client-info)))
34 (when (and (stringp *mysql-client-info*)
35 (plusp (length *mysql-client-info*)))
36 (cond
37 ((eql (schar *mysql-client-info* 0) #\3)
38 (pushnew :mysql-client-v3 cl:*features*))
39 ((eql (schar *mysql-client-info* 0) #\4)
40 (pushnew :mysql-client-v4 cl:*features*)
41 (when (and (>= (length *mysql-client-info*) 3)
42 (string-equal "4.1" *mysql-client-info* :end2 3))
43 (pushnew :mysql-client-v4.1 cl:*features*)))
44 ((eql (schar *mysql-client-info* 0) #\5)
45 (pushnew :mysql-client-v5 cl:*features*)
46 (when (and (>= (length *mysql-client-info*) 3)
47 (string-equal "5.1" *mysql-client-info* :end2 3))
48 (pushnew :mysql-client-v5.1 cl:*features*)))
50 (error "Unknown mysql client version '~A'." *mysql-client-info*)))))