Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
9c3a8985
Commit
9c3a8985
authored
Jul 27, 2011
by
Pieter Noordhuis
Browse files
HDEL: Abort deleting fields when hash is removed
parent
7ca66723
Changes
2
Show whitespace changes
Inline
Side-by-side
src/t_hash.c
View file @
9c3a8985
...
...
@@ -403,8 +403,11 @@ void hdelCommand(redisClient *c) {
for
(
j
=
2
;
j
<
c
->
argc
;
j
++
)
{
if
(
hashTypeDelete
(
o
,
c
->
argv
[
j
]))
{
if
(
hashTypeLength
(
o
)
==
0
)
dbDelete
(
c
->
db
,
c
->
argv
[
1
]);
deleted
++
;
if
(
hashTypeLength
(
o
)
==
0
)
{
dbDelete
(
c
->
db
,
c
->
argv
[
1
]);
break
;
}
}
}
if
(
deleted
)
{
...
...
tests/unit/type/hash.tcl
View file @
9c3a8985
...
...
@@ -235,6 +235,13 @@ start_server {tags {"hash"}} {
r hgetall myhash
}
{
b 2
}
test
{
HDEL - hash becomes empty before deleting all specified fields
}
{
r del myhash
r hmset myhash a 1 b 2 c 3
assert_equal 3
[
r hdel myhash a b c d e
]
assert_equal 0
[
r exists myhash
]
}
test
{
HEXISTS
}
{
set rv
{}
set k
[
lindex
[
array names smallhash *
]
0
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment