-(uffi:def-function "atoi"
- ((str (* :unsigned-char)))
- :returning :int)
-
-(uffi:def-function "atol"
- ((str (* :unsigned-char)))
- :returning :long)
-
-(uffi:def-function "atol64"
- ((str (* :unsigned-char))
- (high32 (* :int)))
- :returning :int)
-
-(uffi:def-function "atof"
- ((str (* :unsigned-char)))
- :returning :double)
-
-(defun convert-raw-field (char-ptr types index)
- (let ((type (if (listp types)
- (nth index types)
- types)))
- (case type
- (:int
- (atoi char-ptr))
- (:long
- (atol char-ptr))
- (:double
- (atof char-ptr))
- (:longlong
- (uffi:with-foreign-object (high32-ptr :int)
- (let ((low32 (atol64 char-ptr high32-ptr))
- (high32 (uffi:deref-pointer high32-ptr :int)))
- (if (zerop high32)
- low32
- (mysql:make-64-bit-integer high32 low32)))))
- (otherwise
- (uffi:convert-from-foreign-string char-ptr)))))
-