Source
(defun build-cursor-get-function (write-fn read-fn)
(lambda (cursor &key key data
;;flags
current first get-both get-both-range
get-recno join-item last
next next-dup next-no-dup
prev prev-no-dup set set-range set-recno
multiple multiple-key rmw not-found)
(let ((key-buffer (when key (alloc-cbuffer)))
(data-buffer (when data (alloc-cbuffer))))
(unwind-protect
(multiple-value-bind (ret-key ret-data)
(db-cursor-get cursor
:key (when key
(funcall write-fn key key-buffer)
key-buffer)
:data (when data
(funcall write-fn data data-buffer)
data-buffer)
:current current :first first
:get-both get-both
:get-both-range get-both-range
:get-recno get-recno :join-item join-item
:last last :next next :next-dup next-dup
:next-no-dup next-no-dup :prev prev
:prev-no-dup prev-no-dup :set set
:set-range set-range :set-recno set-recno
:multiple multiple
:multiple-key multiple-key
:rmw rmw :not-found not-found)
(unwind-protect
(values (funcall read-fn ret-key)
(funcall read-fn ret-data))
(progn
(free-cbuffer ret-key)
(free-cbuffer ret-data))))
(progn
(when data-buffer (free-cbuffer data-buffer))
(when key-buffer (free-cbuffer key-buffer)))))))
Source Context