r9527: add function declarations for prepared statements
[clsql.git] / db-mysql / mysql-api.lisp
index 196a823cbf84fc0d2fe9b361bed174cedd2ddb9a..96d904c70900954e1b04548100b501d5d1159ac5 100644 (file)
   (handle (:struct-pointer mysql-mysql))
   (eof mysql-bool))
 
+#+mysql-client-v4.1
+(uffi:def-struct mysql-bind
+    (length (* :unsigned-long))
+  (is-null (* :short))
+  (buffer :pointer-void)
+  (buffer-type :int)
+  (buffer-length :unsigned-long)
+  ;; remainder of structure is for internal use
+  )
+
 ;;;; The Foreign C routines
 (declaim (inline mysql-init))
 (uffi:def-function "mysql_init"
   :module "clsql-mysql"
   :returning :unsigned-int)
 
+#+mysql-client-v4.1
+(uffi:def-foreign-type mysql-stmt-ptr :pointer-void)
+
+#+mysql-client-v4.1
+(uffi:def-function "mysql_stmt_init"
+    ((res (* mysql-mysql-res)))
+  :module "clsql-mysql"
+  :returning mysql-stmt-ptr)
+
+#+mysql-client-v4.1
+(uffi:def-function "mysql_stmt_bind_param"
+    ((stmt mysql-stmt-ptr)
+     (bind (* mysql-bind)))
+  :module "clsql-mysql"
+  :returning :short)
+
+#+mysql-client-v4.1
+(uffi:def-function "mysql_stmt_bind_result"
+    ((stmt mysql-stmt-ptr)
+     (bind (* mysql-bind)))
+  :module "clsql-mysql"
+  :returning :short)
+
+#+mysql-client-v4.1
+(uffi:def-function "mysql_stmt_execute"
+    ((stmt mysql-stmt-ptr))
+  :module "clsql-mysql"
+  :returning :int)
+
+#+mysql-client-v4.1
+(uffi:def-function "mysql_stmt_fetch"
+    ((stmt mysql-stmt-ptr))
+  :module "clsql-mysql"
+  :returning :int)
+
+#+mysql-client-v4.1
+(uffi:def-function "mysql_stmt_free_result"
+    ((stmt mysql-stmt-ptr))
+  :module "clsql-mysql"
+  :returning :short)
 
 ;;;; Equivalents of C Macro definitions for accessing various fields
 ;;;; in the internal MySQL Datastructures
   :module "clsql-mysql"
   :returning :void)
 
-
 (defun mysql-data-seek (res offset)
   (multiple-value-bind (high32 low32) (split-64-bit-integer offset)
     (clsql-mysql-data-seek res high32 low32)))