Chore: Remove unused #if statement (TrinityCore, Mangos, AzerothCore, TBC, Classic, Mists, Cata) (#217)

This commit is contained in:
iThorgrim
2025-01-21 17:37:39 +01:00
committed by GitHub
parent 16173cb751
commit 2e89531b05
35 changed files with 60 additions and 2504 deletions

View File

@@ -7,11 +7,7 @@
#ifndef QUERYMETHODS_H
#define QUERYMETHODS_H
#if defined TRINITY || defined AZEROTHCORE
#define RESULT (*result)
#else
#define RESULT result
#endif
/***
* The result of a database query.
@@ -45,11 +41,7 @@ namespace LuaQuery
uint32 col = Eluna::CHECKVAL<uint32>(L, 2);
CheckFields(L, result);
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, RESULT->Fetch()[col].IsNull());
#else
Eluna::Push(L, RESULT->Fetch()[col].IsNULL());
#endif
return 1;
}
@@ -286,13 +278,8 @@ namespace LuaQuery
lua_createtable(L, 0, col);
int tbl = lua_gettop(L);
#if !defined TRINITY && !AZEROTHCORE
const QueryFieldNames& names = RESULT->GetFieldNames();
#endif
for (uint32 i = 0; i < col; ++i)
{
#if defined TRINITY || AZEROTHCORE
Eluna::Push(L, RESULT->GetFieldName(i));
std::string _str = row[i].Get<std::string>();
@@ -304,50 +291,12 @@ namespace LuaQuery
// MYSQL_TYPE_LONGLONG Interpreted as string for lua
switch (row[i].GetType())
{
#if defined TRINITY || AZEROTHCORE
case DatabaseFieldTypes::Int8:
case DatabaseFieldTypes::Int16:
case DatabaseFieldTypes::Int32:
case DatabaseFieldTypes::Int64:
case DatabaseFieldTypes::Float:
case DatabaseFieldTypes::Double:
#else
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_YEAR:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_LONGLONG:
case MYSQL_TYPE_BIT:
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE:
case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_NEWDECIMAL:
#endif
Eluna::Push(L, strtod(str, NULL));
break;
default:
Eluna::Push(L, str);
break;
}
}
#else
Eluna::Push(L, names[i]);
const char* str = row[i].GetString();
if (row[i].IsNULL() || !str)
Eluna::Push(L);
else
{
// MYSQL_TYPE_LONGLONG Interpreted as string for lua
switch (row[i].GetType())
{
case MYSQL_TYPE_TINY:
case MYSQL_TYPE_SHORT:
case MYSQL_TYPE_INT24:
case MYSQL_TYPE_LONG:
case MYSQL_TYPE_FLOAT:
case MYSQL_TYPE_DOUBLE:
Eluna::Push(L, strtod(str, NULL));
break;
default:
@@ -355,8 +304,6 @@ namespace LuaQuery
break;
}
}
#endif
lua_rawset(L, tbl);
}