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
699465c3
Commit
699465c3
authored
Mar 06, 2011
by
Pieter Noordhuis
Browse files
Store SELECTed database for reconnect (issue #468)
parent
45332cc4
Changes
1
Show whitespace changes
Inline
Side-by-side
src/redis-cli.c
View file @
699465c3
...
...
@@ -264,11 +264,9 @@ static int cliAuth() {
/* Send SELECT dbnum to the server */
static int cliSelect() {
redisReply *reply;
char
dbnum
[
16
];
if (config.dbnum == 0) return REDIS_OK;
snprintf
(
dbnum
,
sizeof
(
dbnum
),
"%d"
,
config
.
dbnum
);
reply
=
redisCommand
(
context
,
"SELECT %s"
,
dbnum
);
reply = redisCommand(context,"SELECT %d",config.dbnum);
if (reply != NULL) {
freeReplyObject(reply);
return REDIS_OK;
...
...
@@ -492,6 +490,10 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
if (cliReadReply(output_raw) != REDIS_OK) {
free(argvlen);
return REDIS_ERR;
} else {
/* Store database number when SELECT was successfully executed. */
if (!strcasecmp(command,"select") && argc == 2)
config.dbnum = atoi(argv[1]);
}
}
...
...
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