MCPcopy Create free account
hub / github.com/cinience/RedisStudio / GetData

Method GetData

RedisStudio/Redis/RedisZSetModel.cpp:9–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7}
8
9bool RedisZSetModel::GetData( const std::string& key, RedisResult& results )
10{
11 bool retVal = false;
12 redisReply* reply = GetClient()->Command("ZREVRANGE %s %d %d WITHSCORES", key.c_str(), 0, -1);
13 if (!reply) return retVal;
14
15 results.NewColumn("Score");
16 results.NewColumn("Value");
17 if (reply->type == REDIS_REPLY_ARRAY)
18 {
19 std::size_t i = 0;
20 redisReply* tmpReply ;
21 while (i < reply->elements)
22 {
23 tmpReply = reply->element[i];
24 if (i%2 == 0)
25 {
26 results.NewRow();
27
28 string& myvalue = results.Value(results.RowSize()-1, 1);
29 myvalue.assign(tmpReply->str, tmpReply->len);
30 }
31 else
32 {
33 string& myvalue = results.Value(results.RowSize()-1, 0);
34 myvalue.assign(tmpReply->str, tmpReply->len);
35 }
36 i++;
37 }
38 retVal = true;
39 }
40 freeReplyObject(reply);
41 return retVal;
42}
43
44bool RedisZSetModel::UpdateData(const std::string& key,
45 const std::string& oldValue,

Callers

nothing calls this directly

Calls 6

freeReplyObjectFunction · 0.85
CommandMethod · 0.80
NewColumnMethod · 0.80
NewRowMethod · 0.80
ValueMethod · 0.80
RowSizeMethod · 0.80

Tested by

no test coverage detected