guodongxiaren opened a new issue #1305:
URL: https://github.com/apache/incubator-brpc/issues/1305


   **Describe the bug (描述bug)**
   发现发送MGET的时候,用
   ```
   request->AddCommand("MGET %s", keys.c_str());
   ```
   keys是空格分隔的字符串。包含多个key。
   
   得到了reply总是异常。换成
   ```
   AddCommandByComponents(parts.data(), parts.size()); 
   //parts是vector<butil::StringPiece>的数组
   ```
   可以。解析逻辑相同。
   
   而使用ZRANGE的时候则相反,AddCommandByComponents传入butil::StringPiece凑成`ZRANGE key 0 
-1`会得不到结果,
   ```
   int start = 0;
   int stop = -1;
   ...
   
   butil::StringPiece parts[4];
   parts[0].set("ZRANGE");
   parts[1].set(key.c_str());
   parts[2].set(std::to_string(start).c_str());
   parts[3].set(std::to_string(stop).c_str());
   request->AddCommandByComponents(&parts[0], 4);
   ```
   可以。
   
   而
   ```
   request->AddCommand("ZRANGE %s 0 -1", key.c_str());
   ```
   可以。解析逻辑相同。
   
   
   **To Reproduce (复现方法)**
   
   
   **Expected behavior (期望行为)**
   
   
   **Versions (各种版本)**
   OS:
   Compiler:
   brpc:
   protobuf:
   
   **Additional context/screenshots (更多上下文/截图)**
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to