fixed DELETE for a nonexistent entry
This commit is contained in:
parent
317b78815a
commit
a94bdc6ca2
2 changed files with 6 additions and 1 deletions
|
@ -118,7 +118,9 @@ sub STORE {
|
||||||
|
|
||||||
sub DELETE {
|
sub DELETE {
|
||||||
my ($self, $key) = @_;
|
my ($self, $key) = @_;
|
||||||
my $prev = $self->kv_fetch($key);
|
my $prev = $self->[1]->kv_fetch($key);
|
||||||
|
my $errstr = $self->[1]->errstr;
|
||||||
|
return if $errstr && $errstr eq 'UNQLITE_NOTFOUND';
|
||||||
$self->[1]->kv_delete($key) or Carp::croak $self->[1]->errstr;
|
$self->[1]->kv_delete($key) or Carp::croak $self->[1]->errstr;
|
||||||
$prev;
|
$prev;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,9 @@ my $tmp = tempdir( CLEANUP => 1 );
|
||||||
is($hash{yay}, 'yappo');
|
is($hash{yay}, 'yappo');
|
||||||
$hash{foo} = 'baz';
|
$hash{foo} = 'baz';
|
||||||
is($hash{foo}, 'baz');
|
is($hash{foo}, 'baz');
|
||||||
|
$hash{delete} = 'delete';
|
||||||
|
is(delete $hash{delete}, 'delete');
|
||||||
|
is(delete $hash{delete}, undef);
|
||||||
|
|
||||||
is(join(" ", sort keys %hash), "foo yay");
|
is(join(" ", sort keys %hash), "foo yay");
|
||||||
is(join(" ", sort values %hash), "baz yappo");
|
is(join(" ", sort values %hash), "baz yappo");
|
||||||
|
|
Loading…
Add table
Reference in a new issue