feat(DBLayer): add support new db api (#19)

This commit is contained in:
Kargatum
2022-02-05 07:17:37 +07:00
committed by GitHub
parent bfbf1d731c
commit 61d13b7ffc
2 changed files with 18 additions and 22 deletions

View File

@@ -88,7 +88,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetBool());
Eluna::Push(L, RESULT->Fetch()[col].Get<bool>());
return 1;
}
@@ -102,7 +102,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetUInt8());
Eluna::Push(L, RESULT->Fetch()[col].Get<uint8>());
return 1;
}
@@ -116,7 +116,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetUInt16());
Eluna::Push(L, RESULT->Fetch()[col].Get<uint16>());
return 1;
}
@@ -130,7 +130,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetUInt32());
Eluna::Push(L, RESULT->Fetch()[col].Get<uint32>());
return 1;
}
@@ -144,7 +144,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetUInt64());
Eluna::Push(L, RESULT->Fetch()[col].Get<uint64>());
return 1;
}
@@ -158,7 +158,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetInt8());
Eluna::Push(L, RESULT->Fetch()[col].Get<int8>());
return 1;
}
@@ -172,7 +172,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetInt16());
Eluna::Push(L, RESULT->Fetch()[col].Get<int16>());
return 1;
}
@@ -186,7 +186,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetInt32());
Eluna::Push(L, RESULT->Fetch()[col].Get<int32>());
return 1;
}
@@ -200,7 +200,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetInt64());
Eluna::Push(L, RESULT->Fetch()[col].Get<int64>());
return 1;
}
@@ -214,7 +214,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetFloat());
Eluna::Push(L, RESULT->Fetch()[col].Get<float>());
return 1;
}
@@ -228,7 +228,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
Eluna::Push(L, RESULT->Fetch()[col].GetDouble());
Eluna::Push(L, RESULT->Fetch()[col].Get<double>());
return 1;
}
@@ -242,12 +242,7 @@ namespace LuaQuery
{
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
#ifndef TRINITY
Eluna::Push(L, RESULT->Fetch()[col].GetString());
#else
Eluna::Push(L, RESULT->Fetch()[col].GetCString());
#endif
Eluna::Push(L, RESULT->Fetch()[col].Get<std::string>());
return 1;
}
@@ -300,7 +295,8 @@ namespace LuaQuery
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, RESULT->GetFieldName(i));
const char* str = row[i].GetCString();
std::string _str = row[i].Get<std::string>();
const char* str = _str.c_str();
if (row[i].IsNull() || !str)
Eluna::Push(L);
else

View File

@@ -7,6 +7,8 @@
#ifndef PLAYERMETHODS_H
#define PLAYERMETHODS_H
#include "GameTime.h"
/***
* Inherits all methods from: [Object], [WorldObject], [Unit]
*/
@@ -2246,11 +2248,9 @@ namespace LuaPlayer
uint32 muteseconds = Eluna::CHECKVAL<uint32>(L, 2);
/*const char* reason = luaL_checkstring(E, 2);*/ // Mangos does not have a reason field in database.
time_t muteTime = time(NULL) + muteseconds;
time_t muteTime = GameTime::GetGameTime().count() + muteseconds;
player->GetSession()->m_muteTime = muteTime;
std::ostringstream oss;
oss << "UPDATE account SET mutetime = " << muteTime << " WHERE id = " << player->GetSession()->GetAccountId();
LoginDatabase.PExecute("%s", oss.str().c_str());
LoginDatabase.Execute("UPDATE account SET mutetime = {} WHERE id = {}", muteTime, player->GetSession()->GetAccountId());
return 0;
}