Ignore:
Timestamp:
02/19/2008 08:12:24 PM (18 years ago)
Author:
raverkamp
revision id:
svn-v3-trunk1:1c22b0a8-4d0b-0410-a296-af6a2e6f35e3:plain-odbc%2Ftrunk:11
Message:

fixed lob parameter handling, fixed tests so they run with sbcl

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/src/odbc/parameter.lisp

    r3 r6  
    305305
    306306
     307
     308;;; LOB parameters
     309;;; lob parameters are handled differently, the buffer is not filled with the
     310;;; parameters value but we send data at execution time.
     311;;; This is done with the call:
     312;;; (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)
     313;;;              (%sql-len-data-at-exec (length value))))))
     314;;; At execution time the result of %sql-execute or %sql-exec-direct
     315;;; is $SQL_NEED_DATA.
     316;;; The next call to %sql-param-data gives the address of the data buffer
     317;;; of the needed bind parameter.
     318;;; For the LOB parameters we store in this buffer the position of the
     319;;; bind parameter. At execution time we get the buffer address of the
     320;;; bind parameter. From this buffer we retrieve the parameter position
     321;;; and so we know which parameter to send.
     322;;; see functions exec-sql-statement and sql-param-data-position
     323;;; in odbc-main.lisp
     324;;; there is also the Microsoft documentation on SQLPutData, SQLParamData,
     325;;;  SQL_NEED_DATA  and etc.
     326
    307327;;;-----------------------
    308328;;;    clob parameter
     
    315335
    316336(defclass clob-parameter (lob-parameter) ())
    317 
    318337
    319338(defmethod initialize-parameter ((param clob-parameter) args)
     
    325344    ;; the value-ptr will be needed to find the parameter, 
    326345    ;; we store the position there
    327     (setf buffer-length (cffi:foreign-type-size 'sql-pointer))
    328     (setf value-ptr (cffi:foreign-alloc 'sql-pointer))))
     346    (setf buffer-length (cffi:foreign-type-size :long))
     347    (setf value-ptr (cffi:foreign-alloc :long))))
    329348
    330349(defmethod set-parameter-value ((param clob-parameter) value)
     
    375394    ;; the value-ptr will be needed to find the parameter, 
    376395    ;; we store the position there
    377     (setf buffer-length (cffi:foreign-type-size 'sql-pointer))
    378     (setf value-ptr (cffi:foreign-alloc 'sql-pointer))))
     396    (setf buffer-length (cffi:foreign-type-size :long))
     397    (setf value-ptr (cffi:foreign-alloc ':long))))
    379398
    380399(defmethod set-parameter-value ((param uclob-parameter) value)
     
    384403    (progn
    385404      (setf (slot-value param 'temp-val) value)
    386       (setf (cffi:mem-ref (slot-value param 'value-ptr) ':long)
     405      (setf (cffi:mem-ref (slot-value param 'value-ptr) :long)
    387406              (slot-value param 'position))
    388407      (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len)
     
    424443    ;; the value-ptr will be needed to find the parameter,
    425444    ;; we store the position there
    426     (setf buffer-length (cffi:foreign-type-size 'sql-pointer))
    427     (setf value-ptr (cffi:foreign-alloc 'sql-pointer)))
     445    (setf buffer-length (cffi:foreign-type-size :long))
     446    (setf value-ptr (cffi:foreign-alloc :long)))
    428447)
    429448
Note: See TracChangeset for help on using the changeset viewer.