X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-oracle%2Foracle-sql.lisp;h=aedff1bab29dc4cb5889f0f75cdb634f0f3e4dca;hp=79ba68e4bb30e20d71621266aca2c10103711550;hb=2d6938f8e40b1db8c0a5d922a71a777d2aac46df;hpb=760cf506d0395b2140f9c83c2f3d00a147262bf9 diff --git a/db-oracle/oracle-sql.lisp b/db-oracle/oracle-sql.lisp index 79ba68e..aedff1b 100644 --- a/db-oracle/oracle-sql.lisp +++ b/db-oracle/oracle-sql.lisp @@ -36,6 +36,13 @@ likely that we'll have to worry about the CMUCL limit.")) ;; constants - from OCI? +(defvar +unsigned-char-null-pointer+ + (uffi:make-null-pointer :unsigned-char)) +(defvar +unsigned-short-null-pointer+ + (uffi:make-null-pointer :unsigned-short)) +(defvar +unsigned-int-null-pointer+ + (uffi:make-null-pointer :unsigned-int)) + (defconstant +var-not-in-list+ 1007) (defconstant +no-data-found+ 1403) (defconstant +null-value-returned+ 1405) @@ -204,7 +211,7 @@ the length of that format.") (uffi:def-type string-array (:array :unsigned-char)) (defun deref-oci-string (arrayptr string-index size) - (declare (type string-array arrayptr)) +;; (declare (type string-array arrayptr)) (declare (type (mod #.+n-buf-rows+) string-index)) (declare (type (and unsigned-byte fixnum) size)) (let* ((raw (uffi:convert-from-foreign-string @@ -414,7 +421,7 @@ the length of that format.") (value (let* ((arb (foreign-resource-buffer (cd-indicators cd))) (indicator (uffi:deref-array arb '(:array :short) irow))) - (declare (type short-array arb)) + ;;(declare (type short-array arb)) (unless (= indicator -1) (ecase (cd-oci-data-type cd) (#.SQLT-STR @@ -454,7 +461,7 @@ the length of that format.") (oci-attr-get (deref-vp (qc-stmthp qc)) +oci-htype-stmt+ rowcount - (uffi:make-null-pointer :unsigned-long) + +unsigned-int-null-pointer+ +oci-attr-row-count+ (deref-vp errhp)) (setf (qc-n-from-oci qc) @@ -498,7 +505,7 @@ the length of that format.") (oci-attr-get (deref-vp stmthp) +oci-htype-stmt+ stmttype - (uffi:make-null-pointer :unsigned-int) + +unsigned-int-null-pointer+ +oci-attr-stmt-type+ (deref-vp errhp) :database db) @@ -623,7 +630,7 @@ the length of that format.") (oci-attr-get (deref-vp parmdp) +oci-dtype-param+ dtype-foreign - (uffi:make-null-pointer :unsigned-int) + +unsigned-int-null-pointer+ +oci-attr-data-type+ (deref-vp errhp)) (let ((dtype (uffi:deref-pointer dtype-foreign :unsigned-short))) @@ -636,13 +643,13 @@ the length of that format.") (oci-attr-get (deref-vp parmdp) +oci-dtype-param+ precision - (uffi:make-null-pointer :unsigned-int) + +unsigned-int-null-pointer+ +oci-attr-precision+ (deref-vp errhp)) (oci-attr-get (deref-vp parmdp) +oci-dtype-param+ scale - (uffi:make-null-pointer :unsigned-int) + +unsigned-int-null-pointer+ +oci-attr-scale+ (deref-vp errhp)) (let ((*scale (uffi:deref-pointer scale :byte)) @@ -665,7 +672,7 @@ the length of that format.") (oci-attr-get (deref-vp parmdp) +oci-dtype-param+ colsize - (uffi:make-null-pointer :unsigned-int) ;; (uffi:pointer-address colsizesize) + +unsigned-int-null-pointer+ +oci-attr-data-size+ (deref-vp errhp)) (let ((colsize-including-null (1+ (uffi:deref-pointer colsize :unsigned-long)))) @@ -703,15 +710,12 @@ the length of that format.") defnp (deref-vp errhp) (1+ icolumn) ; OCI 1-based indexing again - (uffi:with-cast-pointer (vp (foreign-resource-buffer buffer) :void) - vp) + (foreign-resource-buffer buffer) sizeof dtype - (uffi:with-cast-pointer (vp (foreign-resource-buffer indicators) :void) - vp) - (uffi:make-null-pointer :unsigned-short) - (uffi:with-cast-pointer (vp (foreign-resource-buffer retcodes) :unsigned-short) - vp) + (foreign-resource-buffer indicators) + +unsigned-short-null-pointer+ + (foreign-resource-buffer retcodes) +oci-default+)))))))) ;; Release the resources associated with a QUERY-CURSOR.