implement database-sequence-last. Add support for detecting
unsigned integers.
* uffi/clsql-uffi.lisp: Add support for unsigned integers
28 Dec 2004 Kevin Rosenberg <kevin@rosenberg.net>
* db-mysql/mysql-sql.lisp: Apply patch from Yannick Gingras to
28 Dec 2004 Kevin Rosenberg <kevin@rosenberg.net>
* db-mysql/mysql-sql.lisp: Apply patch from Yannick Gingras to
- implement database-sequence-last.
+ implement database-sequence-last. Add support for detecting
+ unsigned integers.
+ * uffi/clsql-uffi.lisp: Add support for unsigned integers
26 Dec 2004 Kevin Rosenberg <kevin@rosenberg.net>
* doc/ref-fdml.lisp: Fix variable tag name to varname
26 Dec 2004 Kevin Rosenberg <kevin@rosenberg.net>
* doc/ref-fdml.lisp: Fix variable tag name to varname
(dotimes (i num-fields)
(declare (fixnum i))
(let* ((field (uffi:deref-array field-vec '(:array mysql-field) i))
(dotimes (i num-fields)
(declare (fixnum i))
(let* ((field (uffi:deref-array field-vec '(:array mysql-field) i))
- (type (uffi:get-slot-value field 'mysql-field 'type)))
+ (flags (uffi:get-slot-value field 'mysql-field 'flags))
+ (unsigned (plusp (logand flags 32)))
+ (type (uffi:get-slot-value field 'mysql-field 'type)))
(push
(case type
((#.mysql-field-types#tiny
#.mysql-field-types#short
(push
(case type
((#.mysql-field-types#tiny
#.mysql-field-types#short
- #.mysql-field-types#int24
- #.mysql-field-types#long)
- :int32)
- (#.mysql-field-types#longlong
- :int64)
+ #.mysql-field-types#int24)
+ (if unsigned
+ :uint32
+ :int32))
+ (#.mysql-field-types#long
+ (if unsigned
+ :uint
+ :int))
+ (#.mysql-field-types#longlong
+ (if unsigned
+ :uint64
+ :int64))
((#.mysql-field-types#double
#.mysql-field-types#float
#.mysql-field-types#decimal)
((#.mysql-field-types#double
#.mysql-field-types#float
#.mysql-field-types#decimal)
(dotimes (i num-fields)
(declare (fixnum i))
(let* ((field (uffi:deref-array field-vec '(:array mysql-field) i))
(dotimes (i num-fields)
(declare (fixnum i))
(let* ((field (uffi:deref-array field-vec '(:array mysql-field) i))
- (type (uffi:get-slot-value field mysql-field 'type))
+ (type (uffi:get-slot-value field 'mysql-field 'type))
(binding (uffi:deref-array output-bind '(:array mysql-bind) i)))
(setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-type) type)
(binding (uffi:deref-array output-bind '(:array mysql-bind) i)))
(setf (uffi:get-slot-value binding 'mysql-bind 'mysql::buffer-type) type)
((str (* :unsigned-char)))
:returning :int)
((str (* :unsigned-char)))
:returning :int)
+(uffi:def-function ("strtoul" c-strtoul)
+ ((str (* :unsigned-char))
+ (endptr (* :unsigned-char))
+ (radix :int))
+ :returning :unsigned-long)
+
(uffi:def-function "atol"
((str (* :unsigned-char)))
:returning :long)
(uffi:def-function "atol"
((str (* :unsigned-char)))
:returning :long)
(uffi:def-type char-ptr-def (* :unsigned-char))
(uffi:def-type char-ptr-def (* :unsigned-char))
+(defun strtoul (char-ptr)
+ (declare (optimize (speed 3) (safety 0) (space 0))
+ (type char-ptr-def char-ptr))
+ (c-strtoul char-ptr uffi:+null-cstring-pointer+ 10))
+
(defun convert-raw-field (char-ptr types index &optional length)
(declare (optimize (speed 3) (safety 0) (space 0))
(type char-ptr-def char-ptr))
(defun convert-raw-field (char-ptr types index &optional length)
(declare (optimize (speed 3) (safety 0) (space 0))
(type char-ptr-def char-ptr))
(case type
(:double
(atof char-ptr))
(case type
(:double
(atof char-ptr))
+ (:int
+ (atol char-ptr))
+ (:int32
+ (:uint32
+ (strtoul char-ptr))
+ (:uint
+ (strtoul char-ptr))
+ ((:int64 :uint64)
(uffi:with-foreign-object (high32-ptr :unsigned-int)
(let ((low32 (atol64 char-ptr high32-ptr))
(high32 (uffi:deref-pointer high32-ptr :unsigned-int)))
(uffi:with-foreign-object (high32-ptr :unsigned-int)
(let ((low32 (atol64 char-ptr high32-ptr))
(high32 (uffi:deref-pointer high32-ptr :unsigned-int)))