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
12 ;;;; This file, part of CLSQL, is Copyright (c) 2004 by Kevin M. Rosenberg
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 ;;;; *************************************************************************
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)
31 (setf *mysql-client-info* (uffi:convert-from-cstring (mysql-get-client-info)))
33 (when (and (stringp *mysql-client-info*)
34 (plusp (length *mysql-client-info*)))
36 ((eql (schar *mysql-client-info* 0) #\3)
37 (pushnew :mysql-client-v3 cl:*features*))
38 ((eql (schar *mysql-client-info* 0) #\4)
39 (pushnew :mysql-client-v4 cl:*features*)
40 (when (and (>= (length *mysql-client-info*) 3)
41 (string-equal "4.1" *mysql-client-info* :end2 3))
42 (pushnew :mysql-client-v4.1 cl:*features*)))
44 (error "Unknown mysql client version '~A'." *mysql-client-info*)))))