r9119: Automated commit for Debian build of clsql upstream-version-2.9.2
[clsql.git] / db-mysql / mysql-client-info.lisp
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) 2002 by Kevin M. Rosenberg
13 ;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
14 ;;;;
15 ;;;; CLSQL users are granted the rights to distribute and use this software
16 ;;;; as governed by the terms of the Lisp Lesser GNU Public License
17 ;;;; (http://opensource.franz.com/preamble.html), also known as the LLGPL.
18 ;;;; *************************************************************************
19
20 (in-package #:mysql)
21
22 (declaim (inline mysql-get-client-info))
23
24 (defvar *mysql-client-info* nil)
25
26 (eval-when (:compile-toplevel :load-toplevel :execute)
27   (uffi:def-function "mysql_get_client_info"
28       ()
29     :module "mysql"
30     :returning :cstring)
31
32   (setf *mysql-client-info* (uffi:convert-from-cstring (mysql-get-client-info)))
33   
34   (cond
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     (t
40      (error "Unknown mysql client version '~A'." *mysql-client-info*))))
41