;; 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)
(uffi:ensure-char-storable (code-char 0)))
(setf (uffi:deref-pointer errcode :long) 0)
- (oci-error-get (deref-vp errhp) 1
- (uffi:make-null-pointer :unsigned-char)
- errcode errbuf +errbuf-len+ +oci-htype-error+)
+ (uffi:with-cstring (sqlstate nil)
+ (oci-error-get (deref-vp errhp) 1
+ sqlstate
+ errcode
+ (uffi:char-array-to-pointer errbuf)
+ +errbuf-len+ +oci-htype-error+))
(let ((subcode (uffi:deref-pointer errcode :long)))
(unless (and nulls-ok (= subcode +null-value-returned+))
(error 'sql-database-error
;; In order to map the "same string" property above onto Lisp equality,
;; we drop trailing spaces in all cases:
-(uffi:def-type string-array (:array :unsigned-char))
+(uffi:def-type string-pointer (* :unsigned-char))
(defun deref-oci-string (arrayptr string-index size)
-;; (declare (type string-array arrayptr))
+ (declare (type string-pointer arrayptr))
(declare (type (mod #.+n-buf-rows+) string-index))
(declare (type (and unsigned-byte fixnum) size))
(let* ((raw (uffi:convert-from-foreign-string
(value
(let* ((arb (foreign-resource-buffer (cd-indicators cd)))
(indicator (uffi:deref-array arb '(:array :short) irow)))
- ;; b(declare (type short-array arb))
+ ;;(declare (type short-array arb))
(unless (= indicator -1)
(ecase (cd-oci-data-type cd)
(#.SQLT-STR
(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)
(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)
(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)))
(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))
(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))))
sizeof
dtype
(foreign-resource-buffer indicators)
- (uffi:make-null-pointer :unsigned-short)
+ +unsigned-short-null-pointer+
(foreign-resource-buffer retcodes)
+oci-default+))))))))