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
e584d82f
Commit
e584d82f
authored
Oct 26, 2010
by
Pieter Noordhuis
Browse files
Return error to client on wrong type for HMGET
parent
244201f6
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/t_hash.c
View file @
e584d82f
...
@@ -310,6 +310,7 @@ void hmgetCommand(redisClient *c) {
...
@@ -310,6 +310,7 @@ void hmgetCommand(redisClient *c) {
o
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
1
]);
o
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
1
]);
if
(
o
!=
NULL
&&
o
->
type
!=
REDIS_HASH
)
{
if
(
o
!=
NULL
&&
o
->
type
!=
REDIS_HASH
)
{
addReply
(
c
,
shared
.
wrongtypeerr
);
addReply
(
c
,
shared
.
wrongtypeerr
);
return
;
}
}
/* Note the check for o != NULL happens inside the loop. This is
/* Note the check for o != NULL happens inside the loop. This is
...
...
tests/unit/type/hash.tcl
View file @
e584d82f
...
@@ -140,6 +140,11 @@ start_server {tags {"hash"}} {
...
@@ -140,6 +140,11 @@ start_server {tags {"hash"}} {
set _ $rv
set _ $rv
}
{{{}
{}}
{{}
{}}
{{}
{}}}
}
{{{}
{}}
{{}
{}}
{{}
{}}}
test
{
HMGET against wrong type
}
{
r set wrongtype somevalue
assert_error
"*wrong*"
{
r hmget wrongtype field1 field2
}
}
test
{
HMGET - small hash
}
{
test
{
HMGET - small hash
}
{
set keys
{}
set keys
{}
set vals
{}
set vals
{}
...
...
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