Changeset 64-bit,8


Ignore:
Timestamp:
11/28/2007 03:53:07 AM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
64-bit
revision id:
dsowen@tux-20071128035307-g1o96vxy0t1sjzky
Message:

Full pass.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 64-bit/src/odbc/column.lisp

    r4 r8  
    112112          (cffi:foreign-alloc :char :count (slot-value column 'buffer-length))))
    113113
    114 ;; dso+
    115114(defmethod get-column-value ((column string-column))
    116115  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
     
    147146          (cffi:foreign-alloc :uchar :count (slot-value column 'buffer-length))))
    148147
    149 ;; dso+
    150148(defmethod get-column-value ((column unicode-string-column))
    151149  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
     
    174172
    175173
    176 ;; dso+
    177174(defmethod get-column-value ((column integer-column))
    178175  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
     
    188185(defclass double-column (column) ())
    189186
    190 ;; dso+
    191187(defmethod initialize-column ((column double-column) args)
    192188  (declare (ignore args))
     
    196192  (setf (slot-value column 'value-ptr) (cffi:foreign-alloc :double)))
    197193
    198 ;; dso+
    199194(defmethod get-column-value ((column double-column))
    200195  ;; (%get-long (slot-value column 'ind-ptr))
     
    211206(defclass date-column (column) ())
    212207
    213 ;; dso+
    214208(defmethod initialize-column ((column date-column) args)
    215209  (declare (ignore args))
     
    219213  (setf (slot-value column 'value-ptr) (cffi:foreign-alloc :uchar :count 32)))
    220214
    221 ;; dso+
    222215(defmethod get-column-value ((column date-column))
    223216  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
     
    248241
    249242(defmethod get-column-value ((column binary-column))
    250   (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) :long)))
     243  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
    251244    (if (= len $SQL_NULL_DATA)
    252245      nil
     
    258251(defclass bigint-column (column) ())
    259252
    260 ;; dso+
    261253(defmethod initialize-column ((column bigint-column) args)
    262254  (declare (ignore args))
     
    267259  (setf (slot-value column 'value-ptr) (cffi:foreign-alloc :uchar :count 25)))
    268260
    269 ;; dso+
    270261(defmethod get-column-value ((column bigint-column))
    271262  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
     
    322313
    323314(defmethod get-column-value ((column decimal-column))
    324   (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) :long)))
     315  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
    325316    (if (= len $SQL_NULL_DATA)
    326       nil
    327       (let ((bytes (get-byte-vector (slot-value column 'value-ptr) len))
    328             (sum 0))
    329         (dotimes (i 16)
    330           (setf sum (+ (* 256 sum) (aref bytes (- (+ 3 16) 1 i)))))
    331         (*
    332          sum
    333          (if (zerop (aref bytes 2)) -1 1) ;sign
    334          (expt 10 (- (aref bytes 1))))))))
     317        nil
     318        (let ((bytes (get-byte-vector (slot-value column 'value-ptr) len))
     319              (sum 0))
     320          (dotimes (i 16)
     321            (setf sum (+ (* 256 sum) (aref bytes (- (+ 3 16) 1 i)))))
     322          (*
     323           sum
     324           (if (zerop (aref bytes 2)) -1 1) ;sign
     325           (expt 10 (- (aref bytes 1))))))))
    335326
    336327
     
    350341  (let* ((value-ptr (cffi:foreign-alloc :char
    351342                                        :count (slot-value column 'buffer-length)))
    352          (ind-ptr (cffi:foreign-alloc :long)))
     343         (ind-ptr (cffi:foreign-alloc 'sql-len)))
    353344    (unwind-protect
    354345      (get-character-data
     
    374365(defmethod get-column-value ((column uclob-column))
    375366  (let* ((value-ptr (cffi:foreign-alloc :char :count (slot-value column 'buffer-length)))
    376          (ind-ptr (cffi:foreign-alloc :long)))
     367         (ind-ptr (cffi:foreign-alloc 'sql-len)))
    377368    (unwind-protect
    378369      (get-unicode-character-data
     
    398389(defmethod get-column-value ((column blob-column))
    399390  (let* ((value-ptr (cffi:foreign-alloc  :uchar :count (slot-value column 'buffer-length)))
    400          (ind-ptr (cffi:foreign-alloc :long)))
     391         (ind-ptr (cffi:foreign-alloc 'sql-len)))
    401392    (unwind-protect
    402393      (get-binary-data
     
    412403;;  fetch data via SQlGetData
    413404;; ------------------------------
    414 ;; dso+
    415405(defun get-character-data (hstmt position value-ptr buffer-length ind-ptr)
    416406  ;; local error handling, we can not use the general error handling
     
    530520             (get-output-stream-string sos))))))))
    531521   
    532 ;; dso+
    533522(defun get-binary-data (hstmt position value-ptr buffer-length ind-ptr)
    534523  ;; local error handling, we can not use the general error handling
Note: See TracChangeset for help on using the changeset viewer.