From 7b310802583a96dd32841bc396a119fca833e2d4 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 6 Apr 2023 17:46:58 +0200 Subject: Core/Misc: Modernize code a bit by replacing std::tie with either structured bindings or operator<=> --- src/server/database/Database/MySQLConnection.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/server/database/Database/MySQLConnection.cpp') diff --git a/src/server/database/Database/MySQLConnection.cpp b/src/server/database/Database/MySQLConnection.cpp index 139b0d45c41..b5600a831ff 100644 --- a/src/server/database/Database/MySQLConnection.cpp +++ b/src/server/database/Database/MySQLConnection.cpp @@ -479,7 +479,7 @@ MySQLPreparedStatement* MySQLConnection::GetPreparedStatement(uint32 index) return ret; } -void MySQLConnection::PrepareStatement(uint32 index, std::string const& sql, ConnectionFlags flags) +void MySQLConnection::PrepareStatement(uint32 index, std::string_view sql, ConnectionFlags flags) { // Check if specified query should be prepared on this connection // i.e. don't prepare async statements on synchronous connections @@ -499,7 +499,7 @@ void MySQLConnection::PrepareStatement(uint32 index, std::string const& sql, Con } else { - if (mysql_stmt_prepare(stmt, sql.c_str(), static_cast(sql.size()))) + if (mysql_stmt_prepare(stmt, sql.data(), static_cast(sql.size()))) { TC_LOG_ERROR("sql.sql", "In mysql_stmt_prepare() id: {}, sql: \"{}\"", index, sql); TC_LOG_ERROR("sql.sql", "{}", mysql_stmt_error(stmt)); @@ -507,7 +507,7 @@ void MySQLConnection::PrepareStatement(uint32 index, std::string const& sql, Con m_prepareError = true; } else - m_stmts[index] = std::make_unique(reinterpret_cast(stmt), sql); + m_stmts[index] = std::make_unique(reinterpret_cast(stmt), std::string(sql)); } } -- cgit v1.2.3