From cecb36bd68d30408a0741b161318aadc70a81e20 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 2 Mar 2020 22:50:56 +0100 Subject: Core/DBLayer: Use std::variant's stored type instead of relying on our own separate enum for prepared statement parameters (cherry picked from commit 30482038559d65648d9bcfa29cd426a6f266eeba) --- .../database/Database/MySQLPreparedStatement.h | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) (limited to 'src/server/database/Database/MySQLPreparedStatement.h') diff --git a/src/server/database/Database/MySQLPreparedStatement.h b/src/server/database/Database/MySQLPreparedStatement.h index 9a06e7ef92e..d03ce29c480 100644 --- a/src/server/database/Database/MySQLPreparedStatement.h +++ b/src/server/database/Database/MySQLPreparedStatement.h @@ -41,24 +41,16 @@ class TC_DATABASE_API MySQLPreparedStatement void BindParameters(PreparedStatementBase* stmt); - void setNull(const uint8 index); - void setBool(const uint8 index, const bool value); - void setUInt8(const uint8 index, const uint8 value); - void setUInt16(const uint8 index, const uint16 value); - void setUInt32(const uint8 index, const uint32 value); - void setUInt64(const uint8 index, const uint64 value); - void setInt8(const uint8 index, const int8 value); - void setInt16(const uint8 index, const int16 value); - void setInt32(const uint8 index, const int32 value); - void setInt64(const uint8 index, const int64 value); - void setFloat(const uint8 index, const float value); - void setDouble(const uint8 index, const double value); - void setString(const uint8 index, const std::string& value); - void setBinary(const uint8 index, const std::vector& value); - uint32 GetParameterCount() const { return m_paramCount; } protected: + void SetParameter(uint8 index, std::nullptr_t); + void SetParameter(uint8 index, bool value); + template + void SetParameter(uint8 index, T value); + void SetParameter(uint8 index, std::string const& value); + void SetParameter(uint8 index, std::vector const& value); + MySQLStmt* GetSTMT() { return m_Mstmt; } MySQLBind* GetBind() { return m_bind; } PreparedStatementBase* m_stmt; -- cgit v1.2.3