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
d922ae65
Commit
d922ae65
authored
Dec 18, 2009
by
antirez
Browse files
Now SORT returns an empty bulk reply if the key does not exist
parent
04c71068
Changes
2
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
d922ae65
...
@@ -4839,7 +4839,7 @@ static void sortCommand(redisClient *c) {
...
@@ -4839,7 +4839,7 @@ static void sortCommand(redisClient *c) {
/* Lookup the key to sort. It must be of the right types */
/* Lookup the key to sort. It must be of the right types */
sortval
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
1
]);
sortval
=
lookupKeyRead
(
c
->
db
,
c
->
argv
[
1
]);
if
(
sortval
==
NULL
)
{
if
(
sortval
==
NULL
)
{
addReply
(
c
,
shared
.
n
okeyerr
);
addReply
(
c
,
shared
.
n
ullmultibulk
);
return
;
return
;
}
}
if
(
sortval
->
type
!=
REDIS_SET
&&
sortval
->
type
!=
REDIS_LIST
&&
if
(
sortval
->
type
!=
REDIS_SET
&&
sortval
->
type
!=
REDIS_LIST
&&
...
...
test-redis.tcl
View file @
d922ae65
...
@@ -962,6 +962,10 @@ proc main {server port} {
...
@@ -962,6 +962,10 @@ proc main {server port} {
$r sort mylist BY weight_* GET #
$r sort mylist BY weight_* GET #
}
{
2 1 3
}
}
{
2 1 3
}
test
{
SORT with constant GET
}
{
$r sort mylist GET foo
}
{{}
{}
{}}
test
{
LREM, remove all the occurrences
}
{
test
{
LREM, remove all the occurrences
}
{
$r flushdb
$r flushdb
$r rpush mylist foo
$r rpush mylist foo
...
...
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