r10238: * db-mysql/mysql-sql.lisp: Apply patch from Yannick Gingras to
[clsql.git] / db-mysql / mysql-sql.lisp
index 5f1306811fdc2f9d6836591909cc661242ac4238..c87da8699df6835c8693bd704e349070b25adabf 100644 (file)
     (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
-            #.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)
          (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)