From bc4310a463731d7cf760d28e57700c3c772cb6ef Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Tue, 25 Nov 2003 13:30:49 +0000 Subject: [PATCH] r8273: new upstream --- db-mysql/mysql-sql.lisp | 18 +++++++++++++----- debian/changelog | 6 ++++++ uffi/clsql-uffi.lisp | 12 ++++++++---- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/db-mysql/mysql-sql.lisp b/db-mysql/mysql-sql.lisp index e933498..afadd6c 100644 --- a/db-mysql/mysql-sql.lisp +++ b/db-mysql/mysql-sql.lisp @@ -148,7 +148,8 @@ (declare (optimize (speed 3) (safety 0) (debug 0) (space 0))) (let ((mysql-ptr (database-mysql-ptr database))) (uffi:with-cstring (query-native query-expression) - (if (zerop (mysql-query mysql-ptr query-native)) + (if (zerop (mysql-real-query mysql-ptr query-native + (length query-expression))) (let ((res-ptr (mysql-use-result mysql-ptr))) (if res-ptr (unwind-protect @@ -158,6 +159,7 @@ types num-fields res-ptr)) (loop for row = (mysql-fetch-row res-ptr) + for lengths = (mysql-fetch-lengths res-ptr) until (uffi:null-pointer-p row) collect (do* ((rlist (make-list num-fields)) @@ -170,7 +172,9 @@ (uffi:deref-array row '(:array (* :unsigned-char)) i) - types i))))) + types i + (uffi:deref-array lengths '(:array :unsigned-long) + i)))))) (mysql-free-result res-ptr)) (error 'clsql-sql-error :database database @@ -224,7 +228,8 @@ (uffi:with-cstring (sql-native sql-expression) (let ((mysql-ptr (database-mysql-ptr database))) (declare (type mysql-mysql-ptr-def mysql-ptr)) - (if (zerop (mysql-query mysql-ptr sql-native)) + (if (zerop (mysql-real-query mysql-ptr sql-native + (length sql-expression))) t (error 'clsql-sql-error :database database @@ -246,7 +251,8 @@ (uffi:with-cstring (query-native query-expression) (let ((mysql-ptr (database-mysql-ptr database))) (declare (type mysql-mysql-ptr-def mysql-ptr)) - (if (zerop (mysql-query mysql-ptr query-native)) + (if (zerop (mysql-real-query mysql-ptr query-native + (length query-expression))) (let ((res-ptr (if full-set (mysql-store-result mysql-ptr) (mysql-use-result mysql-ptr)))) @@ -286,6 +292,7 @@ (defmethod database-store-next-row (result-set (database mysql-database) list) (let* ((res-ptr (mysql-result-set-res-ptr result-set)) (row (mysql-fetch-row res-ptr)) + (lengths (mysql-fetch-lengths res-ptr)) (types (mysql-result-set-types result-set))) (declare (type mysql-mysql-res-ptr-def res-ptr) (type mysql-row-def row)) @@ -297,7 +304,8 @@ (convert-raw-field (uffi:deref-array row '(:array (* :unsigned-char)) i) types - i))) + i + (uffi:deref-array lengths :unsigned-long i)))) list))) diff --git a/debian/changelog b/debian/changelog index cc1bc25..6627c26 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +cl-sql (1.8.7-1) unstable; urgency=low + + * New upstream + + -- Kevin M. Rosenberg Tue, 25 Nov 2003 06:30:05 -0700 + cl-sql (1.8.5-1) unstable; urgency=low * Fix loading on db-mysql/mysql.so on non-linux platforms diff --git a/uffi/clsql-uffi.lisp b/uffi/clsql-uffi.lisp index da5276a..e1f687b 100644 --- a/uffi/clsql-uffi.lisp +++ b/uffi/clsql-uffi.lisp @@ -87,9 +87,9 @@ (uffi:def-type char-ptr-def (* :unsigned-char)) -(defun convert-raw-field (char-ptr types index) +(defun convert-raw-field (char-ptr types index &optional length) (declare (optimize (speed 3) (safety 0) (space 0)) - (type char-ptr-def char-ptr)) + (type char-ptr-def char-ptr)) (let ((type (if (listp types) (nth index types) types))) @@ -110,5 +110,9 @@ low32 (make-64-bit-integer high32 low32))))) (t - (uffi:convert-from-foreign-string char-ptr :locale :none))))))) - + (if length + (uffi:convert-from-foreign-string char-ptr :locale :none + :null-terminated-p nil + :length length) + (uffi:convert-from-foreign-string char-ptr :locale :none)))))))) + -- 2.34.1