MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / selectCommand

Function selectCommand

src/db.cpp:934–949  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

932}
933
934void selectCommand(client *c) {
935 int id;
936
937 if (getIntFromObjectOrReply(c, c->argv[1], &id, NULL) != C_OK)
938 return;
939
940 if (g_pserver->cluster_enabled && id != 0) {
941 addReplyError(c,"SELECT is not allowed in cluster mode");
942 return;
943 }
944 if (selectDb(c,id) == C_ERR) {
945 addReplyError(c,"DB index is out of range");
946 } else {
947 addReply(c,shared.ok);
948 }
949}
950
951void randomkeyCommand(client *c) {
952 robj *key;

Callers

nothing calls this directly

Calls 4

getIntFromObjectOrReplyFunction · 0.85
addReplyErrorFunction · 0.85
selectDbFunction · 0.85
addReplyFunction · 0.85

Tested by

no test coverage detected