Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/query/command3.h
This commit is contained in:
WolverinDEV 2020-02-02 18:38:45 +01:00
commit dd1fafeee9
2 changed files with 23 additions and 17 deletions

View File

@ -70,6 +70,8 @@ if (MSVC)
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS CMAKE_C_FLAGS
CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELEASE

View File

@ -4,6 +4,7 @@
#include <cstddef> #include <cstddef>
#include <vector> #include <vector>
#include <optional> #include <optional>
#include <string_view>
#include "escape.h" #include "escape.h"
#include "converters/converter.h" #include "converters/converter.h"
@ -154,12 +155,15 @@ namespace ts {
result.append(this->_identifier); result.append(this->_identifier);
for(auto it = this->bulks.begin(); it != this->bulks.end(); it++) { 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); 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);
else
this->builded = result; this->builded = result;
return this->builded.value(); return this->builded.value();
} }
@ -211,7 +215,7 @@ namespace ts {
this->put_unchecked(index, key, std::string_view{data}); this->put_unchecked(index, key, std::string_view{data});
} }
private: 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) { 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}); auto escaped_value = ts::query::escape(std::string{value});