diff options
| author | Shauren <shauren.trinity@gmail.com> | 2024-04-10 13:59:19 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2024-04-10 16:21:27 +0200 |
| commit | 7c23870f274018138371192b92f600f4b6af687b (patch) | |
| tree | a8fa1b6b185d0ca1b3c006965e6da3469c4054c9 /src/server/database/Database/PreparedStatement.h | |
| parent | 6817ad93d72d09f79e69a840e8eaddaf388c0ee4 (diff) | |
Core/DBLayer: Support retrieving DATE/DATETIME/TIMESTAMP column values directly without casting in sql
(cherry picked from commit 404bb5b3c21b445ae21fbbfcfd7f51d255e07c39)
Diffstat (limited to 'src/server/database/Database/PreparedStatement.h')
| -rw-r--r-- | src/server/database/Database/PreparedStatement.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/server/database/Database/PreparedStatement.h b/src/server/database/Database/PreparedStatement.h index af4db9c310e..004a5d2cbaf 100644 --- a/src/server/database/Database/PreparedStatement.h +++ b/src/server/database/Database/PreparedStatement.h @@ -19,6 +19,7 @@ #define _PREPAREDSTATEMENT_H #include "Define.h" +#include "Duration.h" #include "SQLOperation.h" #include <future> #include <vector> @@ -40,6 +41,7 @@ struct PreparedStatementData double, std::string, std::vector<uint8>, + SystemTimePoint, std::nullptr_t > data; @@ -51,6 +53,7 @@ struct PreparedStatementData static std::string ToString(int8 value); static std::string ToString(std::string const& value); static std::string ToString(std::vector<uint8> const& value); + static std::string ToString(SystemTimePoint value); static std::string ToString(std::nullptr_t); }; @@ -63,21 +66,22 @@ class TC_DATABASE_API PreparedStatementBase explicit PreparedStatementBase(uint32 index, uint8 capacity); virtual ~PreparedStatementBase(); - 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 setStringView(const uint8 index, const std::string_view value); - void setBinary(const uint8 index, const std::vector<uint8>& value); + void setNull(uint8 index); + void setBool(uint8 index, bool value); + void setUInt8(uint8 index, uint8 value); + void setUInt16(uint8 index, uint16 value); + void setUInt32(uint8 index, uint32 value); + void setUInt64(uint8 index, uint64 value); + void setInt8(uint8 index, int8 value); + void setInt16(uint8 index, int16 value); + void setInt32(uint8 index, int32 value); + void setInt64(uint8 index, int64 value); + void setFloat(uint8 index, float value); + void setDouble(uint8 index, double value); + void setDate(uint8 index, SystemTimePoint value); + void setString(uint8 index, std::string const& value); + void setStringView(uint8 index, std::string_view value); + void setBinary(uint8 index, std::vector<uint8> const& value); template <size_t Size> void setBinary(const uint8 index, std::array<uint8, Size> const& value) { |
