A cursor get() of an undefined Key will position the cursor.

This commit is contained in:
Gregory Burd 2011-12-03 09:44:59 -05:00
parent b70d9b8afa
commit eed6dfdf3a

View file

@ -1374,7 +1374,12 @@ cursor_get(Key) ->
not_found | {ok, db_key(), db_value()} | db_error().
cursor_get(Key, Opts) ->
{KeyLen, KeyBin} = to_binary(Key),
case Key of
undefined ->
{KeyLen, KeyBin} = {0, <<>>};
_ ->
{KeyLen, KeyBin} = to_binary(Key)
end,
Flags = process_flags(Opts),
Cmd = <<Flags:32/native, KeyLen:32/native, KeyBin/bytes>>,
<<Result:32/signed-native>> = erlang:port_control(get_port(), ?CMD_CURSOR_GET, Cmd),