X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=db-mysql%2Fmysql-api.lisp;h=d6989685f1db9d2cc562b229914dfa794708bf98;hb=2961f4f122593e9d4875e88e6af159de28c8dd47;hp=196a823cbf84fc0d2fe9b361bed174cedd2ddb9a;hpb=e132f72fe34b078ca642ec99d1415f6b9511d598;p=clsql.git diff --git a/db-mysql/mysql-api.lisp b/db-mysql/mysql-api.lisp index 196a823..d698968 100644 --- a/db-mysql/mysql-api.lisp +++ b/db-mysql/mysql-api.lisp @@ -33,7 +33,7 @@ ;;; Basic Types (uffi:def-foreign-type mysql-socket :int) -(uffi:def-foreign-type mysql-bool :char) +(uffi:def-foreign-type mysql-bool :byte) (uffi:def-foreign-type mysql-byte :unsigned-char) (uffi:def-enum mysql-net-type @@ -104,7 +104,8 @@ (:long-blob 251) (:blob 252) (:var-string 253) - (:string 254))) + (:string 254) + (:geometry 255))) #+mysql-client-v3 (uffi:def-struct mysql-field @@ -154,6 +155,17 @@ (charsetnr :unsigned-int) (type mysql-field-types)) +(uffi:def-struct mysql-time + (year :unsigned-int) + (month :unsigned-int) + (day :unsigned-int) + (hour :unsigned-int) + (minute :unsigned-int) + (second :unsigned-int) + (second-part :unsigned-long) + (neg mysql-bool) + (time-type :int)) + ;;; MYSQL-ROWS (uffi:def-array-pointer mysql-row (* :unsigned-char)) @@ -263,6 +275,32 @@ (handle (:struct-pointer mysql-mysql)) (eof mysql-bool)) +#+mysql-client-4.1 +(uffi:def-enum mysql-field-types + (:ready + :get-result + :use-result)) + +#+mysql-client-v4.1 +(uffi:def-struct mysql-bind + (length (* :unsigned-long)) + (is-null (* mysql-bool)) + (buffer :pointer-void) + (buffer-type :int) + (buffer-length :unsigned-long) + ;; internal use + (inter_buffer (* :unsigned-char)) + (offset :unsigned-long) + (internal-length :unsigned-long) + (param-number :unsigned-int) + (pack-length :unsigned-int) + (is-signed mysql-bool) + (long-data-used mysql-bool) + (internal-is-null mysql-bool) + (store-param-func :pointer-void) + (fetch-result :pointer-void) + (skip-result :pointer-void)) + ;;;; The Foreign C routines (declaim (inline mysql-init)) (uffi:def-function "mysql_init" @@ -521,6 +559,92 @@ :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_prepare" + ((stmt mysql-stmt-ptr) + (query :cstring) + (length :unsigned-long)) + :module "clsql-mysql" + :returning :int) + +#+mysql-client-v4.1 +(uffi:def-function "mysql_stmt_param_count" + ((stmt mysql-stmt-ptr)) + :module "clsql-mysql" + :returning :unsigned-int) + +#+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_result_metadata" + ((stmt mysql-stmt-ptr)) + :module "clsql-mysql" + :returning (* mysql-mysql-res)) + + +#+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_store_result" + ((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) + +#+mysql-client-v4.1 +(uffi:def-function "mysql_stmt_close" + ((stmt mysql-stmt-ptr)) + :module "clsql-mysql" + :returning :short) + +#+mysql-client-v4.1 +(uffi:def-function "mysql_stmt_errno" + ((stmt mysql-stmt-ptr)) + :module "clsql-mysql" + :returning :unsigned-int) + +#+mysql-client-v4.1 +(uffi:def-function "mysql_stmt_error" + ((stmt mysql-stmt-ptr)) + :module "clsql-mysql" + :returning :cstring) + ;;;; Equivalents of C Macro definitions for accessing various fields ;;;; in the internal MySQL Datastructures @@ -616,7 +740,6 @@ :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)))