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