Commit 981953a6 authored by Maxim Galushka's avatar Maxim Galushka Committed by Oran Agra
Browse files

redis-cli: support for REDIS_REPLY_SET in CSV and RAW output. (#7338)

Fixes #6792. Added support of REDIS_REPLY_SET in raw and csv output of `./redis-cli`

Test:

run commands to test:
  ./redis-cli -3 --csv COMMAND
  ./redis-cli -3 --raw COMMAND

Now they are returning resuts, were failing with: "Unknown reply type: 10" before the change.

(cherry picked from commit 96bb0785)
parent da127ed3
...@@ -1124,6 +1124,7 @@ static sds cliFormatReplyRaw(redisReply *r) { ...@@ -1124,6 +1124,7 @@ static sds cliFormatReplyRaw(redisReply *r) {
case REDIS_REPLY_DOUBLE: case REDIS_REPLY_DOUBLE:
out = sdscatprintf(out,"%s",r->str); out = sdscatprintf(out,"%s",r->str);
break; break;
case REDIS_REPLY_SET:
case REDIS_REPLY_ARRAY: case REDIS_REPLY_ARRAY:
for (i = 0; i < r->elements; i++) { for (i = 0; i < r->elements; i++) {
if (i > 0) out = sdscat(out,config.mb_delim); if (i > 0) out = sdscat(out,config.mb_delim);
...@@ -1181,6 +1182,7 @@ static sds cliFormatReplyCSV(redisReply *r) { ...@@ -1181,6 +1182,7 @@ static sds cliFormatReplyCSV(redisReply *r) {
out = sdscat(out,r->integer ? "true" : "false"); out = sdscat(out,r->integer ? "true" : "false");
break; break;
case REDIS_REPLY_ARRAY: case REDIS_REPLY_ARRAY:
case REDIS_REPLY_SET:
case REDIS_REPLY_MAP: /* CSV has no map type, just output flat list. */ case REDIS_REPLY_MAP: /* CSV has no map type, just output flat list. */
for (i = 0; i < r->elements; i++) { for (i = 0; i < r->elements; i++) {
sds tmp = cliFormatReplyCSV(r->element[i]); sds tmp = cliFormatReplyCSV(r->element[i]);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment