;;;; Original code by Pierre R. Mai
;;;; Date Started: Feb 2002
;;;;
-;;;; $Id: mysql-sql.lisp,v 1.1 2002/09/30 10:19:23 kevin Exp $
+;;;; $Id: mysql-sql.lisp,v 1.4 2003/04/16 21:50:01 kevin Exp $
;;;;
;;;; This file, part of CLSQL, is Copyright (c) 2002 by Kevin M. Rosenberg
;;;; and Copyright (c) 1999-2001 by Pierre R. Mai
;;;; Added field types
(defpackage :clsql-mysql
- (:use :common-lisp :clsql-base-sys :mysql :clsql-uffi)
+ (:use #:common-lisp #:clsql-base-sys #:mysql #:clsql-uffi)
(:export #:mysql-database)
(:documentation "This is the CLSQL interface to MySQL."))
(if (zerop (mysql-query mysql-ptr query-native))
(let ((res-ptr (mysql-use-result mysql-ptr)))
(if res-ptr
- (let ((num-fields (mysql-num-fields res-ptr)))
- (setq types (canonicalize-types
- types num-fields
- res-ptr))
- (unwind-protect
- (loop for row = (mysql-fetch-row res-ptr)
+ (unwind-protect
+ (let ((num-fields (mysql-num-fields res-ptr)))
+ (setq types (canonicalize-types
+ types num-fields
+ res-ptr))
+ (loop for row = (mysql-fetch-row res-ptr)
until (uffi:null-pointer-p row)
collect
(loop for i from 0 below num-fields
collect
(convert-raw-field
(uffi:deref-array row '(:array (* :unsigned-char)) i)
- types i)))
- (mysql-free-result res-ptr)))
+ types i))))
+ (mysql-free-result res-ptr))
(error 'clsql-sql-error
:database database
:expression query-expression
:errno (mysql-errno mysql-ptr)
:error (mysql-error-string mysql-ptr))))))
-(defstruct mysql-result-set
- (res-ptr (uffi:make-null-pointer 'mysql-mysql-res)
- :type mysql-mysql-res-ptr-def)
- (types nil)
- (num-fields nil :type fixnum)
+
+(defstruct mysql-result-set
+ (res-ptr (uffi:make-null-pointer 'mysql-mysql-res) :type mysql-mysql-res-ptr-def)
+ (types nil :type list)
+ (num-fields 0 :type fixnum)
(full-set nil :type boolean))