mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-14 01:29:07 +00:00
feat(Core/Database): add support set arguments for PrepareStatment (#10066)
- partical cherrypick 0b3f073ca2
This commit is contained in:
@@ -29,6 +29,52 @@ m_index(index), statement_data(capacity) { }
|
||||
PreparedStatementBase::~PreparedStatementBase() { }
|
||||
|
||||
//- Bind to buffer
|
||||
template<typename T>
|
||||
Acore::Types::is_non_string_view_v<T> PreparedStatementBase::SetValidData(const uint8 index, T const& value)
|
||||
{
|
||||
ASSERT(index < statement_data.size());
|
||||
statement_data[index].data.emplace<T>(value);
|
||||
}
|
||||
|
||||
template<>
|
||||
void PreparedStatementBase::SetValidData(const uint8 index, std::string const& value)
|
||||
{
|
||||
ASSERT(index < statement_data.size());
|
||||
statement_data[index].data.emplace<std::string>(value);
|
||||
}
|
||||
|
||||
template<>
|
||||
void PreparedStatementBase::SetValidData(const uint8 index, std::vector<uint8> const& value)
|
||||
{
|
||||
ASSERT(index < statement_data.size());
|
||||
statement_data[index].data.emplace<std::vector<uint8>>(value);
|
||||
}
|
||||
|
||||
// Non template functions
|
||||
void PreparedStatementBase::SetValidData(const uint8 index)
|
||||
{
|
||||
ASSERT(index < statement_data.size());
|
||||
statement_data[index].data.emplace<std::nullptr_t>(nullptr);
|
||||
}
|
||||
|
||||
void PreparedStatementBase::SetValidData(const uint8 index, std::string_view value)
|
||||
{
|
||||
ASSERT(index < statement_data.size());
|
||||
statement_data[index].data.emplace<std::string>(value);
|
||||
}
|
||||
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, uint8 const& value);
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, int8 const& value);
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, uint16 const& value);
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, int16 const& value);
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, uint32 const& value);
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, int32 const& value);
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, uint64 const& value);
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, int64 const& value);
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, bool const& value);
|
||||
template void PreparedStatementBase::SetValidData(const uint8 index, float const& value);
|
||||
|
||||
// Old api
|
||||
void PreparedStatementBase::setBool(const uint8 index, const bool value)
|
||||
{
|
||||
ASSERT(index < statement_data.size());
|
||||
|
||||
Reference in New Issue
Block a user