Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to delete all values, Base.drop deprecation, avoid Pkg.dir #11

Merged
merged 6 commits into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/LMDB.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module LMDB
isopen, count, delete!, info, get, show, convert
import Base.Iterators: drop

depsfile = joinpath(dirname(@__FILE__),"..","deps","deps.jl")
depsfile = joinpath(dirname(@__FILE__), "..", "deps", "deps.jl")
if isfile(depsfile)
include(depsfile)
else
Expand Down
4 changes: 2 additions & 2 deletions src/dbi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ function put!(txn::Transaction, dbi::DBI, key, val; flags::Cuint = zero(Cuint))
end

"Delete items from a database"
function delete!(txn::Transaction, dbi::DBI, key, val)
function delete!(txn::Transaction, dbi::DBI, key, val=C_NULL)
mdb_key_ref = Ref(MDBValue(key))
mdb_val_ref = Ref(MDBValue(val))
mdb_val_ref = (val === C_NULL) ? C_NULL : Ref(MDBValue(val))

ret = ccall((:mdb_del, liblmdb), Cint,
(Ptr{Void}, Cuint, Ptr{MDBValue}, Ptr{MDBValue}),
Expand Down
3 changes: 2 additions & 1 deletion test/dbi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module LMDB_DBI
value = get(txn, dbi, k, String)
println("Got value for key $(k): $(value)")
@test value == val*string(k)
delete!(txn, dbi, k)
k += 1
value = get(txn, dbi, k, String)
println("Got value for key $(k): $(value)")
Expand All @@ -60,4 +61,4 @@ module LMDB_DBI
finally
rm(dbname, recursive=true)
end
end
end