Commit 47e3a8f39f136635d594212fbab36be3c0ea95bc

Authored by Hayk Martirosyan
1 parent 7a15a7f2

Explicitly use quotes in wrapper methods

Showing 1 changed file with 4 additions and 4 deletions
src/client.cpp
... ... @@ -493,7 +493,7 @@ bool Redox::commandSync(const string& cmd) {
493 493  
494 494 string Redox::get(const string& key) {
495 495  
496   - Command<char*>& c = commandSync<char*>("GET " + key);
  496 + Command<char*>& c = commandSync<char*>("GET \"" + key + '"');
497 497 if(!c.ok()) {
498 498 throw runtime_error("[FATAL] Error getting key " + key + ": Status code " + to_string(c.status()));
499 499 }
... ... @@ -503,15 +503,15 @@ string Redox::get(const string&amp; key) {
503 503 };
504 504  
505 505 bool Redox::set(const string& key, const string& value) {
506   - return commandSync("SET " + key + " " + value);
  506 + return commandSync("SET " + key + " \"" + value + '"');
507 507 }
508 508  
509 509 bool Redox::del(const string& key) {
510   - return commandSync("DEL " + key);
  510 + return commandSync("DEL \"" + key + '"');
511 511 }
512 512  
513 513 void Redox::publish(const string& topic, const string& msg) {
514   - command<redisReply*>("PUBLISH " + topic + " " + msg);
  514 + command<redisReply*>("PUBLISH " + topic + " \"" + msg + '"');
515 515 }
516 516  
517 517 } // End namespace redis
... ...