Changeset cffi,6 for cffi/src/odbc/parameter.lisp
- Timestamp:
- 02/19/2008 08:12:24 PM (18 years ago)
- revision id:
- svn-v3-trunk1:1c22b0a8-4d0b-0410-a296-af6a2e6f35e3:plain-odbc%2Ftrunk:11
- File:
-
- 1 edited
-
cffi/src/odbc/parameter.lisp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cffi/src/odbc/parameter.lisp
r3 r6 305 305 306 306 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 307 327 ;;;----------------------- 308 328 ;;; clob parameter … … 315 335 316 336 (defclass clob-parameter (lob-parameter) ()) 317 318 337 319 338 (defmethod initialize-parameter ((param clob-parameter) args) … … 325 344 ;; the value-ptr will be needed to find the parameter, 326 345 ;; 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)))) 329 348 330 349 (defmethod set-parameter-value ((param clob-parameter) value) … … 375 394 ;; the value-ptr will be needed to find the parameter, 376 395 ;; 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)))) 379 398 380 399 (defmethod set-parameter-value ((param uclob-parameter) value) … … 384 403 (progn 385 404 (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) 387 406 (slot-value param 'position)) 388 407 (setf (cffi:mem-ref (slot-value param 'ind-ptr) 'sql-len) … … 424 443 ;; the value-ptr will be needed to find the parameter, 425 444 ;; 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))) 428 447 ) 429 448
Note: See TracChangeset
for help on using the changeset viewer.
