X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-mysql%2Fmysql-sql.lisp;h=2945258de5f292f1f668a278a7f446e038d78d91;hp=82f43b8b177513a15714e5c05e37d9229714c86b;hb=4e598a5e04818207730914f609f953dac439c566;hpb=7a857ddf473a4c8f20f93061766b9f34a5f5179c diff --git a/db-mysql/mysql-sql.lisp b/db-mysql/mysql-sql.lisp index 82f43b8..2945258 100644 --- a/db-mysql/mysql-sql.lisp +++ b/db-mysql/mysql-sql.lisp @@ -41,16 +41,25 @@ (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 'mysql::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) @@ -387,7 +396,11 @@ (mysql:mysql-insert-id (clsql-mysql::database-mysql-ptr database)))) (defmethod database-sequence-last (sequence-name (database mysql-database)) - (declare (ignore sequence-name))) + (without-interrupts + (caar (database-query + (concatenate 'string "SELECT id from " + (%sequence-name-to-table sequence-name)) + database :auto nil)))) (defmethod database-create (connection-spec (type (eql :mysql))) (destructuring-bind (host name user password) connection-spec @@ -519,7 +532,7 @@ (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)