- (uffi:make-null-pointer :int) +oci-attr-scale+
- (uffi:deref-pointer errhp void-pointer))
- (cond
- ((zerop (uffi:deref-pointer scale :byte))
- (setf buffer (acquire-foreign-resource :init +n-buf-rows+)
- sizeof 4 ;; sizeof(int)
- dtype #.SQLT-INT))
- (t
- (setf buffer (acquire-foreign-resource :double +n-buf-rows+)
- sizeof 8 ;; sizeof(double)
- dtype #.SQLT-FLT))))
- (t ; Default to SQL-STR
- (setf (uffi:deref-pointer colsize :unsigned-long) 0
- dtype #.SQLT-STR)
- (oci-attr-get (uffi:deref-pointer parmdp void-pointer)
+ +unsigned-int-null-pointer+
+ +oci-attr-scale+
+ (deref-vp errhp))
+ (let ((*scale (uffi:deref-pointer scale :byte))
+ (*precision (uffi:deref-pointer precision :byte)))
+
+ ;;(format t "scale=~d, precision=~d~%" *scale *precision)
+ (cond
+ ((or (and (minusp *scale) (zerop *precision))
+ (and (zerop *scale) (< 0 *precision 9)))
+ (setf buffer (acquire-foreign-resource :int +n-buf-rows+)
+ sizeof 4 ;; sizeof(int)
+ dtype #.SQLT-INT))
+ ((and (zerop *scale)
+ (plusp *precision)
+ #+ignore (< *precision 19))
+ (setf buffer (acquire-foreign-resource :unsigned-int
+ (* 2 +n-buf-rows+))
+ sizeof 8 ;; sizeof(int64)
+ dtype #.SQLT-INT))
+ ;; Bug in OCI? But OCI won't take 16-byte buffer for 128-bit
+ ;; integers
+ #+ignore
+ ((and (zerop *scale) (plusp *precision))
+ (setf buffer (acquire-foreign-resource :unsigned-int
+ (* 4 +n-buf-rows+))
+ sizeof 8 ;; sizeof(int128)
+ dtype #.SQLT-INT))
+ (t
+ (setf buffer (acquire-foreign-resource :double +n-buf-rows+)
+ sizeof 8 ;; sizeof(double)
+ dtype #.SQLT-FLT)))))
+ ;; Default to SQL-STR
+ (t
+ (setf (uffi:deref-pointer colsize :unsigned-long) 0)
+ (setf dtype #.SQLT-STR)
+ (oci-attr-get (deref-vp parmdp)