X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=db-mysql%2Fmysql-client-info.lisp;h=d27c7589a48dfb5dfde0c880ab50e7d62e58362f;hb=3d86a3b402ae495cddcc5999c5bdd7fe6f586d53;hp=df454bda2742b3447cc2be791a76cd00f1872185;hpb=5dfea0c629f967d7ace700b63adf62eb11f88d9b;p=clsql.git diff --git a/db-mysql/mysql-client-info.lisp b/db-mysql/mysql-client-info.lisp index df454bd..d27c758 100644 --- a/db-mysql/mysql-client-info.lisp +++ b/db-mysql/mysql-client-info.lisp @@ -7,10 +7,7 @@ ;;;; Programmer: Kevin M. Rosenberg ;;;; Date Started: April 2004 ;;;; -;;;; $Id: mysql-api.lisp 8801 2004-03-31 23:48:44Z kevin $ -;;;; -;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg -;;;; and Copyright (c) 1999-2001 by Pierre R. Mai +;;;; This file, part of CLSQL, is Copyright (c) 2004 by Kevin M. Rosenberg ;;;; ;;;; CLSQL users are granted the rights to distribute and use this software ;;;; as governed by the terms of the Lisp Lesser GNU Public License @@ -21,22 +18,32 @@ (declaim (inline mysql-get-client-info)) +(defvar *mysql-client-info* nil) + (eval-when (:compile-toplevel :load-toplevel :execute) - (uffi:def-function "mysql_get_client_info" + (uffi:def-function ("mysql_get_client_info" mysql-get-client-info) () :module "mysql" :returning :cstring) - (let ((version (uffi:convert-from-cstring (mysql-get-client-info)))) + (setf *mysql-client-info* (uffi:convert-from-cstring (mysql-get-client-info))) + + + (when (and (stringp *mysql-client-info*) + (plusp (length *mysql-client-info*))) (cond - ((eql (schar version 0) #\3) + ((eql (schar *mysql-client-info* 0) #\3) (pushnew :mysql-client-v3 cl:*features*)) - ((eql (schar version 0) #\4) - (pushnew :mysql-client-v4 cl:*features*)) + ((eql (schar *mysql-client-info* 0) #\4) + (pushnew :mysql-client-v4 cl:*features*) + (when (and (>= (length *mysql-client-info*) 3) + (string-equal "4.1" *mysql-client-info* :end2 3)) + (pushnew :mysql-client-v4.1 cl:*features*))) + ((eql (schar *mysql-client-info* 0) #\5) + (pushnew :mysql-client-v5 cl:*features*) + (when (and (>= (length *mysql-client-info*) 3) + (string-equal "5.1" *mysql-client-info* :end2 3)) + (pushnew :mysql-client-v5.1 cl:*features*))) (t - (error "Unknown mysql client version '~A'." version))))) - -;;#-(or :mysql-client-v3 :mysql-client-v4) -;;(eval-when (:compile-toplevel :load-toplevel :execute) -;; (pushnew :mysql-client-v3 cl:*features*)) + (error "Unknown mysql client version '~A'." *mysql-client-info*)))))