Recognize v6 of MySQL client library
[clsql.git] / db-mysql / mysql-client-info.lisp
index e4435083d317d54293a65aba3621921feeff2923..9b791df2302962c26be50f2035cf0de2a747f8be 100644 (file)
@@ -7,8 +7,6 @@
 ;;;; Programmer:    Kevin M. Rosenberg
 ;;;; Date Started:  April 2004
 ;;;;
-;;;; $Id$
-;;;;
 ;;;; 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
 (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)
 
   (setf *mysql-client-info* (uffi:convert-from-cstring (mysql-get-client-info)))
 
-  (cond
-    ((eql (schar *mysql-client-info* 0) #\3)
-     (pushnew :mysql-client-v3 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)))
-    (t
-     (error "Unknown mysql client version '~A'." *mysql-client-info*)))
-
-  )
+
+  (when (and (stringp *mysql-client-info*)
+             (plusp (length *mysql-client-info*)))
+    (cond
+      ((eql (schar *mysql-client-info* 0) #\3)
+       (pushnew :mysql-client-v3 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*)))
+      ((eql (schar *mysql-client-info* 0) #\6)
+       (pushnew :mysql-client-v6 cl:*features*))
+      (t
+       (error "Unknown mysql client version '~A'." *mysql-client-info*)))))