X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=db-sqlite%2Fsqlite-api-uffi.lisp;fp=db-sqlite%2Fsqlite-api-uffi.lisp;h=e4d7bf91a8afdffe3abd332adce12f580a974301;hb=177e66ef69d0c564f3b09ec91d3cb2fe06104d1e;hp=64cd43f0cbecf299902ff63bff61f14891dc7e7c;hpb=805a41bcf71161ad719621108c6b7a499122bf15;p=clsql.git diff --git a/db-sqlite/sqlite-api-uffi.lisp b/db-sqlite/sqlite-api-uffi.lisp index 64cd43f..e4d7bf9 100644 --- a/db-sqlite/sqlite-api-uffi.lisp +++ b/db-sqlite/sqlite-api-uffi.lisp @@ -66,6 +66,8 @@ (defconstant SQLITE-ROW 100 "sqlite_step() has another row ready") (defconstant SQLITE-DONE 101 "sqlite_step() has finished executing") +(defvar +null-char-char-pointer+ (make-null-pointer 'string-pointer)) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;; ;;;; Conditions. @@ -215,7 +217,7 @@ (defun sqlite-open (db-name &optional (mode 0)) (with-cstring (db-name-native db-name) - (let ((db (%open db-name-native mode 0))) + (let ((db (%open db-name-native mode +null-char-char-pointer+))) (if (null-pointer-p db) (signal-sqlite-error SQLITE-ERROR (format nil "unable to open ~A" db-name)) @@ -225,7 +227,7 @@ (with-cstring (sql-native sql) (let ((vm (allocate-foreign-object 'sqlite-vm))) (with-foreign-object (sql-tail '(* :char)) - (let ((result (%compile db sql-native sql-tail vm 0))) + (let ((result (%compile db sql-native sql-tail vm +null-char-char-pointer+))) (if (= result SQLITE-OK) vm (progn @@ -247,8 +249,7 @@ ((= result SQLITE-DONE) (free-foreign-object cols) (free-foreign-object col-names) - (values 0 (make-null-pointer 'string-pointer) - (make-null-pointer 'string-pointer))) + (values 0 +null-char-char-pointer+ +null-char-char-pointer+)) (t (free-foreign-object cols) (free-foreign-object col-names) @@ -256,7 +257,7 @@ (defun sqlite-finalize (vm) (declare (type sqlite-vm-pointer vm)) - (let ((result (%finalize (deref-pointer vm 'sqlite-vm) 0))) + (let ((result (%finalize (deref-pointer vm 'sqlite-vm) +null-char-char-pointer+))) (if (= result SQLITE-OK) (progn (free-foreign-object vm) @@ -270,7 +271,7 @@ (declare (type sqlite-row-pointer-type rows)) (with-foreign-object (rows-n :int) (with-foreign-object (cols-n :int) - (let ((result (%get-table db sql-native rows rows-n cols-n 0))) + (let ((result (%get-table db sql-native rows rows-n cols-n +null-char-char-pointer+))) (if (= result SQLITE-OK) (let ((cn (deref-pointer cols-n :int)) (rn (deref-pointer rows-n :int))) @@ -290,7 +291,7 @@ ;;;; (declaim (inline make-null-row)) (defun make-null-row () - (uffi:make-null-pointer 'string-pointer)) + +null-char-char-pointer) (declaim (inline make-null-vm)) (defun make-null-vm ()