Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
6485f293
Commit
6485f293
authored
May 11, 2010
by
Pieter Noordhuis
Browse files
fix to return error when calling INCR on a non-string type
parent
1b677732
Changes
2
Show whitespace changes
Inline
Side-by-side
redis.c
View file @
6485f293
...
...
@@ -4231,8 +4231,8 @@ static void incrDecrCommand(redisClient *c, long long incr) {
robj *o;
o = lookupKeyWrite(c->db,c->argv[1]);
if (getLongLongFromObjectOrReply(c,
o,
&value,
NULL) != REDIS_OK) return;
if (o != NULL && checkType(c,o,REDIS_STRING)) return;
if (getLongLongFromObjectOrReply(c,o,&value,NULL) != REDIS_OK) return;
value += incr;
o = createObject(REDIS_STRING,sdscatprintf(sdsempty(),"%lld",value));
...
...
test-redis.tcl
View file @
6485f293
...
...
@@ -373,7 +373,7 @@ proc main {} {
test
{
INCR fails against a key holding a list
}
{
$r rpush mylist 1
catch
{
$r
incr
novar
}
err
catch
{
$r
incr
mylist
}
err
$r rpop mylist
format $err
}
{
ERR*
}
...
...
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