aboutsummaryrefslogtreecommitdiff
path: root/src/server/database/Database/MySQLConnection.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2023-04-06 17:46:58 +0200
committerShauren <shauren.trinity@gmail.com>2023-04-06 17:46:58 +0200
commit7b310802583a96dd32841bc396a119fca833e2d4 (patch)
tree990da6afe067b13ad0f24e33ed33c15adc5ad55d /src/server/database/Database/MySQLConnection.cpp
parent74c280da9eac16c5d4a875ff2ea5aa30034ff1dd (diff)
Core/Misc: Modernize code a bit by replacing std::tie with either structured bindings or operator<=>
Diffstat (limited to 'src/server/database/Database/MySQLConnection.cpp')
-rw-r--r--src/server/database/Database/MySQLConnection.cpp6
1 files changed, 3 insertions, 3 deletions
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<unsigned long>(sql.size())))
+ if (mysql_stmt_prepare(stmt, sql.data(), static_cast<unsigned long>(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<MySQLPreparedStatement>(reinterpret_cast<MySQLStmt*>(stmt), sql);
+ m_stmts[index] = std::make_unique<MySQLPreparedStatement>(reinterpret_cast<MySQLStmt*>(stmt), std::string(sql));
}
}