From 6604c1554ee0dee27a2aa9f521955670c652e8d1 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Sun, 2 Feb 2020 18:33:17 +0100 Subject: [PATCH] Improved command building & fixed native client crash --- CMakeLists.txt | 2 +- src/query/command3.h | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e5b6866..6381c01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ find_package(DataPipes REQUIRED) include_directories(${DataPipes_INCLUDE_DIR}) # LibEvent fucks up the CMAKE_FIND_LIBRARY_SUFFIXES variable -if (NOT find_event AND FALSE) +if (NOT find_event) function(find_event static) if(static) set(LIBEVENT_STATIC_LINK TRUE) diff --git a/src/query/command3.h b/src/query/command3.h index 5bc8e80..0efe837 100644 --- a/src/query/command3.h +++ b/src/query/command3.h @@ -154,11 +154,11 @@ namespace ts { result.append(this->_identifier); for(auto it = this->bulks.begin(); it != this->bulks.end(); it++) { - if(it->empty() && !with_empty) continue; + if(it->find(' ') == std::string::npos && !with_empty) continue; + if(it != this->bulks.begin()) + result.append(" |"); result.append(*it, 0, it->length() - 1); - if(it + 1 != this->bulks.end()) - result.append("|"); } if(!with_empty && result.ends_with('|')) this->builded = result.substr(0, result.length() - 1); @@ -214,7 +214,7 @@ namespace ts { this->put_unchecked(index, key, std::string_view{data}); } private: - command_builder_impl(size_t expected, size_t identifier, vector_t::iterator begin, vector_t::iterator end) : expected_bulk_size{expected}, _identifier{identifier}, bulks{begin, end} {} + command_builder_impl(size_t expected, size_t identifier, typename vector_t::iterator begin, typename vector_t::iterator end) : expected_bulk_size{expected}, _identifier{identifier}, bulks{begin, end} {} void impl_put_unchecked(std::string& data, size_t index, const std::string_view& key, const std::string_view& value) { auto escaped_value = ts::query::escape(std::string{value});