Changeset 64-bit,4 for 64-bit


Ignore:
Timestamp:
11/28/2007 03:50:39 AM (19 years ago)
Author:
David Owen <dsowen@…>
branch-nick:
64-bit
revision id:
dsowen@tux-20071128035039-edmhe5hgjsmjzt4w
Message:

Second pass at 64-bit cleanness. Have now touched all files.

Location:
64-bit/src/odbc
Files:
3 edited

Legend:

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

    r1 r4  
    7777              column
    7878            ;(setf value-ptr (cffi:foreign-alloc :long buffer-length))
    79             (setf ind-ptr (cffi:foreign-alloc :long))
     79            (setf ind-ptr (cffi:foreign-alloc 'sql-len))
    8080            (%bind-column hstmt
    8181                          pos
     
    112112          (cffi:foreign-alloc :char :count (slot-value column 'buffer-length))))
    113113
     114;; dso+
    114115(defmethod get-column-value ((column string-column))
    115   (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) :long)))
     116  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
    116117    (if (= len $SQL_NULL_DATA)
    117       nil
    118       (progn
    119         (get-string (slot-value column 'value-ptr) len)))))
     118        nil
     119        (progn
     120          (get-string (slot-value column 'value-ptr) len)))))
    120121;;;-------------------
    121122;;;   unicode-string
     
    146147          (cffi:foreign-alloc :uchar :count (slot-value column 'buffer-length))))
    147148
     149;; dso+
    148150(defmethod get-column-value ((column unicode-string-column))
    149   (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) :long)))
     151  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
    150152    ;; len is size in bytes, not characters!
    151153    (if (= len $SQL_NULL_DATA)
    152       nil
    153       (progn
    154 ;        (break)
    155         (wchar-bytes-to-string (get-byte-vector (slot-value column 'value-ptr) len))))))
     154        nil
     155        (progn
     156          ;; (break)
     157          (wchar-bytes-to-string (get-byte-vector (slot-value column 'value-ptr) len))))))
    156158
    157159
     
    166168  (declare (ignore args))
    167169  (setf (slot-value column 'c-type) $SQL_C_SLONG)
    168   (setf (slot-value column 'buffer-length)
    169           (cffi:foreign-type-size :long))
    170   (setf (slot-value column 'value-ptr)
    171           (cffi:foreign-alloc :long)))
    172 
    173 
     170  (setf (slot-value column 'buffer-length)
     171        (cffi:foreign-type-size 'sql-integer))
     172  (setf (slot-value column 'value-ptr)
     173        (cffi:foreign-alloc 'sql-integer)))
     174
     175
     176;; dso+
    174177(defmethod get-column-value ((column integer-column))
    175   (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) :long)))
     178  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
    176179    (if (= len $SQL_NULL_DATA)
    177       nil
    178       (cffi:mem-ref (slot-value column 'value-ptr) :long))))
     180        nil
     181        (cffi:mem-ref (slot-value column 'value-ptr) 'sql-integer))))
    179182
    180183
     
    185188(defclass double-column (column) ())
    186189
     190;; dso+
    187191(defmethod initialize-column ((column double-column) args)
    188192  (declare (ignore args))
     
    192196  (setf (slot-value column 'value-ptr) (cffi:foreign-alloc :double)))
    193197
     198;; dso+
    194199(defmethod get-column-value ((column double-column))
    195   ;(%get-long (slot-value column 'ind-ptr))
    196   ;(%get-double-float (slot-value column 'value-ptr))
    197    (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) :long)))
    198      (if (= len $SQL_NULL_DATA)
    199        nil
    200        (progn
    201          (cffi:mem-ref (slot-value column 'value-ptr) :double)))))
     200  ;; (%get-long (slot-value column 'ind-ptr))
     201  ;; (%get-double-float (slot-value column 'value-ptr))
     202  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
     203    (if (= len $SQL_NULL_DATA)
     204        nil
     205        (progn
     206          (cffi:mem-ref (slot-value column 'value-ptr) :double)))))
    202207
    203208;;;------------------------
     
    206211(defclass date-column (column) ())
    207212
     213;; dso+
    208214(defmethod initialize-column ((column date-column) args)
    209215  (declare (ignore args))
     
    213219  (setf (slot-value column 'value-ptr) (cffi:foreign-alloc :uchar :count 32)))
    214220
     221;; dso+
    215222(defmethod get-column-value ((column date-column))
    216    (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) :long)))
     223  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
    217224    (if (= len $SQL_NULL_DATA)
    218       nil
    219       (funcall *universal-time-to-date-dataype*
    220                (timestamp-to-universal-time (slot-value column 'value-ptr))))))
     225        nil
     226        (funcall *universal-time-to-date-dataype*
     227                 (timestamp-to-universal-time (slot-value column 'value-ptr))))))
    221228
    222229;;;--------------------------
     
    251258(defclass bigint-column (column) ())
    252259
     260;; dso+
    253261(defmethod initialize-column ((column bigint-column) args)
    254262  (declare (ignore args))
     
    259267  (setf (slot-value column 'value-ptr) (cffi:foreign-alloc :uchar :count 25)))
    260268
     269;; dso+
    261270(defmethod get-column-value ((column bigint-column))
    262   (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) :long)))
    263     (if (= len $SQL_NULL_DATA) 
    264       nil
    265       (parse-integer (get-string (slot-value column 'value-ptr) len)))))
     271  (let ((len (cffi:mem-ref (slot-value column 'ind-ptr) 'sql-len)))
     272    (if (= len $SQL_NULL_DATA)
     273        nil
     274        (parse-integer (get-string (slot-value column 'value-ptr) len)))))
    266275
    267276;;;----------------------------
     
    403412;;  fetch data via SQlGetData
    404413;; ------------------------------
     414;; dso+
    405415(defun get-character-data (hstmt position value-ptr buffer-length ind-ptr)
    406416  ;; local error handling, we can not use the general error handling
     
    423433                                      ind-ptr)))
    424434      (handle-error sqlret)
    425       (let ((len (cffi:mem-ref ind-ptr :long)))
    426         ;(break)
     435      (let ((len (cffi:mem-ref ind-ptr 'sql-len)))
     436        ;;(break)
    427437        (cond
    428438          ((= len $sql_null_data) nil)
    429           ;; character data has a 0 byte appended, the length does not include it
    430           ;; but it is taken into account when placing the data into the buffer
     439          ;; character data has a 0 byte appended, the length does not
     440          ;; include it but it is taken into account when placing the
     441          ;; data into the buffer
    431442          ((and (/= len $SQL_NO_TOTAL)
    432443                (<= (+ 1 len) buffer-length))
    433             ;; the data fits into the buffer, return it
    434             (get-string value-ptr len))
     444           ;; the data fits into the buffer, return it
     445           (get-string value-ptr len))
    435446         
    436447          ;; we have to fetch the data in several steps
    437448          (t
    438             (let ((sos (make-string-output-stream)))
    439               (loop
    440                 (if (and (= sqlret $SQL_SUCCESS_WITH_INFO)
    441                          (equal (sql-state nil nil hstmt)
    442                                 "01004"))
     449           (let ((sos (make-string-output-stream)))
     450             (loop
     451              (if (and (= sqlret $SQL_SUCCESS_WITH_INFO)
     452                       (equal (sql-state nil nil hstmt)
     453                              "01004"))
    443454                  ;; an 0 byte is append to a string, ignore that
    444455                 
     
    446457                    (write-string str sos)
    447458                    (setf sqlret (%sql-get-data-raw hstmt
    448                                             position
    449                                             $SQL_C_CHAR
    450                                             value-ptr
    451                                             buffer-length
    452                                             ind-ptr))
     459                                                    position
     460                                                    $SQL_C_CHAR
     461                                                    value-ptr
     462                                                    buffer-length
     463                                                    ind-ptr))
    453464                    (handle-error sqlret))
    454465                  (return)))
    455               ;; fetch the last part of the data
    456           (setf len (cffi:mem-ref ind-ptr :long))
    457           (let ((str (get-string value-ptr len)))
    458             (write-string str sos))
    459           (get-output-stream-string sos))))))))
     466             ;; fetch the last part of the data
     467             (setf len (cffi:mem-ref ind-ptr 'sql-len))
     468             (let ((str (get-string value-ptr len)))
     469               (write-string str sos))
     470             (get-output-stream-string sos))))))))
    460471
    461472;;; the version for 16bit unicode
    462473
    463 (defun get-unicode-character-data (hstmt position value-ptr buffer-length ind-ptr)
     474(defun get-unicode-character-data (hstmt position value-ptr buffer-length
     475                                   ind-ptr)
    464476  ;; local error handling, we can not use the general error handling
    465477  ;; since this resets the sql-state
     
    481493                                      ind-ptr)))
    482494      (handle-error sqlret)
    483       (let ((len (cffi:mem-ref ind-ptr :long)))
     495      (let ((len (cffi:mem-ref ind-ptr 'sql-len)))
    484496        (cond
    485497          ((= len $sql_null_data) nil)
    486           ;; character data has a 0 byte appended, the length does not include it
    487           ;; but it is taken into account when placing the data into the buffer
     498          ;; character data has a 0 byte appended, the length does not
     499          ;; include it but it is taken into account when placing the
     500          ;; data into the buffer
    488501          ((and (/= len $SQL_NO_TOTAL)
    489502                (<= (+ 2 len) buffer-length))
    490             ;; the data fits into the buffer, return it
    491             (%get-unicode-string value-ptr len))
     503           ;; the data fits into the buffer, return it
     504           (%get-unicode-string value-ptr len))
    492505         
    493506          ;; we have to fetch the data in several steps
    494507          (t
    495             (let ((sos (make-string-output-stream :element-type 'character)))
    496               (loop
    497                 (if (and (= sqlret $SQL_SUCCESS_WITH_INFO)
    498                          (equal (sql-state nil nil hstmt)
    499                                 "01004"))
     508           (let ((sos (make-string-output-stream :element-type 'character)))
     509             (loop
     510              (if (and (= sqlret $SQL_SUCCESS_WITH_INFO)
     511                       (equal (sql-state nil nil hstmt)
     512                              "01004"))
    500513                  ;; an 0 byte is append to a string, ignore that
    501514                 
    502                   (let ((str (%get-unicode-string value-ptr (- buffer-length 2))))
     515                  (let ((str
     516                         (%get-unicode-string value-ptr (- buffer-length 2))))
    503517                    (write-string str sos)
    504518                    (setf sqlret (%sql-get-data-raw hstmt
    505                                             position
    506                                             $SQL_C_WCHAR
    507                                             value-ptr
    508                                             buffer-length
    509                                             ind-ptr))
     519                                                    position
     520                                                    $SQL_C_WCHAR
     521                                                    value-ptr
     522                                                    buffer-length
     523                                                    ind-ptr))
    510524                    (handle-error sqlret))
    511525                  (return)))
    512               ;; fetch the last part of the data
    513           (setf len (cffi:mem-ref ind-ptr :long))
    514           (let ((str (%get-unicode-string value-ptr len)))
    515             (write-string str sos))
    516           (get-output-stream-string sos))))))))
     526             ;; fetch the last part of the data
     527             (setf len (cffi:mem-ref ind-ptr 'sql-len))
     528             (let ((str (%get-unicode-string value-ptr len)))
     529               (write-string str sos))
     530             (get-output-stream-string sos))))))))
    517531   
     532;; dso+
    518533(defun get-binary-data (hstmt position value-ptr buffer-length ind-ptr)
    519534  ;; local error handling, we can not use the general error handling
     
    530545               (error condition)))))
    531546 
    532   (let* ((sqlret (%sql-get-data-raw hstmt
    533                                     position
    534                                     $SQL_C_BINARY
    535                                     value-ptr
    536                                     buffer-length
    537                                     ind-ptr)))
    538     (handle-error sqlret)
    539     (let ((len (cffi:mem-ref ind-ptr :long)))
    540       (if (= len $sql_null_data)
    541         nil
    542         (let ((res (make-array 0 :element-type '(unsigned-byte 8) :adjustable t))
    543               (res-len 0))
    544           (loop
    545             (if (and (= sqlret $SQL_SUCCESS_WITH_INFO)
    546                      (equal (sql-state nil nil hstmt)
    547                           "01004"))
     547    (let* ((sqlret (%sql-get-data-raw hstmt
     548                                      position
     549                                      $SQL_C_BINARY
     550                                      value-ptr
     551                                      buffer-length
     552                                      ind-ptr)))
     553      (handle-error sqlret)
     554      (let ((len (cffi:mem-ref ind-ptr 'sql-len)))
     555        (if (= len $sql_null_data)
     556            nil
     557            (let ((res (make-array 0
     558                                   :element-type '(unsigned-byte 8)
     559                                   :adjustable t))
     560                  (res-len 0))
     561              (loop
     562               (if (and (= sqlret $SQL_SUCCESS_WITH_INFO)
     563                        (equal (sql-state nil nil hstmt)
     564                               "01004"))
    548565           
    549             (let ((vec (get-byte-vector value-ptr buffer-length)))
    550               (setf res (adjust-array res (+ res-len buffer-length)))
    551               (setf (subseq res res-len (+ res-len buffer-length)) vec)
    552               (setf res-len (length res))
    553               (setf sqlret (%sql-get-data-raw hstmt
    554                                               position
    555                                               $SQL_C_BINARY
    556                                               value-ptr
    557                                               buffer-length
    558                                               ind-ptr))
    559               (handle-error sqlret))
    560             (return)))
     566                   (let ((vec (get-byte-vector value-ptr buffer-length)))
     567                     (setf res (adjust-array res (+ res-len buffer-length)))
     568                     (setf (subseq res res-len (+ res-len buffer-length)) vec)
     569                     (setf res-len (length res))
     570                     (setf sqlret (%sql-get-data-raw hstmt
     571                                                     position
     572                                                     $SQL_C_BINARY
     573                                                     value-ptr
     574                                                     buffer-length
     575                                                     ind-ptr))
     576                     (handle-error sqlret))
     577                   (return)))
    561578       
    562         (setf len (cffi:mem-ref ind-ptr :long))
    563         (let ((vec (get-byte-vector value-ptr len)))
    564           (setf res (adjust-array res (+ res-len len)))
    565           (setf (subseq res res-len (+ res-len len)) vec))
    566         res))))))
    567 
     579              (setf len (cffi:mem-ref ind-ptr 'sql-len))
     580              (let ((vec (get-byte-vector value-ptr len)))
     581                (setf res (adjust-array res (+ res-len len)))
     582                (setf (subseq res res-len (+ res-len len)) vec))
     583              res))))))
  • 64-bit/src/odbc/odbc-main.lisp

    r1 r4  
    455455                (send-parameter-data param hstmt)))))))))
    456456
    457 ;; this functions works only, since we store at
    458 ;; value-ptr the position of the parameter
    459 (defun sql-param-data-position (hstmt) 
    460   (with-temporary-allocations
     457;; this functions works only, since we store at value-ptr the position
     458;; of the parameter
     459;; dso--
     460(defun sql-param-data-position (hstmt)
     461  (with-temporary-allocations
    461462      ((ptr (cffi:foreign-alloc :pointer)))
    462     (let ((res (with-error-handling (:hstmt hstmt) (%sql-param-data hstmt ptr))))
    463       (values res (if (= res $SQL_NEED_DATA)
    464                     (cffi:mem-ref (cffi:mem-ref ptr :pointer) :long  ))))))
     463    (let ((res (with-error-handling (:hstmt hstmt)
     464                   (%sql-param-data hstmt ptr))))
     465      (values res (if (= res $SQL_NEED_DATA)
     466                      (cffi:mem-ref (cffi:mem-ref ptr :pointer) :int32))))))
     467                                        ; TODO: The :int32 above
     468                                        ; should probably be changed!
    465469
    466470(defmethod exec-prepared-query ((query prepared-statement) &rest parameters)
  • 64-bit/src/odbc/parameter.lisp

    r3 r4  
    5656;;;; dso: not so sure about this one and its callers
    5757(defun bind-parameter (hstmt pos param)
    58   (setf (slot-value param 'ind-ptr) 
     58  (setf (slot-value param 'ind-ptr)
    5959        (cffi:foreign-alloc 'sql-len))
    60   (%sql-bind-parameter 
     60  (%sql-bind-parameter
    6161   hstmt
    6262   pos
     
    9797  ())
    9898
     99;; dso+
    99100(defmethod initialize-parameter ((param string-parameter) args)
    100101  (let ((length-of-buffer (or (car args) *default-string-parameter-size*)))
     
    108109      (setf value-ptr (alloc-chars length-of-buffer)))))
    109110
     111;; dso+
    110112(defmethod set-parameter-value ((param string-parameter) value)
    111113  (cond
    112114    ((null value)
    113       (setf  (cffi:mem-ref (slot-value param 'ind-ptr) :long)
    114               $SQL_NULL_DATA)
    115       (put-string (slot-value param 'value-ptr) ""))
    116     (t
    117       (cffi:lisp-string-to-foreign value (slot-value param 'value-ptr) (1+ (length value)))
    118       (setf (cffi:mem-ref (slot-value param 'ind-ptr) :long)
    119               (length  value)))))
    120 
     115     (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)
     116           $SQL_NULL_DATA)
     117     (put-string (slot-value param 'value-ptr) ""))
     118    (t
     119     (cffi:lisp-string-to-foreign value
     120                                  (slot-value param 'value-ptr)
     121                                  (1+ (length value)))
     122     (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)
     123           (length value)))))
     124
     125;; dso+
    121126(defmethod get-parameter-value ((param string-parameter))
    122   (let ((len (cffi:mem-ref (slot-value param 'ind-ptr) :long)))
     127  (let ((len (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)))
    123128    (if (= len $SQL_NULL_DATA)
    124       nil
    125       (progn
    126         (get-string (slot-value param 'value-ptr) len)))))
     129        nil
     130        (progn
     131          (get-string (slot-value param 'value-ptr) len)))))
    127132
    128133;;------------------------
     
    132137  ())
    133138
     139;; dso+
    134140(defmethod initialize-parameter ((param unicode-string-parameter) args)
    135   (let ((length-of-buffer (* 2 (or (car args) *default-string-parameter-size*))))
     141  (let ((length-of-buffer
     142         (* 2 (or (car args) *default-string-parameter-size*))))
    136143    (with-slots (value-type parameter-type buffer-length
    137144                            column-size value-ptr
     
    143150      (setf value-ptr (cffi:foreign-alloc :uint8 :count length-of-buffer)))))
    144151
     152;; dso+
    145153(defmethod set-parameter-value ((param unicode-string-parameter) value)
    146154  (cond
    147155    ((null value)
    148       (setf (cffi:mem-ref (slot-value param 'ind-ptr) :long)
    149               $SQL_NULL_DATA)
    150       ;; not necessary
    151       (%put-unicode-string (slot-value param 'value-ptr) ""))
    152     (t
    153       (%put-unicode-string (slot-value param 'value-ptr) value)
    154       (setf  (cffi:mem-ref (slot-value param 'ind-ptr) :long)
    155               (* 2 (length  value))))))
    156 
     156     (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)
     157           $SQL_NULL_DATA)
     158     ;; not necessary
     159     (%put-unicode-string (slot-value param 'value-ptr) ""))
     160    (t
     161     (%put-unicode-string (slot-value param 'value-ptr) value)
     162     (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)
     163           (* 2 (length value))))))
     164
     165;; dso+
    157166(defmethod get-parameter-value ((param unicode-string-parameter))
    158   (let ((len (cffi:mem-ref (slot-value param 'ind-ptr) :long)))
     167  (let ((len (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)))
    159168    (if (= len $SQL_NULL_DATA)
    160       nil
    161       (progn
    162         (%get-unicode-string (slot-value param 'value-ptr) len)))))
     169        nil
     170        (progn
     171          (%get-unicode-string (slot-value param 'value-ptr) len)))))
    163172
    164173;;----------------------
     
    169178  ())
    170179
     180;; dso+
    171181(defmethod initialize-parameter ((param integer-parameter) args)
    172182  (assert (not args))
     
    179189
    180190(defmethod set-parameter-value ((param integer-parameter) value)
    181   (cond 
     191  (cond
    182192    ((null value)
    183       (setf (cffi:mem-ref (slot-value param 'ind-ptr) :long)
    184               $SQL_NULL_DATA))
    185     (t (setf (cffi:mem-ref (slot-value param 'value-ptr) :long)
    186                value)
    187       (setf (cffi:mem-ref (slot-value param 'ind-ptr) :long) 0))))
     193     (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)
     194           $SQL_NULL_DATA))
     195    (t (setf (cffi:mem-ref (slot-value param 'value-ptr) 'sql-integer)
     196             value)
     197       (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len) 0))))
    188198
    189199(defmethod get-parameter-value ((param integer-parameter))
    190   (let ((len (cffi:mem-ref (slot-value param 'ind-ptr) :long)))
     200  (let ((len (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)))
    191201    (if (= len $SQL_NULL_DATA)
    192       nil
    193       (progn
    194         (cffi:mem-ref (slot-value param 'value-ptr) :long)))))
     202        nil
     203        (progn
     204          (cffi:mem-ref (slot-value param 'value-ptr) 'sql-integer)))))
    195205
    196206
     
    202212  ())
    203213
     214;; dso+
    204215(defmethod initialize-parameter ((param double-parameter) args)
    205216  (assert (not args))
    206    (with-slots (value-type parameter-type buffer-length value-ptr
    207                            ind-ptr) param
    208      (setf value-type $SQL_C_DOUBLE)
    209      (setf parameter-type $SQL_DOUBLE)
    210      (setf buffer-length 8)
    211      (setf value-ptr (cffi:foreign-alloc :double ))))
    212 
     217  (with-slots (value-type parameter-type buffer-length value-ptr
     218                          ind-ptr) param
     219    (setf value-type $SQL_C_DOUBLE)
     220    (setf parameter-type $SQL_DOUBLE)
     221    (setf buffer-length 8)
     222    (setf value-ptr (cffi:foreign-alloc :double))))
     223
     224;; dso+
    213225(defmethod set-parameter-value ((param double-parameter) value)
    214    (cond 
    215      ((null value)
    216        (setf (cffi:mem-ref (slot-value param 'ind-ptr) :long)
    217                $SQL_NULL_DATA))
    218      (t
    219        (setf (cffi:mem-ref (slot-value param 'value-ptr) :double)
    220                (coerce value 'double-float))
    221        (setf (cffi:mem-ref (slot-value param 'ind-ptr) :long) 8))))
    222 
     226  (cond
     227    ((null value)
     228     (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)
     229           $SQL_NULL_DATA))
     230    (t
     231     (setf (cffi:mem-ref (slot-value param 'value-ptr) :double)
     232           (coerce value 'double-float))
     233     (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len) 8))))
     234
     235;; dso+
    223236(defmethod get-parameter-value ((param double-parameter))
    224     (if (= (cffi:mem-ref (slot-value param 'ind-ptr) :long) $SQL_NULL_DATA)
     237  (if (= (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len) $SQL_NULL_DATA)
    225238      nil
    226239      (cffi:mem-ref (slot-value param 'value-ptr) :double)))
     
    243256     (setf value-ptr (cffi:foreign-alloc :uchar :count 24))))
    244257
    245 
     258;; dso+
    246259(defmethod set-parameter-value ((param date-parameter) value)
    247260  (if (null value)
    248     (setf (cffi:mem-ref (slot-value param 'ind-ptr) :long)
     261      (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)
    249262            $SQL_NULL_DATA)
    250     (progn
    251       ;; fixme warum 1?
    252       (setf (cffi:mem-ref (slot-value param 'ind-ptr) :long) 1)
    253       (multiple-value-bind (sec min hour day month year)
    254           (decode-universal-time 
    255            (funcall *date-datatype-to-universal-time* value))
    256         (%put-sql-c-timestamp (slot-value param 'value-ptr) year month day hour min sec 0)))))
    257 
     263      (progn
     264        ;; fixme warum 1?
     265        (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len) 1)
     266        (multiple-value-bind (sec min hour day month year)
     267            (decode-universal-time
     268             (funcall *date-datatype-to-universal-time* value))
     269          (%put-sql-c-timestamp (slot-value param 'value-ptr) year month day hour min sec 0)))))
     270
     271;; dso+
    258272(defmethod get-parameter-value ((param date-parameter))
    259   (let ((len (cffi:mem-ref (slot-value param 'ind-ptr) :long)))
    260     (if (= len $SQL_NULL_DATA) 
    261       nil
    262       (funcall *universal-time-to-date-dataype*
    263                 (timestamp-to-universal-time (slot-value param 'value-ptr))))))
     273  (let ((len (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)))
     274    (if (= len $SQL_NULL_DATA)
     275        nil
     276        (funcall *universal-time-to-date-dataype*
     277                 (timestamp-to-universal-time (slot-value param 'value-ptr))))))
    264278
    265279
Note: See TracChangeset for help on using the changeset viewer.