Skip to content

Commit

Permalink
Fixed a bug in LVDB.DB.FS:GET and changed its interface.
Browse files Browse the repository at this point in the history
LVDB.DB.FS:GET now handles non-existent record properly, and returns two values:
the converted value of the record and whether the record exists.
  • Loading branch information
llibra committed Nov 30, 2011
1 parent 08d6f07 commit f32f108
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/db.lisp
Expand Up @@ -17,9 +17,11 @@
(with-error-pointer (err-ptr)
(let ((val-ptr (leveldb-get db opt key-fs key-len val-len-ptr err-ptr)))
(handle-error-pointer err-ptr)
(with-malloced-pointer (val-ptr)
(let ((val-len (mem-aref val-len-ptr 'size_t)))
(foreign-string->x as val-ptr val-len)))))))
(if (null-pointer-p val-ptr)
(values nil nil)
(with-malloced-pointer (val-ptr)
(let ((val-len (mem-aref val-len-ptr 'size_t)))
(values (foreign-string->x as val-ptr val-len) t))))))))

(in-package :lvdb.db)

Expand Down

0 comments on commit f32f108

Please sign in to comment.