diff --git a/CMakeLists.txt b/CMakeLists.txt index 6381c01..b9d44cf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,18 +66,20 @@ else() endif() if (MSVC) - set(CompilerFlags - CMAKE_CXX_FLAGS - CMAKE_CXX_FLAGS_DEBUG - CMAKE_CXX_FLAGS_RELEASE - CMAKE_C_FLAGS - CMAKE_C_FLAGS_DEBUG - CMAKE_C_FLAGS_RELEASE - ) - foreach(CompilerFlag ${CompilerFlags}) - string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") - endforeach() - add_compile_options("/EHsc") #We require exception handling + set(CompilerFlags + CMAKE_CXX_FLAGS + CMAKE_CXX_FLAGS_DEBUG + CMAKE_CXX_FLAGS_RELEASE + CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS + CMAKE_C_FLAGS_DEBUG + CMAKE_C_FLAGS_RELEASE + ) + foreach(CompilerFlag ${CompilerFlags}) + string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}") + endforeach() + add_compile_options("/EHsc") #We require exception handling else() set(CMAKE_CXX_FLAGS_RELEASE "-O3") #-DNDEBUG We want assert! endif() diff --git a/src/query/command3.h b/src/query/command3.h index 590debe..b7bf342 100644 --- a/src/query/command3.h +++ b/src/query/command3.h @@ -4,6 +4,7 @@ #include #include #include +#include #include "escape.h" #include "converters/converter.h" @@ -154,13 +155,16 @@ namespace ts { result.append(this->_identifier); for(auto it = this->bulks.begin(); it != this->bulks.end(); it++) { - if(it->find('=') == std::string::npos && !with_empty) continue; + if(it->empty() && !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("|"); } - this->builded = result; + if(!with_empty && result.ends_with('|')) + this->builded = result.substr(0, result.length() - 1); + else + this->builded = result; return this->builded.value(); } @@ -211,7 +215,7 @@ namespace ts { this->put_unchecked(index, key, std::string_view{data}); } private: - 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} {} + 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} {} 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});