diff --git a/src/misc/strobf.h b/src/misc/strobf.h index f834330..a581bec 100644 --- a/src/misc/strobf.h +++ b/src/misc/strobf.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include #include diff --git a/src/query/command3.h b/src/query/command3.h index ce96e75..1c5cc7f 100644 --- a/src/query/command3.h +++ b/src/query/command3.h @@ -330,10 +330,11 @@ namespace ts { if(it + 1 != this->bulks.end()) result.append("|"); } - if(!with_empty && result.ends_with('|')) + if(!with_empty && !result.empty() && result.back() == '|') { this->builded = result.substr(0, result.length() - 1); - else + } else { this->builded = result; + } this->flag_changed = false; return this->builded.value(); } diff --git a/src/sql/SqlQuery.h b/src/sql/SqlQuery.h index ae8da15..1259c9d 100644 --- a/src/sql/SqlQuery.h +++ b/src/sql/SqlQuery.h @@ -262,7 +262,7 @@ namespace sql { friend class ::sql::command; friend class ::sql::model; public: - explicit command_base(nullptr_t) : _data{nullptr} {} + explicit command_base(std::nullptr_t) : _data{nullptr} {} command_base(SqlManager* handle, const std::string &sql, std::initializer_list values) { assert(handle); @@ -329,7 +329,7 @@ namespace sql { template model(SqlManager* handle, const std::string &sql, Ts... vars) : model(handle, sql, {}) { values(vars...); } - explicit model(nullptr_t) : command_base{nullptr} {}; + explicit model(std::nullptr_t) : command_base{nullptr} {}; //model(const model& v) : command_base{v} {}; //model(model&& v) noexcept : command_base{std::forward(v)} {}; ~model() override = default; diff --git a/src/sql/mysql/MySQL.cpp b/src/sql/mysql/MySQL.cpp index 42a70c2..3b9aa4e 100644 --- a/src/sql/mysql/MySQL.cpp +++ b/src/sql/mysql/MySQL.cpp @@ -707,7 +707,7 @@ result MySQLManager::executeCommand(std::shared_ptr _ptr) { if(!sql::mysql::create_bind(bind_parameter_memory.ptr, mapped_variables)) return {ptr->sql_command, -1, "Failed to allocate bind memory!"}; - ResultBind bind_result_data{.field_count = 0, .memory = nullptr, .descriptors = nullptr}; + ResultBind bind_result_data{0, nullptr, nullptr}; auto connection = this->next_connection(); if(!connection) return {ptr->sql_command, -1, "Could not get a valid connection!"}; @@ -761,7 +761,7 @@ result MySQLManager::queryCommand(shared_ptr _ptr, const QueryCallb FreeGuard bind_parameter_memory{nullptr}; if(!sql::mysql::create_bind(bind_parameter_memory.ptr, mapped_variables)) return {ptr->sql_command, -1, "Failed to allocate bind memory!"}; - ResultBind bind_result_data{.field_count = 0, .memory = nullptr, .descriptors = nullptr}; + ResultBind bind_result_data{0, nullptr, nullptr}; auto connection = this->next_connection(); if(!connection) return {ptr->sql_command, -1, "Could not get a valid connection!"};