Method: (DB-CURSOR-PGET CURSOR)

Source

(defmethod db-cursor-pget ((cursor cursor) &key key pkey
		      ;;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 ((tmp-key-buf (make-get-buffer key))
	(tmp-pkey-buf (make-get-buffer pkey))
	(tmp-data-buf (make-get-buffer nil)))
    (labels ((get-by-buffer (key pkey data)
	       (multiple-value-bind (ret-code key-ptr key-size
					      pkey-ptr pkey-size
					      data-ptr data-size)
		   (%db-cursor-pget cursor
				   (cbuffer-data key) (cbuffer-size key)
				   (cbuffer-length key)
				   (cbuffer-data pkey) (cbuffer-size pkey)
				   (cbuffer-length pkey)
				   (cbuffer-data data) (cbuffer-size data)
				   (cbuffer-length data)
				   :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)
		 (handle-get-code
		  ret-code
		  (lambda () (values (make-cbuffer-from-pointer key-ptr
							   key-size)
				(make-cbuffer-from-pointer pkey-ptr
							   pkey-size)
				(make-cbuffer-from-pointer data-ptr
							   data-size)))
		  (lambda ()
		    (free-cbuffer key)
		    (free-cbuffer pkey)
		    (free-cbuffer data)
		    (handle-error not-found ret-code))
		  (lambda ()
		    (get-by-buffer (cbuffer-ensure-size key key-size)
				   (cbuffer-ensure-size pkey pkey-size)
				   (cbuffer-ensure-size data data-size)))
		  (lambda ()
		    (free-cbuffer key)
		    (free-cbuffer pkey)
		    (free-cbuffer data)
		    (bdb-check-error ret-code))))))
      (get-by-buffer tmp-key-buf tmp-pkey-buf tmp-data-buf))))
Source Context