Compare commits

..

10 Commits

262 changed files with 23852 additions and 18257 deletions
+1 -14
View File
@@ -55,7 +55,6 @@ FIND_PACKAGE(MariaDB)
FIND_PACKAGE(ZLIB) FIND_PACKAGE(ZLIB)
FIND_PACKAGE(OpenSSL) FIND_PACKAGE(OpenSSL)
FIND_PACKAGE(Lua51) FIND_PACKAGE(Lua51)
FIND_PACKAGE(LuaJit)
FIND_PACKAGE(PerlLibs) FIND_PACKAGE(PerlLibs)
FIND_PACKAGE(Sodium) FIND_PACKAGE(Sodium)
FIND_PACKAGE(mbedTLS) FIND_PACKAGE(mbedTLS)
@@ -88,12 +87,6 @@ ELSE()
MESSAGE(STATUS "* Lua: MISSING *") MESSAGE(STATUS "* Lua: MISSING *")
ENDIF() ENDIF()
IF(LuaJit_FOUND)
MESSAGE(STATUS "* LuaJIT: FOUND *")
ELSE()
MESSAGE(STATUS "* LuaJIT: MISSING *")
ENDIF()
IF(PerlLibs_FOUND) IF(PerlLibs_FOUND)
MESSAGE(STATUS "* Perl: FOUND *") MESSAGE(STATUS "* Perl: FOUND *")
ELSE() ELSE()
@@ -129,7 +122,6 @@ OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF) OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF) OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON) OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
IF(EQEMU_COMMANDS_LOGGING) IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING) ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
@@ -220,12 +212,7 @@ ELSE()
SET(SODIUM_LIBRARY_ENABLED OFF) SET(SODIUM_LIBRARY_ENABLED OFF)
ENDIF() ENDIF()
IF(LUAJIT_FOUND AND NOT (EQEMU_PREFER_LUA AND Lua51_FOUND)) IF(Lua51_FOUND)
SET(LUA_LIBRARY_TYPE " LuaJIT")
SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUAJIT_LIBRARY} luabind)
SET(LUA_LIBRARY_INCLUDE ${LUAJIT_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
ELSEIF(Lua51_FOUND )
SET(LUA_LIBRARY_TYPE " Lua 5.1") SET(LUA_LIBRARY_TYPE " Lua 5.1")
SET(LUA_LIBRARY_ENABLED ON) SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind) SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind)
+2 -2
View File
@@ -38,7 +38,7 @@ locations other than lua/
find_path(LUA_INCLUDE_DIR lua.h find_path(LUA_INCLUDE_DIR lua.h
HINTS HINTS
ENV LUA_DIR ENV LUA_DIR
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include/luajit include
PATHS PATHS
~/Library/Frameworks ~/Library/Frameworks
/Library/Frameworks /Library/Frameworks
@@ -49,7 +49,7 @@ find_path(LUA_INCLUDE_DIR lua.h
) )
find_library(LUA_LIBRARY find_library(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua NAMES lua51 lua5.1 lua-5.1 lua luajit
HINTS HINTS
ENV LUA_DIR ENV LUA_DIR
PATH_SUFFIXES lib PATH_SUFFIXES lib
-91
View File
@@ -1,91 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Modified from the FindLua51 that comes with CMake
#[=======================================================================[.rst:
FindLuaJit
---------
Locate LuaJit library This module defines
::
LUAJIT_FOUND, if false, do not try to link to Lua
LUAJIT_LIBRARIES
LUAJIT_INCLUDE_DIR, where to find lua.h
LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
Note that the expected include convention is
::
#include "lua.h"
and not
::
#include <lua/lua.h>
This is because, the lua location is not standardized and may exist in
locations other than lua/
#]=======================================================================]
find_path(LUAJIT_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUAJIT_LIBRARY
NAMES luajit51 luajit5.1 luajit-5.1 luajit
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUAJIT_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(LUAJIT_MATH_LIBRARY m)
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit
REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR
VERSION_VAR LUAJIT_VERSION_STRING)
mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
+2 -12
View File
@@ -148,7 +148,6 @@ SET(repositories
repositories/base/base_character_currency_repository.h repositories/base/base_character_currency_repository.h
repositories/base/base_character_data_repository.h repositories/base/base_character_data_repository.h
repositories/base/base_character_disciplines_repository.h repositories/base/base_character_disciplines_repository.h
repositories/base/base_character_expedition_lockouts_repository.h
repositories/base/base_character_inspect_messages_repository.h repositories/base/base_character_inspect_messages_repository.h
repositories/base/base_character_item_recast_repository.h repositories/base/base_character_item_recast_repository.h
repositories/base/base_character_languages_repository.h repositories/base/base_character_languages_repository.h
@@ -167,16 +166,11 @@ SET(repositories
repositories/base/base_char_recipe_list_repository.h repositories/base/base_char_recipe_list_repository.h
repositories/base/base_completed_tasks_repository.h repositories/base/base_completed_tasks_repository.h
repositories/base/base_content_flags_repository.h repositories/base/base_content_flags_repository.h
repositories/base/base_damageshieldtypes_repository.h
repositories/base/base_data_buckets_repository.h repositories/base/base_data_buckets_repository.h
repositories/base/base_db_str_repository.h repositories/base/base_db_str_repository.h
repositories/base/base_discovered_items_repository.h repositories/base/base_discovered_items_repository.h
repositories/base/base_doors_repository.h repositories/base/base_doors_repository.h
repositories/base/base_dynamic_zones_repository.h
repositories/base/base_eventlog_repository.h repositories/base/base_eventlog_repository.h
repositories/base/base_expeditions_repository.h
repositories/base/base_expedition_lockouts_repository.h
repositories/base/base_expedition_members_repository.h
repositories/base/base_faction_base_data_repository.h repositories/base/base_faction_base_data_repository.h
repositories/base/base_faction_list_repository.h repositories/base/base_faction_list_repository.h
repositories/base/base_faction_list_mod_repository.h repositories/base/base_faction_list_mod_repository.h
@@ -273,6 +267,7 @@ SET(repositories
repositories/base/base_traps_repository.h repositories/base/base_traps_repository.h
repositories/base/base_tributes_repository.h repositories/base/base_tributes_repository.h
repositories/base/base_tribute_levels_repository.h repositories/base/base_tribute_levels_repository.h
repositories/base/base_variables_repository.h
repositories/base/base_veteran_reward_templates_repository.h repositories/base/base_veteran_reward_templates_repository.h
repositories/base/base_zone_repository.h repositories/base/base_zone_repository.h
repositories/base/base_zone_points_repository.h repositories/base/base_zone_points_repository.h
@@ -311,7 +306,6 @@ SET(repositories
repositories/character_currency_repository.h repositories/character_currency_repository.h
repositories/character_data_repository.h repositories/character_data_repository.h
repositories/character_disciplines_repository.h repositories/character_disciplines_repository.h
repositories/character_expedition_lockouts_repository.h
repositories/character_inspect_messages_repository.h repositories/character_inspect_messages_repository.h
repositories/character_item_recast_repository.h repositories/character_item_recast_repository.h
repositories/character_languages_repository.h repositories/character_languages_repository.h
@@ -330,16 +324,11 @@ SET(repositories
repositories/char_recipe_list_repository.h repositories/char_recipe_list_repository.h
repositories/completed_tasks_repository.h repositories/completed_tasks_repository.h
repositories/content_flags_repository.h repositories/content_flags_repository.h
repositories/damageshieldtypes_repository.h
repositories/data_buckets_repository.h repositories/data_buckets_repository.h
repositories/db_str_repository.h repositories/db_str_repository.h
repositories/discovered_items_repository.h repositories/discovered_items_repository.h
repositories/doors_repository.h repositories/doors_repository.h
repositories/dynamic_zones_repository.h
repositories/eventlog_repository.h repositories/eventlog_repository.h
repositories/expeditions_repository.h
repositories/expedition_lockouts_repository.h
repositories/expedition_members_repository.h
repositories/faction_base_data_repository.h repositories/faction_base_data_repository.h
repositories/faction_list_repository.h repositories/faction_list_repository.h
repositories/faction_list_mod_repository.h repositories/faction_list_mod_repository.h
@@ -436,6 +425,7 @@ SET(repositories
repositories/traps_repository.h repositories/traps_repository.h
repositories/tributes_repository.h repositories/tributes_repository.h
repositories/tribute_levels_repository.h repositories/tribute_levels_repository.h
repositories/variables_repository.h
repositories/veteran_reward_templates_repository.h repositories/veteran_reward_templates_repository.h
repositories/zone_repository.h repositories/zone_repository.h
repositories/zone_points_repository.h repositories/zone_points_repository.h
+2 -1
View File
@@ -300,7 +300,8 @@ void DatabaseDumpService::Dump()
config->DatabaseUsername config->DatabaseUsername
); );
std::string options = "--allow-keywords --extended-insert --max-allowed-packet=1G --net-buffer-length=32704"; std::string options = "--allow-keywords --extended-insert";
if (IsDumpWithNoData()) { if (IsDumpWithNoData()) {
options += " --no-data"; options += " --no-data";
} }
-2
View File
@@ -1,8 +1,6 @@
// system use // system use
N(OP_ExploreUnknown), N(OP_ExploreUnknown),
// start (please add new opcodes in descending order and re-order any name changes where applicable) // start (please add new opcodes in descending order and re-order any name changes where applicable)
N(OP_0x0193),
N(OP_0x0347),
N(OP_AAAction), N(OP_AAAction),
N(OP_AAExpUpdate), N(OP_AAExpUpdate),
N(OP_AcceptNewTask), N(OP_AcceptNewTask),
-2
View File
@@ -121,7 +121,6 @@ namespace Logs {
Expeditions, Expeditions,
DynamicZones, DynamicZones,
Group, Group,
Adventure,
MaxCategoryID /* Don't Remove this */ MaxCategoryID /* Don't Remove this */
}; };
@@ -202,7 +201,6 @@ namespace Logs {
"Expeditions", "Expeditions",
"DynamicZones", "DynamicZones",
"Group", "Group",
"Adventure",
}; };
} }
-10
View File
@@ -636,16 +636,6 @@
OutF(LogSys, Logs::Detail, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ OutF(LogSys, Logs::Detail, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0) } while (0)
#define LogAdventure(message, ...) do {\
if (LogSys.log_settings[Logs::Adventure].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Adventure, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAdventureDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Adventure].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Adventure, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\ #define Log(debug_level, log_category, message, ...) do {\
if (LogSys.log_settings[log_category].is_category_enabled == 1)\ if (LogSys.log_settings[log_category].is_category_enabled == 1)\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_AA_ABILITY_REPOSITORY_H #ifndef EQEMU_BASE_AA_ABILITY_REPOSITORY_H
@@ -64,6 +81,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("aa_ability"); return std::string("aa_ability");
@@ -83,7 +115,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -124,11 +156,10 @@ public:
} }
static AaAbility FindOne( static AaAbility FindOne(
Database& db,
int aa_ability_id int aa_ability_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -162,11 +193,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int aa_ability_id int aa_ability_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -179,7 +209,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AaAbility aa_ability_entry AaAbility aa_ability_entry
) )
{ {
@@ -202,7 +231,7 @@ public:
update_values.push_back(columns[12] + " = " + std::to_string(aa_ability_entry.enabled)); update_values.push_back(columns[12] + " = " + std::to_string(aa_ability_entry.enabled));
update_values.push_back(columns[13] + " = " + std::to_string(aa_ability_entry.reset_on_death)); update_values.push_back(columns[13] + " = " + std::to_string(aa_ability_entry.reset_on_death));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -216,7 +245,6 @@ public:
} }
static AaAbility InsertOne( static AaAbility InsertOne(
Database& db,
AaAbility aa_ability_entry AaAbility aa_ability_entry
) )
{ {
@@ -237,7 +265,7 @@ public:
insert_values.push_back(std::to_string(aa_ability_entry.enabled)); insert_values.push_back(std::to_string(aa_ability_entry.enabled));
insert_values.push_back(std::to_string(aa_ability_entry.reset_on_death)); insert_values.push_back(std::to_string(aa_ability_entry.reset_on_death));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -256,7 +284,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AaAbility> aa_ability_entries std::vector<AaAbility> aa_ability_entries
) )
{ {
@@ -285,7 +312,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -296,11 +323,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AaAbility> All(Database& db) static std::vector<AaAbility> All()
{ {
std::vector<AaAbility> all_entries; std::vector<AaAbility> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -333,11 +360,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AaAbility> GetWhere(Database& db, std::string where_filter) static std::vector<AaAbility> GetWhere(std::string where_filter)
{ {
std::vector<AaAbility> all_entries; std::vector<AaAbility> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -371,9 +398,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -384,9 +411,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H #ifndef EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
@@ -46,6 +63,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("aa_rank_effects"); return std::string("aa_rank_effects");
@@ -65,7 +97,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -97,11 +129,10 @@ public:
} }
static AaRankEffects FindOne( static AaRankEffects FindOne(
Database& db,
int aa_rank_effects_id int aa_rank_effects_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -126,11 +157,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int aa_rank_effects_id int aa_rank_effects_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -143,7 +173,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AaRankEffects aa_rank_effects_entry AaRankEffects aa_rank_effects_entry
) )
{ {
@@ -157,7 +186,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(aa_rank_effects_entry.base1)); update_values.push_back(columns[3] + " = " + std::to_string(aa_rank_effects_entry.base1));
update_values.push_back(columns[4] + " = " + std::to_string(aa_rank_effects_entry.base2)); update_values.push_back(columns[4] + " = " + std::to_string(aa_rank_effects_entry.base2));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -171,7 +200,6 @@ public:
} }
static AaRankEffects InsertOne( static AaRankEffects InsertOne(
Database& db,
AaRankEffects aa_rank_effects_entry AaRankEffects aa_rank_effects_entry
) )
{ {
@@ -183,7 +211,7 @@ public:
insert_values.push_back(std::to_string(aa_rank_effects_entry.base1)); insert_values.push_back(std::to_string(aa_rank_effects_entry.base1));
insert_values.push_back(std::to_string(aa_rank_effects_entry.base2)); insert_values.push_back(std::to_string(aa_rank_effects_entry.base2));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -202,7 +230,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AaRankEffects> aa_rank_effects_entries std::vector<AaRankEffects> aa_rank_effects_entries
) )
{ {
@@ -222,7 +249,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -233,11 +260,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AaRankEffects> All(Database& db) static std::vector<AaRankEffects> All()
{ {
std::vector<AaRankEffects> all_entries; std::vector<AaRankEffects> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -261,11 +288,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AaRankEffects> GetWhere(Database& db, std::string where_filter) static std::vector<AaRankEffects> GetWhere(std::string where_filter)
{ {
std::vector<AaRankEffects> all_entries; std::vector<AaRankEffects> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -290,9 +317,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -303,9 +330,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H #ifndef EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("aa_rank_prereqs"); return std::string("aa_rank_prereqs");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static AaRankPrereqs FindOne( static AaRankPrereqs FindOne(
Database& db,
int aa_rank_prereqs_id int aa_rank_prereqs_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int aa_rank_prereqs_id int aa_rank_prereqs_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AaRankPrereqs aa_rank_prereqs_entry AaRankPrereqs aa_rank_prereqs_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_prereqs_entry.aa_id)); update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_prereqs_entry.aa_id));
update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_prereqs_entry.points)); update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_prereqs_entry.points));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static AaRankPrereqs InsertOne( static AaRankPrereqs InsertOne(
Database& db,
AaRankPrereqs aa_rank_prereqs_entry AaRankPrereqs aa_rank_prereqs_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.aa_id)); insert_values.push_back(std::to_string(aa_rank_prereqs_entry.aa_id));
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.points)); insert_values.push_back(std::to_string(aa_rank_prereqs_entry.points));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AaRankPrereqs> aa_rank_prereqs_entries std::vector<AaRankPrereqs> aa_rank_prereqs_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AaRankPrereqs> All(Database& db) static std::vector<AaRankPrereqs> All()
{ {
std::vector<AaRankPrereqs> all_entries; std::vector<AaRankPrereqs> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AaRankPrereqs> GetWhere(Database& db, std::string where_filter) static std::vector<AaRankPrereqs> GetWhere(std::string where_filter)
{ {
std::vector<AaRankPrereqs> all_entries; std::vector<AaRankPrereqs> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_AA_RANKS_REPOSITORY_H #ifndef EQEMU_BASE_AA_RANKS_REPOSITORY_H
@@ -62,6 +79,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("aa_ranks"); return std::string("aa_ranks");
@@ -81,7 +113,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -121,11 +153,10 @@ public:
} }
static AaRanks FindOne( static AaRanks FindOne(
Database& db,
int aa_ranks_id int aa_ranks_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -158,11 +189,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int aa_ranks_id int aa_ranks_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -175,7 +205,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AaRanks aa_ranks_entry AaRanks aa_ranks_entry
) )
{ {
@@ -197,7 +226,7 @@ public:
update_values.push_back(columns[11] + " = " + std::to_string(aa_ranks_entry.prev_id)); update_values.push_back(columns[11] + " = " + std::to_string(aa_ranks_entry.prev_id));
update_values.push_back(columns[12] + " = " + std::to_string(aa_ranks_entry.next_id)); update_values.push_back(columns[12] + " = " + std::to_string(aa_ranks_entry.next_id));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -211,7 +240,6 @@ public:
} }
static AaRanks InsertOne( static AaRanks InsertOne(
Database& db,
AaRanks aa_ranks_entry AaRanks aa_ranks_entry
) )
{ {
@@ -231,7 +259,7 @@ public:
insert_values.push_back(std::to_string(aa_ranks_entry.prev_id)); insert_values.push_back(std::to_string(aa_ranks_entry.prev_id));
insert_values.push_back(std::to_string(aa_ranks_entry.next_id)); insert_values.push_back(std::to_string(aa_ranks_entry.next_id));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -250,7 +278,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AaRanks> aa_ranks_entries std::vector<AaRanks> aa_ranks_entries
) )
{ {
@@ -278,7 +305,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -289,11 +316,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AaRanks> All(Database& db) static std::vector<AaRanks> All()
{ {
std::vector<AaRanks> all_entries; std::vector<AaRanks> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -325,11 +352,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AaRanks> GetWhere(Database& db, std::string where_filter) static std::vector<AaRanks> GetWhere(std::string where_filter)
{ {
std::vector<AaRanks> all_entries; std::vector<AaRanks> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -362,9 +389,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -375,9 +402,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H #ifndef EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("account_flags"); return std::string("account_flags");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static AccountFlags FindOne( static AccountFlags FindOne(
Database& db,
int account_flags_id int account_flags_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int account_flags_id int account_flags_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AccountFlags account_flags_entry AccountFlags account_flags_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = '" + EscapeString(account_flags_entry.p_flag) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(account_flags_entry.p_flag) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(account_flags_entry.p_value) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(account_flags_entry.p_value) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static AccountFlags InsertOne( static AccountFlags InsertOne(
Database& db,
AccountFlags account_flags_entry AccountFlags account_flags_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back("'" + EscapeString(account_flags_entry.p_flag) + "'"); insert_values.push_back("'" + EscapeString(account_flags_entry.p_flag) + "'");
insert_values.push_back("'" + EscapeString(account_flags_entry.p_value) + "'"); insert_values.push_back("'" + EscapeString(account_flags_entry.p_value) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AccountFlags> account_flags_entries std::vector<AccountFlags> account_flags_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AccountFlags> All(Database& db) static std::vector<AccountFlags> All()
{ {
std::vector<AccountFlags> all_entries; std::vector<AccountFlags> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AccountFlags> GetWhere(Database& db, std::string where_filter) static std::vector<AccountFlags> GetWhere(std::string where_filter)
{ {
std::vector<AccountFlags> all_entries; std::vector<AccountFlags> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H #ifndef EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("account_ip"); return std::string("account_ip");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static AccountIp FindOne( static AccountIp FindOne(
Database& db,
int account_ip_id int account_ip_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int account_ip_id int account_ip_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AccountIp account_ip_entry AccountIp account_ip_entry
) )
{ {
@@ -152,7 +181,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(account_ip_entry.count)); update_values.push_back(columns[2] + " = " + std::to_string(account_ip_entry.count));
update_values.push_back(columns[3] + " = '" + EscapeString(account_ip_entry.lastused) + "'"); update_values.push_back(columns[3] + " = '" + EscapeString(account_ip_entry.lastused) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -166,7 +195,6 @@ public:
} }
static AccountIp InsertOne( static AccountIp InsertOne(
Database& db,
AccountIp account_ip_entry AccountIp account_ip_entry
) )
{ {
@@ -177,7 +205,7 @@ public:
insert_values.push_back(std::to_string(account_ip_entry.count)); insert_values.push_back(std::to_string(account_ip_entry.count));
insert_values.push_back("'" + EscapeString(account_ip_entry.lastused) + "'"); insert_values.push_back("'" + EscapeString(account_ip_entry.lastused) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -196,7 +224,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AccountIp> account_ip_entries std::vector<AccountIp> account_ip_entries
) )
{ {
@@ -215,7 +242,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -226,11 +253,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AccountIp> All(Database& db) static std::vector<AccountIp> All()
{ {
std::vector<AccountIp> all_entries; std::vector<AccountIp> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -253,11 +280,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AccountIp> GetWhere(Database& db, std::string where_filter) static std::vector<AccountIp> GetWhere(std::string where_filter)
{ {
std::vector<AccountIp> all_entries; std::vector<AccountIp> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -281,9 +308,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -294,9 +321,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ACCOUNT_REPOSITORY_H #ifndef EQEMU_BASE_ACCOUNT_REPOSITORY_H
@@ -74,6 +91,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("account"); return std::string("account");
@@ -93,7 +125,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -139,11 +171,10 @@ public:
} }
static Account FindOne( static Account FindOne(
Database& db,
int account_id int account_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -182,11 +213,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int account_id int account_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -199,7 +229,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Account account_entry Account account_entry
) )
{ {
@@ -226,7 +255,7 @@ public:
update_values.push_back(columns[17] + " = '" + EscapeString(account_entry.ban_reason) + "'"); update_values.push_back(columns[17] + " = '" + EscapeString(account_entry.ban_reason) + "'");
update_values.push_back(columns[18] + " = '" + EscapeString(account_entry.suspend_reason) + "'"); update_values.push_back(columns[18] + " = '" + EscapeString(account_entry.suspend_reason) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -240,13 +269,11 @@ public:
} }
static Account InsertOne( static Account InsertOne(
Database& db,
Account account_entry Account account_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_entry.id));
insert_values.push_back("'" + EscapeString(account_entry.name) + "'"); insert_values.push_back("'" + EscapeString(account_entry.name) + "'");
insert_values.push_back("'" + EscapeString(account_entry.charname) + "'"); insert_values.push_back("'" + EscapeString(account_entry.charname) + "'");
insert_values.push_back(std::to_string(account_entry.sharedplat)); insert_values.push_back(std::to_string(account_entry.sharedplat));
@@ -266,7 +293,7 @@ public:
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'"); insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'"); insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -285,7 +312,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Account> account_entries std::vector<Account> account_entries
) )
{ {
@@ -294,7 +320,6 @@ public:
for (auto &account_entry: account_entries) { for (auto &account_entry: account_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_entry.id));
insert_values.push_back("'" + EscapeString(account_entry.name) + "'"); insert_values.push_back("'" + EscapeString(account_entry.name) + "'");
insert_values.push_back("'" + EscapeString(account_entry.charname) + "'"); insert_values.push_back("'" + EscapeString(account_entry.charname) + "'");
insert_values.push_back(std::to_string(account_entry.sharedplat)); insert_values.push_back(std::to_string(account_entry.sharedplat));
@@ -319,7 +344,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -330,11 +355,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Account> All(Database& db) static std::vector<Account> All()
{ {
std::vector<Account> all_entries; std::vector<Account> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -372,11 +397,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Account> GetWhere(Database& db, std::string where_filter) static std::vector<Account> GetWhere(std::string where_filter)
{ {
std::vector<Account> all_entries; std::vector<Account> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -415,9 +440,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -428,9 +453,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H #ifndef EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("account_rewards"); return std::string("account_rewards");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static AccountRewards FindOne( static AccountRewards FindOne(
Database& db,
int account_rewards_id int account_rewards_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int account_rewards_id int account_rewards_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AccountRewards account_rewards_entry AccountRewards account_rewards_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(account_rewards_entry.reward_id)); update_values.push_back(columns[1] + " = " + std::to_string(account_rewards_entry.reward_id));
update_values.push_back(columns[2] + " = " + std::to_string(account_rewards_entry.amount)); update_values.push_back(columns[2] + " = " + std::to_string(account_rewards_entry.amount));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static AccountRewards InsertOne( static AccountRewards InsertOne(
Database& db,
AccountRewards account_rewards_entry AccountRewards account_rewards_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(account_rewards_entry.reward_id)); insert_values.push_back(std::to_string(account_rewards_entry.reward_id));
insert_values.push_back(std::to_string(account_rewards_entry.amount)); insert_values.push_back(std::to_string(account_rewards_entry.amount));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AccountRewards> account_rewards_entries std::vector<AccountRewards> account_rewards_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AccountRewards> All(Database& db) static std::vector<AccountRewards> All()
{ {
std::vector<AccountRewards> all_entries; std::vector<AccountRewards> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AccountRewards> GetWhere(Database& db, std::string where_filter) static std::vector<AccountRewards> GetWhere(std::string where_filter)
{ {
std::vector<AccountRewards> all_entries; std::vector<AccountRewards> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H #ifndef EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
@@ -54,6 +71,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("adventure_details"); return std::string("adventure_details");
@@ -73,7 +105,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -109,11 +141,10 @@ public:
} }
static AdventureDetails FindOne( static AdventureDetails FindOne(
Database& db,
int adventure_details_id int adventure_details_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -142,11 +173,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_details_id int adventure_details_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -159,7 +189,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureDetails adventure_details_entry AdventureDetails adventure_details_entry
) )
{ {
@@ -176,7 +205,7 @@ public:
update_values.push_back(columns[7] + " = " + std::to_string(adventure_details_entry.time_zoned)); update_values.push_back(columns[7] + " = " + std::to_string(adventure_details_entry.time_zoned));
update_values.push_back(columns[8] + " = " + std::to_string(adventure_details_entry.time_completed)); update_values.push_back(columns[8] + " = " + std::to_string(adventure_details_entry.time_completed));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -190,13 +219,11 @@ public:
} }
static AdventureDetails InsertOne( static AdventureDetails InsertOne(
Database& db,
AdventureDetails adventure_details_entry AdventureDetails adventure_details_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_details_entry.id));
insert_values.push_back(std::to_string(adventure_details_entry.adventure_id)); insert_values.push_back(std::to_string(adventure_details_entry.adventure_id));
insert_values.push_back(std::to_string(adventure_details_entry.instance_id)); insert_values.push_back(std::to_string(adventure_details_entry.instance_id));
insert_values.push_back(std::to_string(adventure_details_entry.count)); insert_values.push_back(std::to_string(adventure_details_entry.count));
@@ -206,7 +233,7 @@ public:
insert_values.push_back(std::to_string(adventure_details_entry.time_zoned)); insert_values.push_back(std::to_string(adventure_details_entry.time_zoned));
insert_values.push_back(std::to_string(adventure_details_entry.time_completed)); insert_values.push_back(std::to_string(adventure_details_entry.time_completed));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -225,7 +252,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureDetails> adventure_details_entries std::vector<AdventureDetails> adventure_details_entries
) )
{ {
@@ -234,7 +260,6 @@ public:
for (auto &adventure_details_entry: adventure_details_entries) { for (auto &adventure_details_entry: adventure_details_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_details_entry.id));
insert_values.push_back(std::to_string(adventure_details_entry.adventure_id)); insert_values.push_back(std::to_string(adventure_details_entry.adventure_id));
insert_values.push_back(std::to_string(adventure_details_entry.instance_id)); insert_values.push_back(std::to_string(adventure_details_entry.instance_id));
insert_values.push_back(std::to_string(adventure_details_entry.count)); insert_values.push_back(std::to_string(adventure_details_entry.count));
@@ -249,7 +274,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -260,11 +285,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureDetails> All(Database& db) static std::vector<AdventureDetails> All()
{ {
std::vector<AdventureDetails> all_entries; std::vector<AdventureDetails> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -292,11 +317,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureDetails> GetWhere(Database& db, std::string where_filter) static std::vector<AdventureDetails> GetWhere(std::string where_filter)
{ {
std::vector<AdventureDetails> all_entries; std::vector<AdventureDetails> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -325,9 +350,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -338,9 +363,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H #ifndef EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
@@ -40,6 +57,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("adventure_members"); return std::string("adventure_members");
@@ -59,7 +91,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -88,11 +120,10 @@ public:
} }
static AdventureMembers FindOne( static AdventureMembers FindOne(
Database& db,
int adventure_members_id int adventure_members_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -114,11 +145,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_members_id int adventure_members_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -131,7 +161,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureMembers adventure_members_entry AdventureMembers adventure_members_entry
) )
{ {
@@ -142,7 +171,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(adventure_members_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(adventure_members_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_members_entry.charid)); update_values.push_back(columns[1] + " = " + std::to_string(adventure_members_entry.charid));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -156,7 +185,6 @@ public:
} }
static AdventureMembers InsertOne( static AdventureMembers InsertOne(
Database& db,
AdventureMembers adventure_members_entry AdventureMembers adventure_members_entry
) )
{ {
@@ -165,7 +193,7 @@ public:
insert_values.push_back(std::to_string(adventure_members_entry.id)); insert_values.push_back(std::to_string(adventure_members_entry.id));
insert_values.push_back(std::to_string(adventure_members_entry.charid)); insert_values.push_back(std::to_string(adventure_members_entry.charid));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -184,7 +212,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureMembers> adventure_members_entries std::vector<AdventureMembers> adventure_members_entries
) )
{ {
@@ -201,7 +228,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -212,11 +239,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureMembers> All(Database& db) static std::vector<AdventureMembers> All()
{ {
std::vector<AdventureMembers> all_entries; std::vector<AdventureMembers> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -237,11 +264,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureMembers> GetWhere(Database& db, std::string where_filter) static std::vector<AdventureMembers> GetWhere(std::string where_filter)
{ {
std::vector<AdventureMembers> all_entries; std::vector<AdventureMembers> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -263,9 +290,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -276,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H #ifndef EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
@@ -58,6 +75,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("adventure_stats"); return std::string("adventure_stats");
@@ -77,7 +109,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -115,11 +147,10 @@ public:
} }
static AdventureStats FindOne( static AdventureStats FindOne(
Database& db,
int adventure_stats_id int adventure_stats_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -150,11 +181,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_stats_id int adventure_stats_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -167,7 +197,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureStats adventure_stats_entry AdventureStats adventure_stats_entry
) )
{ {
@@ -187,7 +216,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(adventure_stats_entry.ruj_losses)); update_values.push_back(columns[9] + " = " + std::to_string(adventure_stats_entry.ruj_losses));
update_values.push_back(columns[10] + " = " + std::to_string(adventure_stats_entry.tak_losses)); update_values.push_back(columns[10] + " = " + std::to_string(adventure_stats_entry.tak_losses));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -201,7 +230,6 @@ public:
} }
static AdventureStats InsertOne( static AdventureStats InsertOne(
Database& db,
AdventureStats adventure_stats_entry AdventureStats adventure_stats_entry
) )
{ {
@@ -219,7 +247,7 @@ public:
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_losses)); insert_values.push_back(std::to_string(adventure_stats_entry.ruj_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.tak_losses)); insert_values.push_back(std::to_string(adventure_stats_entry.tak_losses));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -238,7 +266,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureStats> adventure_stats_entries std::vector<AdventureStats> adventure_stats_entries
) )
{ {
@@ -264,7 +291,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -275,11 +302,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureStats> All(Database& db) static std::vector<AdventureStats> All()
{ {
std::vector<AdventureStats> all_entries; std::vector<AdventureStats> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -309,11 +336,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureStats> GetWhere(Database& db, std::string where_filter) static std::vector<AdventureStats> GetWhere(std::string where_filter)
{ {
std::vector<AdventureStats> all_entries; std::vector<AdventureStats> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -344,9 +371,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -357,9 +384,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H #ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
@@ -40,6 +57,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("adventure_template_entry_flavor"); return std::string("adventure_template_entry_flavor");
@@ -59,7 +91,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -88,11 +120,10 @@ public:
} }
static AdventureTemplateEntryFlavor FindOne( static AdventureTemplateEntryFlavor FindOne(
Database& db,
int adventure_template_entry_flavor_id int adventure_template_entry_flavor_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -114,11 +145,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_template_entry_flavor_id int adventure_template_entry_flavor_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -131,7 +161,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
) )
{ {
@@ -142,7 +171,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_flavor_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_flavor_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(adventure_template_entry_flavor_entry.text) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -156,7 +185,6 @@ public:
} }
static AdventureTemplateEntryFlavor InsertOne( static AdventureTemplateEntryFlavor InsertOne(
Database& db,
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
) )
{ {
@@ -165,7 +193,7 @@ public:
insert_values.push_back(std::to_string(adventure_template_entry_flavor_entry.id)); insert_values.push_back(std::to_string(adventure_template_entry_flavor_entry.id));
insert_values.push_back("'" + EscapeString(adventure_template_entry_flavor_entry.text) + "'"); insert_values.push_back("'" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -184,7 +212,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureTemplateEntryFlavor> adventure_template_entry_flavor_entries std::vector<AdventureTemplateEntryFlavor> adventure_template_entry_flavor_entries
) )
{ {
@@ -201,7 +228,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -212,11 +239,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureTemplateEntryFlavor> All(Database& db) static std::vector<AdventureTemplateEntryFlavor> All()
{ {
std::vector<AdventureTemplateEntryFlavor> all_entries; std::vector<AdventureTemplateEntryFlavor> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -237,11 +264,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureTemplateEntryFlavor> GetWhere(Database& db, std::string where_filter) static std::vector<AdventureTemplateEntryFlavor> GetWhere(std::string where_filter)
{ {
std::vector<AdventureTemplateEntryFlavor> all_entries; std::vector<AdventureTemplateEntryFlavor> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -263,9 +290,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -276,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H #ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
@@ -40,6 +57,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("adventure_template_entry"); return std::string("adventure_template_entry");
@@ -59,7 +91,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -88,11 +120,10 @@ public:
} }
static AdventureTemplateEntry FindOne( static AdventureTemplateEntry FindOne(
Database& db,
int adventure_template_entry_id int adventure_template_entry_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -114,11 +145,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_template_entry_id int adventure_template_entry_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -131,7 +161,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureTemplateEntry adventure_template_entry_entry AdventureTemplateEntry adventure_template_entry_entry
) )
{ {
@@ -142,7 +171,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_template_entry_entry.template_id)); update_values.push_back(columns[1] + " = " + std::to_string(adventure_template_entry_entry.template_id));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -156,7 +185,6 @@ public:
} }
static AdventureTemplateEntry InsertOne( static AdventureTemplateEntry InsertOne(
Database& db,
AdventureTemplateEntry adventure_template_entry_entry AdventureTemplateEntry adventure_template_entry_entry
) )
{ {
@@ -165,7 +193,7 @@ public:
insert_values.push_back(std::to_string(adventure_template_entry_entry.id)); insert_values.push_back(std::to_string(adventure_template_entry_entry.id));
insert_values.push_back(std::to_string(adventure_template_entry_entry.template_id)); insert_values.push_back(std::to_string(adventure_template_entry_entry.template_id));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -184,7 +212,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureTemplateEntry> adventure_template_entry_entries std::vector<AdventureTemplateEntry> adventure_template_entry_entries
) )
{ {
@@ -201,7 +228,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -212,11 +239,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureTemplateEntry> All(Database& db) static std::vector<AdventureTemplateEntry> All()
{ {
std::vector<AdventureTemplateEntry> all_entries; std::vector<AdventureTemplateEntry> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -237,11 +264,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureTemplateEntry> GetWhere(Database& db, std::string where_filter) static std::vector<AdventureTemplateEntry> GetWhere(std::string where_filter)
{ {
std::vector<AdventureTemplateEntry> all_entries; std::vector<AdventureTemplateEntry> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -263,9 +290,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -276,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_REPOSITORY_H #ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_REPOSITORY_H
@@ -102,6 +119,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("adventure_template"); return std::string("adventure_template");
@@ -121,7 +153,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -181,11 +213,10 @@ public:
} }
static AdventureTemplate FindOne( static AdventureTemplate FindOne(
Database& db,
int adventure_template_id int adventure_template_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -238,11 +269,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int adventure_template_id int adventure_template_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -255,7 +285,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AdventureTemplate adventure_template_entry AdventureTemplate adventure_template_entry
) )
{ {
@@ -297,7 +326,7 @@ public:
update_values.push_back(columns[31] + " = " + std::to_string(adventure_template_entry.graveyard_z)); update_values.push_back(columns[31] + " = " + std::to_string(adventure_template_entry.graveyard_z));
update_values.push_back(columns[32] + " = " + std::to_string(adventure_template_entry.graveyard_radius)); update_values.push_back(columns[32] + " = " + std::to_string(adventure_template_entry.graveyard_radius));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -311,7 +340,6 @@ public:
} }
static AdventureTemplate InsertOne( static AdventureTemplate InsertOne(
Database& db,
AdventureTemplate adventure_template_entry AdventureTemplate adventure_template_entry
) )
{ {
@@ -351,7 +379,7 @@ public:
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_z)); insert_values.push_back(std::to_string(adventure_template_entry.graveyard_z));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_radius)); insert_values.push_back(std::to_string(adventure_template_entry.graveyard_radius));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -370,7 +398,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AdventureTemplate> adventure_template_entries std::vector<AdventureTemplate> adventure_template_entries
) )
{ {
@@ -418,7 +445,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -429,11 +456,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AdventureTemplate> All(Database& db) static std::vector<AdventureTemplate> All()
{ {
std::vector<AdventureTemplate> all_entries; std::vector<AdventureTemplate> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -485,11 +512,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AdventureTemplate> GetWhere(Database& db, std::string where_filter) static std::vector<AdventureTemplate> GetWhere(std::string where_filter)
{ {
std::vector<AdventureTemplate> all_entries; std::vector<AdventureTemplate> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -542,9 +569,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -555,9 +582,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ALTERNATE_CURRENCY_REPOSITORY_H #ifndef EQEMU_BASE_ALTERNATE_CURRENCY_REPOSITORY_H
@@ -40,6 +57,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("alternate_currency"); return std::string("alternate_currency");
@@ -59,7 +91,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -88,11 +120,10 @@ public:
} }
static AlternateCurrency FindOne( static AlternateCurrency FindOne(
Database& db,
int alternate_currency_id int alternate_currency_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -114,11 +145,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int alternate_currency_id int alternate_currency_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -131,7 +161,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
AlternateCurrency alternate_currency_entry AlternateCurrency alternate_currency_entry
) )
{ {
@@ -142,7 +171,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(alternate_currency_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(alternate_currency_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(alternate_currency_entry.item_id)); update_values.push_back(columns[1] + " = " + std::to_string(alternate_currency_entry.item_id));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -156,7 +185,6 @@ public:
} }
static AlternateCurrency InsertOne( static AlternateCurrency InsertOne(
Database& db,
AlternateCurrency alternate_currency_entry AlternateCurrency alternate_currency_entry
) )
{ {
@@ -165,7 +193,7 @@ public:
insert_values.push_back(std::to_string(alternate_currency_entry.id)); insert_values.push_back(std::to_string(alternate_currency_entry.id));
insert_values.push_back(std::to_string(alternate_currency_entry.item_id)); insert_values.push_back(std::to_string(alternate_currency_entry.item_id));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -184,7 +212,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<AlternateCurrency> alternate_currency_entries std::vector<AlternateCurrency> alternate_currency_entries
) )
{ {
@@ -201,7 +228,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -212,11 +239,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<AlternateCurrency> All(Database& db) static std::vector<AlternateCurrency> All()
{ {
std::vector<AlternateCurrency> all_entries; std::vector<AlternateCurrency> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -237,11 +264,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<AlternateCurrency> GetWhere(Database& db, std::string where_filter) static std::vector<AlternateCurrency> GetWhere(std::string where_filter)
{ {
std::vector<AlternateCurrency> all_entries; std::vector<AlternateCurrency> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -263,9 +290,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -276,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_AURAS_REPOSITORY_H #ifndef EQEMU_BASE_AURAS_REPOSITORY_H
@@ -58,6 +75,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("auras"); return std::string("auras");
@@ -77,7 +109,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -115,11 +147,10 @@ public:
} }
static Auras FindOne( static Auras FindOne(
Database& db,
int auras_id int auras_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -150,11 +181,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int auras_id int auras_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -167,7 +197,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Auras auras_entry Auras auras_entry
) )
{ {
@@ -187,7 +216,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(auras_entry.icon)); update_values.push_back(columns[9] + " = " + std::to_string(auras_entry.icon));
update_values.push_back(columns[10] + " = " + std::to_string(auras_entry.cast_time)); update_values.push_back(columns[10] + " = " + std::to_string(auras_entry.cast_time));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -201,7 +230,6 @@ public:
} }
static Auras InsertOne( static Auras InsertOne(
Database& db,
Auras auras_entry Auras auras_entry
) )
{ {
@@ -219,7 +247,7 @@ public:
insert_values.push_back(std::to_string(auras_entry.icon)); insert_values.push_back(std::to_string(auras_entry.icon));
insert_values.push_back(std::to_string(auras_entry.cast_time)); insert_values.push_back(std::to_string(auras_entry.cast_time));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -238,7 +266,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Auras> auras_entries std::vector<Auras> auras_entries
) )
{ {
@@ -264,7 +291,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -275,11 +302,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Auras> All(Database& db) static std::vector<Auras> All()
{ {
std::vector<Auras> all_entries; std::vector<Auras> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -309,11 +336,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Auras> GetWhere(Database& db, std::string where_filter) static std::vector<Auras> GetWhere(std::string where_filter)
{ {
std::vector<Auras> all_entries; std::vector<Auras> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -344,9 +371,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -357,9 +384,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_BASE_DATA_REPOSITORY_H #ifndef EQEMU_BASE_BASE_DATA_REPOSITORY_H
@@ -56,6 +73,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("base_data"); return std::string("base_data");
@@ -75,7 +107,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -112,11 +144,10 @@ public:
} }
static BaseData FindOne( static BaseData FindOne(
Database& db,
int base_data_id int base_data_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -146,11 +177,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int base_data_id int base_data_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -163,7 +193,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
BaseData base_data_entry BaseData base_data_entry
) )
{ {
@@ -182,7 +211,7 @@ public:
update_values.push_back(columns[8] + " = " + std::to_string(base_data_entry.mana_fac)); update_values.push_back(columns[8] + " = " + std::to_string(base_data_entry.mana_fac));
update_values.push_back(columns[9] + " = " + std::to_string(base_data_entry.end_fac)); update_values.push_back(columns[9] + " = " + std::to_string(base_data_entry.end_fac));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -196,7 +225,6 @@ public:
} }
static BaseData InsertOne( static BaseData InsertOne(
Database& db,
BaseData base_data_entry BaseData base_data_entry
) )
{ {
@@ -213,7 +241,7 @@ public:
insert_values.push_back(std::to_string(base_data_entry.mana_fac)); insert_values.push_back(std::to_string(base_data_entry.mana_fac));
insert_values.push_back(std::to_string(base_data_entry.end_fac)); insert_values.push_back(std::to_string(base_data_entry.end_fac));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -232,7 +260,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<BaseData> base_data_entries std::vector<BaseData> base_data_entries
) )
{ {
@@ -257,7 +284,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -268,11 +295,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<BaseData> All(Database& db) static std::vector<BaseData> All()
{ {
std::vector<BaseData> all_entries; std::vector<BaseData> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -301,11 +328,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<BaseData> GetWhere(Database& db, std::string where_filter) static std::vector<BaseData> GetWhere(std::string where_filter)
{ {
std::vector<BaseData> all_entries; std::vector<BaseData> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -335,9 +362,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -348,9 +375,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_BLOCKED_SPELLS_REPOSITORY_H #ifndef EQEMU_BASE_BLOCKED_SPELLS_REPOSITORY_H
@@ -60,6 +77,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("blocked_spells"); return std::string("blocked_spells");
@@ -79,7 +111,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -118,11 +150,10 @@ public:
} }
static BlockedSpells FindOne( static BlockedSpells FindOne(
Database& db,
int blocked_spells_id int blocked_spells_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -154,11 +185,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int blocked_spells_id int blocked_spells_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -171,7 +201,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
BlockedSpells blocked_spells_entry BlockedSpells blocked_spells_entry
) )
{ {
@@ -191,7 +220,7 @@ public:
update_values.push_back(columns[10] + " = '" + EscapeString(blocked_spells_entry.message) + "'"); update_values.push_back(columns[10] + " = '" + EscapeString(blocked_spells_entry.message) + "'");
update_values.push_back(columns[11] + " = '" + EscapeString(blocked_spells_entry.description) + "'"); update_values.push_back(columns[11] + " = '" + EscapeString(blocked_spells_entry.description) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -205,13 +234,11 @@ public:
} }
static BlockedSpells InsertOne( static BlockedSpells InsertOne(
Database& db,
BlockedSpells blocked_spells_entry BlockedSpells blocked_spells_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(blocked_spells_entry.id));
insert_values.push_back(std::to_string(blocked_spells_entry.spellid)); insert_values.push_back(std::to_string(blocked_spells_entry.spellid));
insert_values.push_back(std::to_string(blocked_spells_entry.type)); insert_values.push_back(std::to_string(blocked_spells_entry.type));
insert_values.push_back(std::to_string(blocked_spells_entry.zoneid)); insert_values.push_back(std::to_string(blocked_spells_entry.zoneid));
@@ -224,7 +251,7 @@ public:
insert_values.push_back("'" + EscapeString(blocked_spells_entry.message) + "'"); insert_values.push_back("'" + EscapeString(blocked_spells_entry.message) + "'");
insert_values.push_back("'" + EscapeString(blocked_spells_entry.description) + "'"); insert_values.push_back("'" + EscapeString(blocked_spells_entry.description) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -243,7 +270,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<BlockedSpells> blocked_spells_entries std::vector<BlockedSpells> blocked_spells_entries
) )
{ {
@@ -252,7 +278,6 @@ public:
for (auto &blocked_spells_entry: blocked_spells_entries) { for (auto &blocked_spells_entry: blocked_spells_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(blocked_spells_entry.id));
insert_values.push_back(std::to_string(blocked_spells_entry.spellid)); insert_values.push_back(std::to_string(blocked_spells_entry.spellid));
insert_values.push_back(std::to_string(blocked_spells_entry.type)); insert_values.push_back(std::to_string(blocked_spells_entry.type));
insert_values.push_back(std::to_string(blocked_spells_entry.zoneid)); insert_values.push_back(std::to_string(blocked_spells_entry.zoneid));
@@ -270,7 +295,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -281,11 +306,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<BlockedSpells> All(Database& db) static std::vector<BlockedSpells> All()
{ {
std::vector<BlockedSpells> all_entries; std::vector<BlockedSpells> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -316,11 +341,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<BlockedSpells> GetWhere(Database& db, std::string where_filter) static std::vector<BlockedSpells> GetWhere(std::string where_filter)
{ {
std::vector<BlockedSpells> all_entries; std::vector<BlockedSpells> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -352,9 +377,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -365,9 +390,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_BUG_REPORTS_REPOSITORY_H #ifndef EQEMU_BASE_BUG_REPORTS_REPOSITORY_H
@@ -100,6 +117,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("bug_reports"); return std::string("bug_reports");
@@ -119,7 +151,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -178,11 +210,10 @@ public:
} }
static BugReports FindOne( static BugReports FindOne(
Database& db,
int bug_reports_id int bug_reports_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -234,11 +265,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int bug_reports_id int bug_reports_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -251,7 +281,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
BugReports bug_reports_entry BugReports bug_reports_entry
) )
{ {
@@ -291,7 +320,7 @@ public:
update_values.push_back(columns[30] + " = '" + EscapeString(bug_reports_entry.last_reviewer) + "'"); update_values.push_back(columns[30] + " = '" + EscapeString(bug_reports_entry.last_reviewer) + "'");
update_values.push_back(columns[31] + " = '" + EscapeString(bug_reports_entry.reviewer_notes) + "'"); update_values.push_back(columns[31] + " = '" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -305,13 +334,11 @@ public:
} }
static BugReports InsertOne( static BugReports InsertOne(
Database& db,
BugReports bug_reports_entry BugReports bug_reports_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bug_reports_entry.id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.zone) + "'"); insert_values.push_back("'" + EscapeString(bug_reports_entry.zone) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.client_version_id)); insert_values.push_back(std::to_string(bug_reports_entry.client_version_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.client_version_name) + "'"); insert_values.push_back("'" + EscapeString(bug_reports_entry.client_version_name) + "'");
@@ -344,7 +371,7 @@ public:
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_reviewer) + "'"); insert_values.push_back("'" + EscapeString(bug_reports_entry.last_reviewer) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reviewer_notes) + "'"); insert_values.push_back("'" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -363,7 +390,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<BugReports> bug_reports_entries std::vector<BugReports> bug_reports_entries
) )
{ {
@@ -372,7 +398,6 @@ public:
for (auto &bug_reports_entry: bug_reports_entries) { for (auto &bug_reports_entry: bug_reports_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bug_reports_entry.id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.zone) + "'"); insert_values.push_back("'" + EscapeString(bug_reports_entry.zone) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.client_version_id)); insert_values.push_back(std::to_string(bug_reports_entry.client_version_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.client_version_name) + "'"); insert_values.push_back("'" + EscapeString(bug_reports_entry.client_version_name) + "'");
@@ -410,7 +435,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -421,11 +446,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<BugReports> All(Database& db) static std::vector<BugReports> All()
{ {
std::vector<BugReports> all_entries; std::vector<BugReports> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -476,11 +501,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<BugReports> GetWhere(Database& db, std::string where_filter) static std::vector<BugReports> GetWhere(std::string where_filter)
{ {
std::vector<BugReports> all_entries; std::vector<BugReports> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -532,9 +557,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -545,9 +570,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
+52 -27
View File
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_BUGS_REPOSITORY_H #ifndef EQEMU_BASE_BUGS_REPOSITORY_H
@@ -62,6 +79,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("bugs"); return std::string("bugs");
@@ -81,7 +113,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -121,11 +153,10 @@ public:
} }
static Bugs FindOne( static Bugs FindOne(
Database& db,
int bugs_id int bugs_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -158,11 +189,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int bugs_id int bugs_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -175,7 +205,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Bugs bugs_entry Bugs bugs_entry
) )
{ {
@@ -196,7 +225,7 @@ public:
update_values.push_back(columns[11] + " = '" + EscapeString(bugs_entry.date) + "'"); update_values.push_back(columns[11] + " = '" + EscapeString(bugs_entry.date) + "'");
update_values.push_back(columns[12] + " = " + std::to_string(bugs_entry.status)); update_values.push_back(columns[12] + " = " + std::to_string(bugs_entry.status));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -210,13 +239,11 @@ public:
} }
static Bugs InsertOne( static Bugs InsertOne(
Database& db,
Bugs bugs_entry Bugs bugs_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bugs_entry.id));
insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'"); insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'"); insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'"); insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'");
@@ -230,7 +257,7 @@ public:
insert_values.push_back("'" + EscapeString(bugs_entry.date) + "'"); insert_values.push_back("'" + EscapeString(bugs_entry.date) + "'");
insert_values.push_back(std::to_string(bugs_entry.status)); insert_values.push_back(std::to_string(bugs_entry.status));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -249,7 +276,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Bugs> bugs_entries std::vector<Bugs> bugs_entries
) )
{ {
@@ -258,7 +284,6 @@ public:
for (auto &bugs_entry: bugs_entries) { for (auto &bugs_entry: bugs_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bugs_entry.id));
insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'"); insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'"); insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'"); insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'");
@@ -277,7 +302,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -288,11 +313,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Bugs> All(Database& db) static std::vector<Bugs> All()
{ {
std::vector<Bugs> all_entries; std::vector<Bugs> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -324,11 +349,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Bugs> GetWhere(Database& db, std::string where_filter) static std::vector<Bugs> GetWhere(std::string where_filter)
{ {
std::vector<Bugs> all_entries; std::vector<Bugs> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -361,9 +386,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -374,9 +399,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_BUYER_REPOSITORY_H #ifndef EQEMU_BASE_BUYER_REPOSITORY_H
@@ -48,6 +65,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("buyer"); return std::string("buyer");
@@ -67,7 +99,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -100,11 +132,10 @@ public:
} }
static Buyer FindOne( static Buyer FindOne(
Database& db,
int buyer_id int buyer_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -130,11 +161,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int buyer_id int buyer_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -147,7 +177,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Buyer buyer_entry Buyer buyer_entry
) )
{ {
@@ -162,7 +191,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(buyer_entry.quantity)); update_values.push_back(columns[4] + " = " + std::to_string(buyer_entry.quantity));
update_values.push_back(columns[5] + " = " + std::to_string(buyer_entry.price)); update_values.push_back(columns[5] + " = " + std::to_string(buyer_entry.price));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -176,7 +205,6 @@ public:
} }
static Buyer InsertOne( static Buyer InsertOne(
Database& db,
Buyer buyer_entry Buyer buyer_entry
) )
{ {
@@ -189,7 +217,7 @@ public:
insert_values.push_back(std::to_string(buyer_entry.quantity)); insert_values.push_back(std::to_string(buyer_entry.quantity));
insert_values.push_back(std::to_string(buyer_entry.price)); insert_values.push_back(std::to_string(buyer_entry.price));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -208,7 +236,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Buyer> buyer_entries std::vector<Buyer> buyer_entries
) )
{ {
@@ -229,7 +256,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -240,11 +267,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Buyer> All(Database& db) static std::vector<Buyer> All()
{ {
std::vector<Buyer> all_entries; std::vector<Buyer> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -269,11 +296,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Buyer> GetWhere(Database& db, std::string where_filter) static std::vector<Buyer> GetWhere(std::string where_filter)
{ {
std::vector<Buyer> all_entries; std::vector<Buyer> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -299,9 +326,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -312,9 +339,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHAR_CREATE_COMBINATIONS_REPOSITORY_H #ifndef EQEMU_BASE_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
@@ -48,6 +65,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("char_create_combinations"); return std::string("char_create_combinations");
@@ -67,7 +99,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -100,11 +132,10 @@ public:
} }
static CharCreateCombinations FindOne( static CharCreateCombinations FindOne(
Database& db,
int char_create_combinations_id int char_create_combinations_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -130,11 +161,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int char_create_combinations_id int char_create_combinations_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -147,7 +177,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharCreateCombinations char_create_combinations_entry CharCreateCombinations char_create_combinations_entry
) )
{ {
@@ -162,7 +191,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(char_create_combinations_entry.start_zone)); update_values.push_back(columns[4] + " = " + std::to_string(char_create_combinations_entry.start_zone));
update_values.push_back(columns[5] + " = " + std::to_string(char_create_combinations_entry.expansions_req)); update_values.push_back(columns[5] + " = " + std::to_string(char_create_combinations_entry.expansions_req));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -176,7 +205,6 @@ public:
} }
static CharCreateCombinations InsertOne( static CharCreateCombinations InsertOne(
Database& db,
CharCreateCombinations char_create_combinations_entry CharCreateCombinations char_create_combinations_entry
) )
{ {
@@ -189,7 +217,7 @@ public:
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone)); insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req)); insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -208,7 +236,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharCreateCombinations> char_create_combinations_entries std::vector<CharCreateCombinations> char_create_combinations_entries
) )
{ {
@@ -229,7 +256,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -240,11 +267,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharCreateCombinations> All(Database& db) static std::vector<CharCreateCombinations> All()
{ {
std::vector<CharCreateCombinations> all_entries; std::vector<CharCreateCombinations> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -269,11 +296,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharCreateCombinations> GetWhere(Database& db, std::string where_filter) static std::vector<CharCreateCombinations> GetWhere(std::string where_filter)
{ {
std::vector<CharCreateCombinations> all_entries; std::vector<CharCreateCombinations> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -299,9 +326,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -312,9 +339,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H #ifndef EQEMU_BASE_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
@@ -66,6 +83,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("char_create_point_allocations"); return std::string("char_create_point_allocations");
@@ -85,7 +117,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -127,11 +159,10 @@ public:
} }
static CharCreatePointAllocations FindOne( static CharCreatePointAllocations FindOne(
Database& db,
int char_create_point_allocations_id int char_create_point_allocations_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -166,11 +197,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int char_create_point_allocations_id int char_create_point_allocations_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -183,7 +213,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharCreatePointAllocations char_create_point_allocations_entry CharCreatePointAllocations char_create_point_allocations_entry
) )
{ {
@@ -207,7 +236,7 @@ public:
update_values.push_back(columns[13] + " = " + std::to_string(char_create_point_allocations_entry.alloc_wis)); update_values.push_back(columns[13] + " = " + std::to_string(char_create_point_allocations_entry.alloc_wis));
update_values.push_back(columns[14] + " = " + std::to_string(char_create_point_allocations_entry.alloc_cha)); update_values.push_back(columns[14] + " = " + std::to_string(char_create_point_allocations_entry.alloc_cha));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -221,7 +250,6 @@ public:
} }
static CharCreatePointAllocations InsertOne( static CharCreatePointAllocations InsertOne(
Database& db,
CharCreatePointAllocations char_create_point_allocations_entry CharCreatePointAllocations char_create_point_allocations_entry
) )
{ {
@@ -243,7 +271,7 @@ public:
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_wis)); insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_wis));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_cha)); insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_cha));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -262,7 +290,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharCreatePointAllocations> char_create_point_allocations_entries std::vector<CharCreatePointAllocations> char_create_point_allocations_entries
) )
{ {
@@ -292,7 +319,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -303,11 +330,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharCreatePointAllocations> All(Database& db) static std::vector<CharCreatePointAllocations> All()
{ {
std::vector<CharCreatePointAllocations> all_entries; std::vector<CharCreatePointAllocations> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -341,11 +368,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharCreatePointAllocations> GetWhere(Database& db, std::string where_filter) static std::vector<CharCreatePointAllocations> GetWhere(std::string where_filter)
{ {
std::vector<CharCreatePointAllocations> all_entries; std::vector<CharCreatePointAllocations> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -380,9 +407,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -393,9 +420,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHAR_RECIPE_LIST_REPOSITORY_H #ifndef EQEMU_BASE_CHAR_RECIPE_LIST_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("char_recipe_list"); return std::string("char_recipe_list");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharRecipeList FindOne( static CharRecipeList FindOne(
Database& db,
int char_recipe_list_id int char_recipe_list_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int char_recipe_list_id int char_recipe_list_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharRecipeList char_recipe_list_entry CharRecipeList char_recipe_list_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(char_recipe_list_entry.recipe_id)); update_values.push_back(columns[1] + " = " + std::to_string(char_recipe_list_entry.recipe_id));
update_values.push_back(columns[2] + " = " + std::to_string(char_recipe_list_entry.madecount)); update_values.push_back(columns[2] + " = " + std::to_string(char_recipe_list_entry.madecount));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static CharRecipeList InsertOne( static CharRecipeList InsertOne(
Database& db,
CharRecipeList char_recipe_list_entry CharRecipeList char_recipe_list_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(char_recipe_list_entry.recipe_id)); insert_values.push_back(std::to_string(char_recipe_list_entry.recipe_id));
insert_values.push_back(std::to_string(char_recipe_list_entry.madecount)); insert_values.push_back(std::to_string(char_recipe_list_entry.madecount));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharRecipeList> char_recipe_list_entries std::vector<CharRecipeList> char_recipe_list_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharRecipeList> All(Database& db) static std::vector<CharRecipeList> All()
{ {
std::vector<CharRecipeList> all_entries; std::vector<CharRecipeList> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharRecipeList> GetWhere(Database& db, std::string where_filter) static std::vector<CharRecipeList> GetWhere(std::string where_filter)
{ {
std::vector<CharRecipeList> all_entries; std::vector<CharRecipeList> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_ACTIVITIES_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_ACTIVITIES_REPOSITORY_H
@@ -46,6 +63,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_activities"); return std::string("character_activities");
@@ -65,7 +97,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -97,11 +129,10 @@ public:
} }
static CharacterActivities FindOne( static CharacterActivities FindOne(
Database& db,
int character_activities_id int character_activities_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -126,11 +157,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_activities_id int character_activities_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -143,7 +173,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterActivities character_activities_entry CharacterActivities character_activities_entry
) )
{ {
@@ -157,7 +186,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(character_activities_entry.donecount)); update_values.push_back(columns[3] + " = " + std::to_string(character_activities_entry.donecount));
update_values.push_back(columns[4] + " = " + std::to_string(character_activities_entry.completed)); update_values.push_back(columns[4] + " = " + std::to_string(character_activities_entry.completed));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -171,7 +200,6 @@ public:
} }
static CharacterActivities InsertOne( static CharacterActivities InsertOne(
Database& db,
CharacterActivities character_activities_entry CharacterActivities character_activities_entry
) )
{ {
@@ -183,7 +211,7 @@ public:
insert_values.push_back(std::to_string(character_activities_entry.donecount)); insert_values.push_back(std::to_string(character_activities_entry.donecount));
insert_values.push_back(std::to_string(character_activities_entry.completed)); insert_values.push_back(std::to_string(character_activities_entry.completed));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -202,7 +230,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterActivities> character_activities_entries std::vector<CharacterActivities> character_activities_entries
) )
{ {
@@ -222,7 +249,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -233,11 +260,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterActivities> All(Database& db) static std::vector<CharacterActivities> All()
{ {
std::vector<CharacterActivities> all_entries; std::vector<CharacterActivities> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -261,11 +288,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterActivities> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterActivities> GetWhere(std::string where_filter)
{ {
std::vector<CharacterActivities> all_entries; std::vector<CharacterActivities> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -290,9 +317,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -303,9 +330,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_ALT_CURRENCY_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_ALT_CURRENCY_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_alt_currency"); return std::string("character_alt_currency");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharacterAltCurrency FindOne( static CharacterAltCurrency FindOne(
Database& db,
int character_alt_currency_id int character_alt_currency_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_alt_currency_id int character_alt_currency_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterAltCurrency character_alt_currency_entry CharacterAltCurrency character_alt_currency_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_alt_currency_entry.currency_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_alt_currency_entry.currency_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_alt_currency_entry.amount)); update_values.push_back(columns[2] + " = " + std::to_string(character_alt_currency_entry.amount));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static CharacterAltCurrency InsertOne( static CharacterAltCurrency InsertOne(
Database& db,
CharacterAltCurrency character_alt_currency_entry CharacterAltCurrency character_alt_currency_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(character_alt_currency_entry.currency_id)); insert_values.push_back(std::to_string(character_alt_currency_entry.currency_id));
insert_values.push_back(std::to_string(character_alt_currency_entry.amount)); insert_values.push_back(std::to_string(character_alt_currency_entry.amount));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterAltCurrency> character_alt_currency_entries std::vector<CharacterAltCurrency> character_alt_currency_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterAltCurrency> All(Database& db) static std::vector<CharacterAltCurrency> All()
{ {
std::vector<CharacterAltCurrency> all_entries; std::vector<CharacterAltCurrency> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterAltCurrency> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterAltCurrency> GetWhere(std::string where_filter)
{ {
std::vector<CharacterAltCurrency> all_entries; std::vector<CharacterAltCurrency> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_alternate_abilities"); return std::string("character_alternate_abilities");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static CharacterAlternateAbilities FindOne( static CharacterAlternateAbilities FindOne(
Database& db,
int character_alternate_abilities_id int character_alternate_abilities_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_alternate_abilities_id int character_alternate_abilities_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterAlternateAbilities character_alternate_abilities_entry CharacterAlternateAbilities character_alternate_abilities_entry
) )
{ {
@@ -152,7 +181,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(character_alternate_abilities_entry.aa_value)); update_values.push_back(columns[2] + " = " + std::to_string(character_alternate_abilities_entry.aa_value));
update_values.push_back(columns[3] + " = " + std::to_string(character_alternate_abilities_entry.charges)); update_values.push_back(columns[3] + " = " + std::to_string(character_alternate_abilities_entry.charges));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -166,7 +195,6 @@ public:
} }
static CharacterAlternateAbilities InsertOne( static CharacterAlternateAbilities InsertOne(
Database& db,
CharacterAlternateAbilities character_alternate_abilities_entry CharacterAlternateAbilities character_alternate_abilities_entry
) )
{ {
@@ -177,7 +205,7 @@ public:
insert_values.push_back(std::to_string(character_alternate_abilities_entry.aa_value)); insert_values.push_back(std::to_string(character_alternate_abilities_entry.aa_value));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.charges)); insert_values.push_back(std::to_string(character_alternate_abilities_entry.charges));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -196,7 +224,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterAlternateAbilities> character_alternate_abilities_entries std::vector<CharacterAlternateAbilities> character_alternate_abilities_entries
) )
{ {
@@ -215,7 +242,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -226,11 +253,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterAlternateAbilities> All(Database& db) static std::vector<CharacterAlternateAbilities> All()
{ {
std::vector<CharacterAlternateAbilities> all_entries; std::vector<CharacterAlternateAbilities> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -253,11 +280,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterAlternateAbilities> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterAlternateAbilities> GetWhere(std::string where_filter)
{ {
std::vector<CharacterAlternateAbilities> all_entries; std::vector<CharacterAlternateAbilities> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -281,9 +308,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -294,9 +321,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_AURAS_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_AURAS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_auras"); return std::string("character_auras");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharacterAuras FindOne( static CharacterAuras FindOne(
Database& db,
int character_auras_id int character_auras_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_auras_id int character_auras_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterAuras character_auras_entry CharacterAuras character_auras_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_auras_entry.slot)); update_values.push_back(columns[1] + " = " + std::to_string(character_auras_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_auras_entry.spell_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_auras_entry.spell_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static CharacterAuras InsertOne( static CharacterAuras InsertOne(
Database& db,
CharacterAuras character_auras_entry CharacterAuras character_auras_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(character_auras_entry.slot)); insert_values.push_back(std::to_string(character_auras_entry.slot));
insert_values.push_back(std::to_string(character_auras_entry.spell_id)); insert_values.push_back(std::to_string(character_auras_entry.spell_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterAuras> character_auras_entries std::vector<CharacterAuras> character_auras_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterAuras> All(Database& db) static std::vector<CharacterAuras> All()
{ {
std::vector<CharacterAuras> all_entries; std::vector<CharacterAuras> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterAuras> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterAuras> GetWhere(std::string where_filter)
{ {
std::vector<CharacterAuras> all_entries; std::vector<CharacterAuras> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_BANDOLIER_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_BANDOLIER_REPOSITORY_H
@@ -48,6 +65,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_bandolier"); return std::string("character_bandolier");
@@ -67,7 +99,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -100,11 +132,10 @@ public:
} }
static CharacterBandolier FindOne( static CharacterBandolier FindOne(
Database& db,
int character_bandolier_id int character_bandolier_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -130,11 +161,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_bandolier_id int character_bandolier_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -147,7 +177,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterBandolier character_bandolier_entry CharacterBandolier character_bandolier_entry
) )
{ {
@@ -162,7 +191,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(character_bandolier_entry.icon)); update_values.push_back(columns[4] + " = " + std::to_string(character_bandolier_entry.icon));
update_values.push_back(columns[5] + " = '" + EscapeString(character_bandolier_entry.bandolier_name) + "'"); update_values.push_back(columns[5] + " = '" + EscapeString(character_bandolier_entry.bandolier_name) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -176,7 +205,6 @@ public:
} }
static CharacterBandolier InsertOne( static CharacterBandolier InsertOne(
Database& db,
CharacterBandolier character_bandolier_entry CharacterBandolier character_bandolier_entry
) )
{ {
@@ -189,7 +217,7 @@ public:
insert_values.push_back(std::to_string(character_bandolier_entry.icon)); insert_values.push_back(std::to_string(character_bandolier_entry.icon));
insert_values.push_back("'" + EscapeString(character_bandolier_entry.bandolier_name) + "'"); insert_values.push_back("'" + EscapeString(character_bandolier_entry.bandolier_name) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -208,7 +236,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterBandolier> character_bandolier_entries std::vector<CharacterBandolier> character_bandolier_entries
) )
{ {
@@ -229,7 +256,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -240,11 +267,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterBandolier> All(Database& db) static std::vector<CharacterBandolier> All()
{ {
std::vector<CharacterBandolier> all_entries; std::vector<CharacterBandolier> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -269,11 +296,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterBandolier> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterBandolier> GetWhere(std::string where_filter)
{ {
std::vector<CharacterBandolier> all_entries; std::vector<CharacterBandolier> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -299,9 +326,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -312,9 +339,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_BIND_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_BIND_REPOSITORY_H
@@ -52,6 +69,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_bind"); return std::string("character_bind");
@@ -71,7 +103,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -106,11 +138,10 @@ public:
} }
static CharacterBind FindOne( static CharacterBind FindOne(
Database& db,
int character_bind_id int character_bind_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -138,11 +169,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_bind_id int character_bind_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -155,7 +185,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterBind character_bind_entry CharacterBind character_bind_entry
) )
{ {
@@ -171,7 +200,7 @@ public:
update_values.push_back(columns[6] + " = " + std::to_string(character_bind_entry.z)); update_values.push_back(columns[6] + " = " + std::to_string(character_bind_entry.z));
update_values.push_back(columns[7] + " = " + std::to_string(character_bind_entry.heading)); update_values.push_back(columns[7] + " = " + std::to_string(character_bind_entry.heading));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -185,13 +214,11 @@ public:
} }
static CharacterBind InsertOne( static CharacterBind InsertOne(
Database& db,
CharacterBind character_bind_entry CharacterBind character_bind_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bind_entry.id));
insert_values.push_back(std::to_string(character_bind_entry.slot)); insert_values.push_back(std::to_string(character_bind_entry.slot));
insert_values.push_back(std::to_string(character_bind_entry.zone_id)); insert_values.push_back(std::to_string(character_bind_entry.zone_id));
insert_values.push_back(std::to_string(character_bind_entry.instance_id)); insert_values.push_back(std::to_string(character_bind_entry.instance_id));
@@ -200,7 +227,7 @@ public:
insert_values.push_back(std::to_string(character_bind_entry.z)); insert_values.push_back(std::to_string(character_bind_entry.z));
insert_values.push_back(std::to_string(character_bind_entry.heading)); insert_values.push_back(std::to_string(character_bind_entry.heading));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -219,7 +246,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterBind> character_bind_entries std::vector<CharacterBind> character_bind_entries
) )
{ {
@@ -228,7 +254,6 @@ public:
for (auto &character_bind_entry: character_bind_entries) { for (auto &character_bind_entry: character_bind_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bind_entry.id));
insert_values.push_back(std::to_string(character_bind_entry.slot)); insert_values.push_back(std::to_string(character_bind_entry.slot));
insert_values.push_back(std::to_string(character_bind_entry.zone_id)); insert_values.push_back(std::to_string(character_bind_entry.zone_id));
insert_values.push_back(std::to_string(character_bind_entry.instance_id)); insert_values.push_back(std::to_string(character_bind_entry.instance_id));
@@ -242,7 +267,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -253,11 +278,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterBind> All(Database& db) static std::vector<CharacterBind> All()
{ {
std::vector<CharacterBind> all_entries; std::vector<CharacterBind> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -284,11 +309,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterBind> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterBind> GetWhere(std::string where_filter)
{ {
std::vector<CharacterBind> all_entries; std::vector<CharacterBind> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -316,9 +341,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -329,9 +354,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_BUFFS_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_BUFFS_REPOSITORY_H
@@ -70,6 +87,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_buffs"); return std::string("character_buffs");
@@ -89,7 +121,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -133,11 +165,10 @@ public:
} }
static CharacterBuffs FindOne( static CharacterBuffs FindOne(
Database& db,
int character_buffs_id int character_buffs_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -174,11 +205,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_buffs_id int character_buffs_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -191,7 +221,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterBuffs character_buffs_entry CharacterBuffs character_buffs_entry
) )
{ {
@@ -217,7 +246,7 @@ public:
update_values.push_back(columns[15] + " = " + std::to_string(character_buffs_entry.ExtraDIChance)); update_values.push_back(columns[15] + " = " + std::to_string(character_buffs_entry.ExtraDIChance));
update_values.push_back(columns[16] + " = " + std::to_string(character_buffs_entry.instrument_mod)); update_values.push_back(columns[16] + " = " + std::to_string(character_buffs_entry.instrument_mod));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -231,7 +260,6 @@ public:
} }
static CharacterBuffs InsertOne( static CharacterBuffs InsertOne(
Database& db,
CharacterBuffs character_buffs_entry CharacterBuffs character_buffs_entry
) )
{ {
@@ -255,7 +283,7 @@ public:
insert_values.push_back(std::to_string(character_buffs_entry.ExtraDIChance)); insert_values.push_back(std::to_string(character_buffs_entry.ExtraDIChance));
insert_values.push_back(std::to_string(character_buffs_entry.instrument_mod)); insert_values.push_back(std::to_string(character_buffs_entry.instrument_mod));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -274,7 +302,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterBuffs> character_buffs_entries std::vector<CharacterBuffs> character_buffs_entries
) )
{ {
@@ -306,7 +333,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -317,11 +344,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterBuffs> All(Database& db) static std::vector<CharacterBuffs> All()
{ {
std::vector<CharacterBuffs> all_entries; std::vector<CharacterBuffs> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -357,11 +384,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterBuffs> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterBuffs> GetWhere(std::string where_filter)
{ {
std::vector<CharacterBuffs> all_entries; std::vector<CharacterBuffs> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -398,9 +425,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -411,9 +438,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_CORPSE_ITEMS_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
@@ -58,6 +75,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_corpse_items"); return std::string("character_corpse_items");
@@ -77,7 +109,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -115,11 +147,10 @@ public:
} }
static CharacterCorpseItems FindOne( static CharacterCorpseItems FindOne(
Database& db,
int character_corpse_items_id int character_corpse_items_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -150,11 +181,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_corpse_items_id int character_corpse_items_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -167,7 +197,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterCorpseItems character_corpse_items_entry CharacterCorpseItems character_corpse_items_entry
) )
{ {
@@ -187,7 +216,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(character_corpse_items_entry.aug_6)); update_values.push_back(columns[9] + " = " + std::to_string(character_corpse_items_entry.aug_6));
update_values.push_back(columns[10] + " = " + std::to_string(character_corpse_items_entry.attuned)); update_values.push_back(columns[10] + " = " + std::to_string(character_corpse_items_entry.attuned));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -201,7 +230,6 @@ public:
} }
static CharacterCorpseItems InsertOne( static CharacterCorpseItems InsertOne(
Database& db,
CharacterCorpseItems character_corpse_items_entry CharacterCorpseItems character_corpse_items_entry
) )
{ {
@@ -219,7 +247,7 @@ public:
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_6)); insert_values.push_back(std::to_string(character_corpse_items_entry.aug_6));
insert_values.push_back(std::to_string(character_corpse_items_entry.attuned)); insert_values.push_back(std::to_string(character_corpse_items_entry.attuned));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -238,7 +266,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterCorpseItems> character_corpse_items_entries std::vector<CharacterCorpseItems> character_corpse_items_entries
) )
{ {
@@ -264,7 +291,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -275,11 +302,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterCorpseItems> All(Database& db) static std::vector<CharacterCorpseItems> All()
{ {
std::vector<CharacterCorpseItems> all_entries; std::vector<CharacterCorpseItems> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -309,11 +336,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterCorpseItems> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterCorpseItems> GetWhere(std::string where_filter)
{ {
std::vector<CharacterCorpseItems> all_entries; std::vector<CharacterCorpseItems> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -344,9 +371,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -357,9 +384,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_CORPSES_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_CORPSES_REPOSITORY_H
@@ -130,6 +147,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_corpses"); return std::string("character_corpses");
@@ -149,7 +181,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -223,11 +255,10 @@ public:
} }
static CharacterCorpses FindOne( static CharacterCorpses FindOne(
Database& db,
int character_corpses_id int character_corpses_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -294,11 +325,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_corpses_id int character_corpses_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -311,7 +341,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterCorpses character_corpses_entry CharacterCorpses character_corpses_entry
) )
{ {
@@ -366,7 +395,7 @@ public:
update_values.push_back(columns[45] + " = " + std::to_string(character_corpses_entry.wc_8)); update_values.push_back(columns[45] + " = " + std::to_string(character_corpses_entry.wc_8));
update_values.push_back(columns[46] + " = " + std::to_string(character_corpses_entry.wc_9)); update_values.push_back(columns[46] + " = " + std::to_string(character_corpses_entry.wc_9));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -380,13 +409,11 @@ public:
} }
static CharacterCorpses InsertOne( static CharacterCorpses InsertOne(
Database& db,
CharacterCorpses character_corpses_entry CharacterCorpses character_corpses_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpses_entry.id));
insert_values.push_back(std::to_string(character_corpses_entry.charid)); insert_values.push_back(std::to_string(character_corpses_entry.charid));
insert_values.push_back("'" + EscapeString(character_corpses_entry.charname) + "'"); insert_values.push_back("'" + EscapeString(character_corpses_entry.charname) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.zone_id)); insert_values.push_back(std::to_string(character_corpses_entry.zone_id));
@@ -434,7 +461,7 @@ public:
insert_values.push_back(std::to_string(character_corpses_entry.wc_8)); insert_values.push_back(std::to_string(character_corpses_entry.wc_8));
insert_values.push_back(std::to_string(character_corpses_entry.wc_9)); insert_values.push_back(std::to_string(character_corpses_entry.wc_9));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -453,7 +480,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterCorpses> character_corpses_entries std::vector<CharacterCorpses> character_corpses_entries
) )
{ {
@@ -462,7 +488,6 @@ public:
for (auto &character_corpses_entry: character_corpses_entries) { for (auto &character_corpses_entry: character_corpses_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpses_entry.id));
insert_values.push_back(std::to_string(character_corpses_entry.charid)); insert_values.push_back(std::to_string(character_corpses_entry.charid));
insert_values.push_back("'" + EscapeString(character_corpses_entry.charname) + "'"); insert_values.push_back("'" + EscapeString(character_corpses_entry.charname) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.zone_id)); insert_values.push_back(std::to_string(character_corpses_entry.zone_id));
@@ -515,7 +540,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -526,11 +551,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterCorpses> All(Database& db) static std::vector<CharacterCorpses> All()
{ {
std::vector<CharacterCorpses> all_entries; std::vector<CharacterCorpses> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -596,11 +621,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterCorpses> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterCorpses> GetWhere(std::string where_filter)
{ {
std::vector<CharacterCorpses> all_entries; std::vector<CharacterCorpses> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -667,9 +692,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -680,9 +705,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_CURRENCY_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_CURRENCY_REPOSITORY_H
@@ -70,6 +87,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_currency"); return std::string("character_currency");
@@ -89,7 +121,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -133,11 +165,10 @@ public:
} }
static CharacterCurrency FindOne( static CharacterCurrency FindOne(
Database& db,
int character_currency_id int character_currency_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -174,11 +205,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_currency_id int character_currency_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -191,7 +221,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterCurrency character_currency_entry CharacterCurrency character_currency_entry
) )
{ {
@@ -217,7 +246,7 @@ public:
update_values.push_back(columns[15] + " = " + std::to_string(character_currency_entry.ebon_crystals)); update_values.push_back(columns[15] + " = " + std::to_string(character_currency_entry.ebon_crystals));
update_values.push_back(columns[16] + " = " + std::to_string(character_currency_entry.career_ebon_crystals)); update_values.push_back(columns[16] + " = " + std::to_string(character_currency_entry.career_ebon_crystals));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -231,7 +260,6 @@ public:
} }
static CharacterCurrency InsertOne( static CharacterCurrency InsertOne(
Database& db,
CharacterCurrency character_currency_entry CharacterCurrency character_currency_entry
) )
{ {
@@ -255,7 +283,7 @@ public:
insert_values.push_back(std::to_string(character_currency_entry.ebon_crystals)); insert_values.push_back(std::to_string(character_currency_entry.ebon_crystals));
insert_values.push_back(std::to_string(character_currency_entry.career_ebon_crystals)); insert_values.push_back(std::to_string(character_currency_entry.career_ebon_crystals));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -274,7 +302,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterCurrency> character_currency_entries std::vector<CharacterCurrency> character_currency_entries
) )
{ {
@@ -306,7 +333,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -317,11 +344,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterCurrency> All(Database& db) static std::vector<CharacterCurrency> All()
{ {
std::vector<CharacterCurrency> all_entries; std::vector<CharacterCurrency> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -357,11 +384,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterCurrency> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterCurrency> GetWhere(std::string where_filter)
{ {
std::vector<CharacterCurrency> all_entries; std::vector<CharacterCurrency> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -398,9 +425,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -411,9 +438,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_DATA_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_DATA_REPOSITORY_H
@@ -240,6 +257,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_data"); return std::string("character_data");
@@ -259,7 +291,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -388,11 +420,10 @@ public:
} }
static CharacterData FindOne( static CharacterData FindOne(
Database& db,
int character_data_id int character_data_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -514,11 +545,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_data_id int character_data_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -531,7 +561,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterData character_data_entry CharacterData character_data_entry
) )
{ {
@@ -641,7 +670,7 @@ public:
update_values.push_back(columns[100] + " = " + std::to_string(character_data_entry.e_last_invsnapshot)); update_values.push_back(columns[100] + " = " + std::to_string(character_data_entry.e_last_invsnapshot));
update_values.push_back(columns[101] + " = '" + EscapeString(character_data_entry.deleted_at) + "'"); update_values.push_back(columns[101] + " = '" + EscapeString(character_data_entry.deleted_at) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -655,13 +684,11 @@ public:
} }
static CharacterData InsertOne( static CharacterData InsertOne(
Database& db,
CharacterData character_data_entry CharacterData character_data_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_data_entry.id));
insert_values.push_back(std::to_string(character_data_entry.account_id)); insert_values.push_back(std::to_string(character_data_entry.account_id));
insert_values.push_back("'" + EscapeString(character_data_entry.name) + "'"); insert_values.push_back("'" + EscapeString(character_data_entry.name) + "'");
insert_values.push_back("'" + EscapeString(character_data_entry.last_name) + "'"); insert_values.push_back("'" + EscapeString(character_data_entry.last_name) + "'");
@@ -764,7 +791,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.e_last_invsnapshot)); insert_values.push_back(std::to_string(character_data_entry.e_last_invsnapshot));
insert_values.push_back("'" + EscapeString(character_data_entry.deleted_at) + "'"); insert_values.push_back("'" + EscapeString(character_data_entry.deleted_at) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -783,7 +810,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterData> character_data_entries std::vector<CharacterData> character_data_entries
) )
{ {
@@ -792,7 +818,6 @@ public:
for (auto &character_data_entry: character_data_entries) { for (auto &character_data_entry: character_data_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_data_entry.id));
insert_values.push_back(std::to_string(character_data_entry.account_id)); insert_values.push_back(std::to_string(character_data_entry.account_id));
insert_values.push_back("'" + EscapeString(character_data_entry.name) + "'"); insert_values.push_back("'" + EscapeString(character_data_entry.name) + "'");
insert_values.push_back("'" + EscapeString(character_data_entry.last_name) + "'"); insert_values.push_back("'" + EscapeString(character_data_entry.last_name) + "'");
@@ -900,7 +925,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -911,11 +936,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterData> All(Database& db) static std::vector<CharacterData> All()
{ {
std::vector<CharacterData> all_entries; std::vector<CharacterData> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -1036,11 +1061,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterData> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterData> GetWhere(std::string where_filter)
{ {
std::vector<CharacterData> all_entries; std::vector<CharacterData> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -1162,9 +1187,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -1175,9 +1200,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_DISCIPLINES_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_DISCIPLINES_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_disciplines"); return std::string("character_disciplines");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharacterDisciplines FindOne( static CharacterDisciplines FindOne(
Database& db,
int character_disciplines_id int character_disciplines_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_disciplines_id int character_disciplines_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterDisciplines character_disciplines_entry CharacterDisciplines character_disciplines_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_disciplines_entry.slot_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_disciplines_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_disciplines_entry.disc_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_disciplines_entry.disc_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static CharacterDisciplines InsertOne( static CharacterDisciplines InsertOne(
Database& db,
CharacterDisciplines character_disciplines_entry CharacterDisciplines character_disciplines_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(character_disciplines_entry.slot_id)); insert_values.push_back(std::to_string(character_disciplines_entry.slot_id));
insert_values.push_back(std::to_string(character_disciplines_entry.disc_id)); insert_values.push_back(std::to_string(character_disciplines_entry.disc_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterDisciplines> character_disciplines_entries std::vector<CharacterDisciplines> character_disciplines_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterDisciplines> All(Database& db) static std::vector<CharacterDisciplines> All()
{ {
std::vector<CharacterDisciplines> all_entries; std::vector<CharacterDisciplines> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterDisciplines> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterDisciplines> GetWhere(std::string where_filter)
{ {
std::vector<CharacterDisciplines> all_entries; std::vector<CharacterDisciplines> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,337 +0,0 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterExpeditionLockoutsRepository {
public:
struct CharacterExpeditionLockouts {
int id;
int character_id;
std::string expedition_name;
std::string event_name;
std::string expire_time;
int duration;
std::string from_expedition_uuid;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"character_id",
"expedition_name",
"event_name",
"expire_time",
"duration",
"from_expedition_uuid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_expedition_lockouts");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterExpeditionLockouts NewEntity()
{
CharacterExpeditionLockouts entry{};
entry.id = 0;
entry.character_id = 0;
entry.expedition_name = "";
entry.event_name = "";
entry.expire_time = current_timestamp();
entry.duration = 0;
entry.from_expedition_uuid = "";
return entry;
}
static CharacterExpeditionLockouts GetCharacterExpeditionLockoutsEntry(
const std::vector<CharacterExpeditionLockouts> &character_expedition_lockoutss,
int character_expedition_lockouts_id
)
{
for (auto &character_expedition_lockouts : character_expedition_lockoutss) {
if (character_expedition_lockouts.id == character_expedition_lockouts_id) {
return character_expedition_lockouts;
}
}
return NewEntity();
}
static CharacterExpeditionLockouts FindOne(
Database& db,
int character_expedition_lockouts_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_expedition_lockouts_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterExpeditionLockouts entry{};
entry.id = atoi(row[0]);
entry.character_id = atoi(row[1]);
entry.expedition_name = row[2] ? row[2] : "";
entry.event_name = row[3] ? row[3] : "";
entry.expire_time = row[4] ? row[4] : "";
entry.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_expedition_lockouts_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_expedition_lockouts_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterExpeditionLockouts character_expedition_lockouts_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(character_expedition_lockouts_entry.character_id));
update_values.push_back(columns[2] + " = '" + EscapeString(character_expedition_lockouts_entry.expedition_name) + "'");
update_values.push_back(columns[3] + " = '" + EscapeString(character_expedition_lockouts_entry.event_name) + "'");
update_values.push_back(columns[4] + " = '" + EscapeString(character_expedition_lockouts_entry.expire_time) + "'");
update_values.push_back(columns[5] + " = " + std::to_string(character_expedition_lockouts_entry.duration));
update_values.push_back(columns[6] + " = '" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_expedition_lockouts_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterExpeditionLockouts InsertOne(
Database& db,
CharacterExpeditionLockouts character_expedition_lockouts_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.id));
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.character_id));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expedition_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_expedition_lockouts_entry.id = results.LastInsertedID();
return character_expedition_lockouts_entry;
}
character_expedition_lockouts_entry = NewEntity();
return character_expedition_lockouts_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterExpeditionLockouts> character_expedition_lockouts_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_expedition_lockouts_entry: character_expedition_lockouts_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.id));
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.character_id));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expedition_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterExpeditionLockouts> All(Database& db)
{
std::vector<CharacterExpeditionLockouts> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterExpeditionLockouts entry{};
entry.id = atoi(row[0]);
entry.character_id = atoi(row[1]);
entry.expedition_name = row[2] ? row[2] : "";
entry.event_name = row[3] ? row[3] : "";
entry.expire_time = row[4] ? row[4] : "";
entry.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterExpeditionLockouts> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterExpeditionLockouts> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterExpeditionLockouts entry{};
entry.id = atoi(row[0]);
entry.character_id = atoi(row[1]);
entry.expedition_name = row[2] ? row[2] : "";
entry.event_name = row[3] ? row[3] : "";
entry.expire_time = row[4] ? row[4] : "";
entry.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_INSPECT_MESSAGES_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_INSPECT_MESSAGES_REPOSITORY_H
@@ -40,6 +57,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_inspect_messages"); return std::string("character_inspect_messages");
@@ -59,7 +91,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -88,11 +120,10 @@ public:
} }
static CharacterInspectMessages FindOne( static CharacterInspectMessages FindOne(
Database& db,
int character_inspect_messages_id int character_inspect_messages_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -114,11 +145,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_inspect_messages_id int character_inspect_messages_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -131,7 +161,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterInspectMessages character_inspect_messages_entry CharacterInspectMessages character_inspect_messages_entry
) )
{ {
@@ -142,7 +171,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(character_inspect_messages_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(character_inspect_messages_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(character_inspect_messages_entry.inspect_message) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(character_inspect_messages_entry.inspect_message) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -156,7 +185,6 @@ public:
} }
static CharacterInspectMessages InsertOne( static CharacterInspectMessages InsertOne(
Database& db,
CharacterInspectMessages character_inspect_messages_entry CharacterInspectMessages character_inspect_messages_entry
) )
{ {
@@ -165,7 +193,7 @@ public:
insert_values.push_back(std::to_string(character_inspect_messages_entry.id)); insert_values.push_back(std::to_string(character_inspect_messages_entry.id));
insert_values.push_back("'" + EscapeString(character_inspect_messages_entry.inspect_message) + "'"); insert_values.push_back("'" + EscapeString(character_inspect_messages_entry.inspect_message) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -184,7 +212,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterInspectMessages> character_inspect_messages_entries std::vector<CharacterInspectMessages> character_inspect_messages_entries
) )
{ {
@@ -201,7 +228,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -212,11 +239,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterInspectMessages> All(Database& db) static std::vector<CharacterInspectMessages> All()
{ {
std::vector<CharacterInspectMessages> all_entries; std::vector<CharacterInspectMessages> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -237,11 +264,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterInspectMessages> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterInspectMessages> GetWhere(std::string where_filter)
{ {
std::vector<CharacterInspectMessages> all_entries; std::vector<CharacterInspectMessages> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -263,9 +290,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -276,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_ITEM_RECAST_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_ITEM_RECAST_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_item_recast"); return std::string("character_item_recast");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharacterItemRecast FindOne( static CharacterItemRecast FindOne(
Database& db,
int character_item_recast_id int character_item_recast_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_item_recast_id int character_item_recast_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterItemRecast character_item_recast_entry CharacterItemRecast character_item_recast_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_item_recast_entry.recast_type)); update_values.push_back(columns[1] + " = " + std::to_string(character_item_recast_entry.recast_type));
update_values.push_back(columns[2] + " = " + std::to_string(character_item_recast_entry.timestamp)); update_values.push_back(columns[2] + " = " + std::to_string(character_item_recast_entry.timestamp));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static CharacterItemRecast InsertOne( static CharacterItemRecast InsertOne(
Database& db,
CharacterItemRecast character_item_recast_entry CharacterItemRecast character_item_recast_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(character_item_recast_entry.recast_type)); insert_values.push_back(std::to_string(character_item_recast_entry.recast_type));
insert_values.push_back(std::to_string(character_item_recast_entry.timestamp)); insert_values.push_back(std::to_string(character_item_recast_entry.timestamp));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterItemRecast> character_item_recast_entries std::vector<CharacterItemRecast> character_item_recast_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterItemRecast> All(Database& db) static std::vector<CharacterItemRecast> All()
{ {
std::vector<CharacterItemRecast> all_entries; std::vector<CharacterItemRecast> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterItemRecast> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterItemRecast> GetWhere(std::string where_filter)
{ {
std::vector<CharacterItemRecast> all_entries; std::vector<CharacterItemRecast> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_LANGUAGES_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_LANGUAGES_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_languages"); return std::string("character_languages");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharacterLanguages FindOne( static CharacterLanguages FindOne(
Database& db,
int character_languages_id int character_languages_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_languages_id int character_languages_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterLanguages character_languages_entry CharacterLanguages character_languages_entry
) )
{ {
@@ -146,7 +175,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_languages_entry.lang_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_languages_entry.lang_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_languages_entry.value)); update_values.push_back(columns[2] + " = " + std::to_string(character_languages_entry.value));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -160,17 +189,15 @@ public:
} }
static CharacterLanguages InsertOne( static CharacterLanguages InsertOne(
Database& db,
CharacterLanguages character_languages_entry CharacterLanguages character_languages_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_languages_entry.id));
insert_values.push_back(std::to_string(character_languages_entry.lang_id)); insert_values.push_back(std::to_string(character_languages_entry.lang_id));
insert_values.push_back(std::to_string(character_languages_entry.value)); insert_values.push_back(std::to_string(character_languages_entry.value));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -189,7 +216,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterLanguages> character_languages_entries std::vector<CharacterLanguages> character_languages_entries
) )
{ {
@@ -198,7 +224,6 @@ public:
for (auto &character_languages_entry: character_languages_entries) { for (auto &character_languages_entry: character_languages_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_languages_entry.id));
insert_values.push_back(std::to_string(character_languages_entry.lang_id)); insert_values.push_back(std::to_string(character_languages_entry.lang_id));
insert_values.push_back(std::to_string(character_languages_entry.value)); insert_values.push_back(std::to_string(character_languages_entry.value));
@@ -207,7 +232,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -218,11 +243,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterLanguages> All(Database& db) static std::vector<CharacterLanguages> All()
{ {
std::vector<CharacterLanguages> all_entries; std::vector<CharacterLanguages> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -244,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterLanguages> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterLanguages> GetWhere(std::string where_filter)
{ {
std::vector<CharacterLanguages> all_entries; std::vector<CharacterLanguages> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -271,9 +296,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -284,9 +309,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_LEADERSHIP_ABILITIES_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_LEADERSHIP_ABILITIES_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_leadership_abilities"); return std::string("character_leadership_abilities");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharacterLeadershipAbilities FindOne( static CharacterLeadershipAbilities FindOne(
Database& db,
int character_leadership_abilities_id int character_leadership_abilities_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_leadership_abilities_id int character_leadership_abilities_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterLeadershipAbilities character_leadership_abilities_entry CharacterLeadershipAbilities character_leadership_abilities_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_leadership_abilities_entry.slot)); update_values.push_back(columns[1] + " = " + std::to_string(character_leadership_abilities_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_leadership_abilities_entry.rank)); update_values.push_back(columns[2] + " = " + std::to_string(character_leadership_abilities_entry.rank));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static CharacterLeadershipAbilities InsertOne( static CharacterLeadershipAbilities InsertOne(
Database& db,
CharacterLeadershipAbilities character_leadership_abilities_entry CharacterLeadershipAbilities character_leadership_abilities_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(character_leadership_abilities_entry.slot)); insert_values.push_back(std::to_string(character_leadership_abilities_entry.slot));
insert_values.push_back(std::to_string(character_leadership_abilities_entry.rank)); insert_values.push_back(std::to_string(character_leadership_abilities_entry.rank));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterLeadershipAbilities> character_leadership_abilities_entries std::vector<CharacterLeadershipAbilities> character_leadership_abilities_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterLeadershipAbilities> All(Database& db) static std::vector<CharacterLeadershipAbilities> All()
{ {
std::vector<CharacterLeadershipAbilities> all_entries; std::vector<CharacterLeadershipAbilities> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterLeadershipAbilities> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterLeadershipAbilities> GetWhere(std::string where_filter)
{ {
std::vector<CharacterLeadershipAbilities> all_entries; std::vector<CharacterLeadershipAbilities> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_MATERIAL_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_MATERIAL_REPOSITORY_H
@@ -50,6 +67,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_material"); return std::string("character_material");
@@ -69,7 +101,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -103,11 +135,10 @@ public:
} }
static CharacterMaterial FindOne( static CharacterMaterial FindOne(
Database& db,
int character_material_id int character_material_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -134,11 +165,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_material_id int character_material_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -151,7 +181,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterMaterial character_material_entry CharacterMaterial character_material_entry
) )
{ {
@@ -166,7 +195,7 @@ public:
update_values.push_back(columns[5] + " = " + std::to_string(character_material_entry.use_tint)); update_values.push_back(columns[5] + " = " + std::to_string(character_material_entry.use_tint));
update_values.push_back(columns[6] + " = " + std::to_string(character_material_entry.color)); update_values.push_back(columns[6] + " = " + std::to_string(character_material_entry.color));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -180,13 +209,11 @@ public:
} }
static CharacterMaterial InsertOne( static CharacterMaterial InsertOne(
Database& db,
CharacterMaterial character_material_entry CharacterMaterial character_material_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_material_entry.id));
insert_values.push_back(std::to_string(character_material_entry.slot)); insert_values.push_back(std::to_string(character_material_entry.slot));
insert_values.push_back(std::to_string(character_material_entry.blue)); insert_values.push_back(std::to_string(character_material_entry.blue));
insert_values.push_back(std::to_string(character_material_entry.green)); insert_values.push_back(std::to_string(character_material_entry.green));
@@ -194,7 +221,7 @@ public:
insert_values.push_back(std::to_string(character_material_entry.use_tint)); insert_values.push_back(std::to_string(character_material_entry.use_tint));
insert_values.push_back(std::to_string(character_material_entry.color)); insert_values.push_back(std::to_string(character_material_entry.color));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -213,7 +240,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterMaterial> character_material_entries std::vector<CharacterMaterial> character_material_entries
) )
{ {
@@ -222,7 +248,6 @@ public:
for (auto &character_material_entry: character_material_entries) { for (auto &character_material_entry: character_material_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_material_entry.id));
insert_values.push_back(std::to_string(character_material_entry.slot)); insert_values.push_back(std::to_string(character_material_entry.slot));
insert_values.push_back(std::to_string(character_material_entry.blue)); insert_values.push_back(std::to_string(character_material_entry.blue));
insert_values.push_back(std::to_string(character_material_entry.green)); insert_values.push_back(std::to_string(character_material_entry.green));
@@ -235,7 +260,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -246,11 +271,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterMaterial> All(Database& db) static std::vector<CharacterMaterial> All()
{ {
std::vector<CharacterMaterial> all_entries; std::vector<CharacterMaterial> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -276,11 +301,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterMaterial> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterMaterial> GetWhere(std::string where_filter)
{ {
std::vector<CharacterMaterial> all_entries; std::vector<CharacterMaterial> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -307,9 +332,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -320,9 +345,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_MEMMED_SPELLS_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_MEMMED_SPELLS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_memmed_spells"); return std::string("character_memmed_spells");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharacterMemmedSpells FindOne( static CharacterMemmedSpells FindOne(
Database& db,
int character_memmed_spells_id int character_memmed_spells_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_memmed_spells_id int character_memmed_spells_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterMemmedSpells character_memmed_spells_entry CharacterMemmedSpells character_memmed_spells_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_memmed_spells_entry.slot_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_memmed_spells_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_memmed_spells_entry.spell_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_memmed_spells_entry.spell_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static CharacterMemmedSpells InsertOne( static CharacterMemmedSpells InsertOne(
Database& db,
CharacterMemmedSpells character_memmed_spells_entry CharacterMemmedSpells character_memmed_spells_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(character_memmed_spells_entry.slot_id)); insert_values.push_back(std::to_string(character_memmed_spells_entry.slot_id));
insert_values.push_back(std::to_string(character_memmed_spells_entry.spell_id)); insert_values.push_back(std::to_string(character_memmed_spells_entry.spell_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterMemmedSpells> character_memmed_spells_entries std::vector<CharacterMemmedSpells> character_memmed_spells_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterMemmedSpells> All(Database& db) static std::vector<CharacterMemmedSpells> All()
{ {
std::vector<CharacterMemmedSpells> all_entries; std::vector<CharacterMemmedSpells> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterMemmedSpells> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterMemmedSpells> GetWhere(std::string where_filter)
{ {
std::vector<CharacterMemmedSpells> all_entries; std::vector<CharacterMemmedSpells> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_PET_BUFFS_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_PET_BUFFS_REPOSITORY_H
@@ -58,6 +75,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_pet_buffs"); return std::string("character_pet_buffs");
@@ -77,7 +109,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -115,11 +147,10 @@ public:
} }
static CharacterPetBuffs FindOne( static CharacterPetBuffs FindOne(
Database& db,
int character_pet_buffs_id int character_pet_buffs_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -150,11 +181,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_pet_buffs_id int character_pet_buffs_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -167,7 +197,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterPetBuffs character_pet_buffs_entry CharacterPetBuffs character_pet_buffs_entry
) )
{ {
@@ -187,7 +216,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(character_pet_buffs_entry.rune)); update_values.push_back(columns[9] + " = " + std::to_string(character_pet_buffs_entry.rune));
update_values.push_back(columns[10] + " = " + std::to_string(character_pet_buffs_entry.instrument_mod)); update_values.push_back(columns[10] + " = " + std::to_string(character_pet_buffs_entry.instrument_mod));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -201,7 +230,6 @@ public:
} }
static CharacterPetBuffs InsertOne( static CharacterPetBuffs InsertOne(
Database& db,
CharacterPetBuffs character_pet_buffs_entry CharacterPetBuffs character_pet_buffs_entry
) )
{ {
@@ -219,7 +247,7 @@ public:
insert_values.push_back(std::to_string(character_pet_buffs_entry.rune)); insert_values.push_back(std::to_string(character_pet_buffs_entry.rune));
insert_values.push_back(std::to_string(character_pet_buffs_entry.instrument_mod)); insert_values.push_back(std::to_string(character_pet_buffs_entry.instrument_mod));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -238,7 +266,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterPetBuffs> character_pet_buffs_entries std::vector<CharacterPetBuffs> character_pet_buffs_entries
) )
{ {
@@ -264,7 +291,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -275,11 +302,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterPetBuffs> All(Database& db) static std::vector<CharacterPetBuffs> All()
{ {
std::vector<CharacterPetBuffs> all_entries; std::vector<CharacterPetBuffs> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -309,11 +336,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterPetBuffs> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterPetBuffs> GetWhere(std::string where_filter)
{ {
std::vector<CharacterPetBuffs> all_entries; std::vector<CharacterPetBuffs> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -344,9 +371,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -357,9 +384,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_PET_INFO_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_PET_INFO_REPOSITORY_H
@@ -26,7 +43,6 @@ public:
int hp; int hp;
int mana; int mana;
float size; float size;
int taunting;
}; };
static std::string PrimaryKey() static std::string PrimaryKey()
@@ -45,7 +61,6 @@ public:
"hp", "hp",
"mana", "mana",
"size", "size",
"taunting",
}; };
} }
@@ -54,6 +69,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_pet_info"); return std::string("character_pet_info");
@@ -73,7 +103,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -89,7 +119,6 @@ public:
entry.hp = 0; entry.hp = 0;
entry.mana = 0; entry.mana = 0;
entry.size = 0; entry.size = 0;
entry.taunting = 1;
return entry; return entry;
} }
@@ -109,11 +138,10 @@ public:
} }
static CharacterPetInfo FindOne( static CharacterPetInfo FindOne(
Database& db,
int character_pet_info_id int character_pet_info_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -133,7 +161,6 @@ public:
entry.hp = atoi(row[5]); entry.hp = atoi(row[5]);
entry.mana = atoi(row[6]); entry.mana = atoi(row[6]);
entry.size = static_cast<float>(atof(row[7])); entry.size = static_cast<float>(atof(row[7]));
entry.taunting = atoi(row[8]);
return entry; return entry;
} }
@@ -142,11 +169,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_pet_info_id int character_pet_info_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -159,7 +185,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterPetInfo character_pet_info_entry CharacterPetInfo character_pet_info_entry
) )
{ {
@@ -175,9 +200,8 @@ public:
update_values.push_back(columns[5] + " = " + std::to_string(character_pet_info_entry.hp)); update_values.push_back(columns[5] + " = " + std::to_string(character_pet_info_entry.hp));
update_values.push_back(columns[6] + " = " + std::to_string(character_pet_info_entry.mana)); update_values.push_back(columns[6] + " = " + std::to_string(character_pet_info_entry.mana));
update_values.push_back(columns[7] + " = " + std::to_string(character_pet_info_entry.size)); update_values.push_back(columns[7] + " = " + std::to_string(character_pet_info_entry.size));
update_values.push_back(columns[8] + " = " + std::to_string(character_pet_info_entry.taunting));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -191,7 +215,6 @@ public:
} }
static CharacterPetInfo InsertOne( static CharacterPetInfo InsertOne(
Database& db,
CharacterPetInfo character_pet_info_entry CharacterPetInfo character_pet_info_entry
) )
{ {
@@ -205,9 +228,8 @@ public:
insert_values.push_back(std::to_string(character_pet_info_entry.hp)); insert_values.push_back(std::to_string(character_pet_info_entry.hp));
insert_values.push_back(std::to_string(character_pet_info_entry.mana)); insert_values.push_back(std::to_string(character_pet_info_entry.mana));
insert_values.push_back(std::to_string(character_pet_info_entry.size)); insert_values.push_back(std::to_string(character_pet_info_entry.size));
insert_values.push_back(std::to_string(character_pet_info_entry.taunting));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -226,7 +248,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterPetInfo> character_pet_info_entries std::vector<CharacterPetInfo> character_pet_info_entries
) )
{ {
@@ -243,14 +264,13 @@ public:
insert_values.push_back(std::to_string(character_pet_info_entry.hp)); insert_values.push_back(std::to_string(character_pet_info_entry.hp));
insert_values.push_back(std::to_string(character_pet_info_entry.mana)); insert_values.push_back(std::to_string(character_pet_info_entry.mana));
insert_values.push_back(std::to_string(character_pet_info_entry.size)); insert_values.push_back(std::to_string(character_pet_info_entry.size));
insert_values.push_back(std::to_string(character_pet_info_entry.taunting));
insert_chunks.push_back("(" + implode(",", insert_values) + ")"); insert_chunks.push_back("(" + implode(",", insert_values) + ")");
} }
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -261,11 +281,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterPetInfo> All(Database& db) static std::vector<CharacterPetInfo> All()
{ {
std::vector<CharacterPetInfo> all_entries; std::vector<CharacterPetInfo> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -285,7 +305,6 @@ public:
entry.hp = atoi(row[5]); entry.hp = atoi(row[5]);
entry.mana = atoi(row[6]); entry.mana = atoi(row[6]);
entry.size = static_cast<float>(atof(row[7])); entry.size = static_cast<float>(atof(row[7]));
entry.taunting = atoi(row[8]);
all_entries.push_back(entry); all_entries.push_back(entry);
} }
@@ -293,11 +312,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterPetInfo> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterPetInfo> GetWhere(std::string where_filter)
{ {
std::vector<CharacterPetInfo> all_entries; std::vector<CharacterPetInfo> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -318,7 +337,6 @@ public:
entry.hp = atoi(row[5]); entry.hp = atoi(row[5]);
entry.mana = atoi(row[6]); entry.mana = atoi(row[6]);
entry.size = static_cast<float>(atof(row[7])); entry.size = static_cast<float>(atof(row[7]));
entry.taunting = atoi(row[8]);
all_entries.push_back(entry); all_entries.push_back(entry);
} }
@@ -326,9 +344,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -339,9 +357,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_PET_INVENTORY_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_PET_INVENTORY_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_pet_inventory"); return std::string("character_pet_inventory");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static CharacterPetInventory FindOne( static CharacterPetInventory FindOne(
Database& db,
int character_pet_inventory_id int character_pet_inventory_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_pet_inventory_id int character_pet_inventory_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterPetInventory character_pet_inventory_entry CharacterPetInventory character_pet_inventory_entry
) )
{ {
@@ -152,7 +181,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(character_pet_inventory_entry.slot)); update_values.push_back(columns[2] + " = " + std::to_string(character_pet_inventory_entry.slot));
update_values.push_back(columns[3] + " = " + std::to_string(character_pet_inventory_entry.item_id)); update_values.push_back(columns[3] + " = " + std::to_string(character_pet_inventory_entry.item_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -166,7 +195,6 @@ public:
} }
static CharacterPetInventory InsertOne( static CharacterPetInventory InsertOne(
Database& db,
CharacterPetInventory character_pet_inventory_entry CharacterPetInventory character_pet_inventory_entry
) )
{ {
@@ -177,7 +205,7 @@ public:
insert_values.push_back(std::to_string(character_pet_inventory_entry.slot)); insert_values.push_back(std::to_string(character_pet_inventory_entry.slot));
insert_values.push_back(std::to_string(character_pet_inventory_entry.item_id)); insert_values.push_back(std::to_string(character_pet_inventory_entry.item_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -196,7 +224,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterPetInventory> character_pet_inventory_entries std::vector<CharacterPetInventory> character_pet_inventory_entries
) )
{ {
@@ -215,7 +242,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -226,11 +253,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterPetInventory> All(Database& db) static std::vector<CharacterPetInventory> All()
{ {
std::vector<CharacterPetInventory> all_entries; std::vector<CharacterPetInventory> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -253,11 +280,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterPetInventory> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterPetInventory> GetWhere(std::string where_filter)
{ {
std::vector<CharacterPetInventory> all_entries; std::vector<CharacterPetInventory> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -281,9 +308,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -294,9 +321,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_POTIONBELT_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_POTIONBELT_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_potionbelt"); return std::string("character_potionbelt");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static CharacterPotionbelt FindOne( static CharacterPotionbelt FindOne(
Database& db,
int character_potionbelt_id int character_potionbelt_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_potionbelt_id int character_potionbelt_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterPotionbelt character_potionbelt_entry CharacterPotionbelt character_potionbelt_entry
) )
{ {
@@ -152,7 +181,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(character_potionbelt_entry.item_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_potionbelt_entry.item_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_potionbelt_entry.icon)); update_values.push_back(columns[3] + " = " + std::to_string(character_potionbelt_entry.icon));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -166,7 +195,6 @@ public:
} }
static CharacterPotionbelt InsertOne( static CharacterPotionbelt InsertOne(
Database& db,
CharacterPotionbelt character_potionbelt_entry CharacterPotionbelt character_potionbelt_entry
) )
{ {
@@ -177,7 +205,7 @@ public:
insert_values.push_back(std::to_string(character_potionbelt_entry.item_id)); insert_values.push_back(std::to_string(character_potionbelt_entry.item_id));
insert_values.push_back(std::to_string(character_potionbelt_entry.icon)); insert_values.push_back(std::to_string(character_potionbelt_entry.icon));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -196,7 +224,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterPotionbelt> character_potionbelt_entries std::vector<CharacterPotionbelt> character_potionbelt_entries
) )
{ {
@@ -215,7 +242,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -226,11 +253,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterPotionbelt> All(Database& db) static std::vector<CharacterPotionbelt> All()
{ {
std::vector<CharacterPotionbelt> all_entries; std::vector<CharacterPotionbelt> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -253,11 +280,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterPotionbelt> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterPotionbelt> GetWhere(std::string where_filter)
{ {
std::vector<CharacterPotionbelt> all_entries; std::vector<CharacterPotionbelt> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -281,9 +308,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -294,9 +321,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_SKILLS_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_SKILLS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_skills"); return std::string("character_skills");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharacterSkills FindOne( static CharacterSkills FindOne(
Database& db,
int character_skills_id int character_skills_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_skills_id int character_skills_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterSkills character_skills_entry CharacterSkills character_skills_entry
) )
{ {
@@ -146,7 +175,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_skills_entry.skill_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_skills_entry.skill_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_skills_entry.value)); update_values.push_back(columns[2] + " = " + std::to_string(character_skills_entry.value));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -160,17 +189,15 @@ public:
} }
static CharacterSkills InsertOne( static CharacterSkills InsertOne(
Database& db,
CharacterSkills character_skills_entry CharacterSkills character_skills_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_skills_entry.id));
insert_values.push_back(std::to_string(character_skills_entry.skill_id)); insert_values.push_back(std::to_string(character_skills_entry.skill_id));
insert_values.push_back(std::to_string(character_skills_entry.value)); insert_values.push_back(std::to_string(character_skills_entry.value));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -189,7 +216,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterSkills> character_skills_entries std::vector<CharacterSkills> character_skills_entries
) )
{ {
@@ -198,7 +224,6 @@ public:
for (auto &character_skills_entry: character_skills_entries) { for (auto &character_skills_entry: character_skills_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_skills_entry.id));
insert_values.push_back(std::to_string(character_skills_entry.skill_id)); insert_values.push_back(std::to_string(character_skills_entry.skill_id));
insert_values.push_back(std::to_string(character_skills_entry.value)); insert_values.push_back(std::to_string(character_skills_entry.value));
@@ -207,7 +232,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -218,11 +243,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterSkills> All(Database& db) static std::vector<CharacterSkills> All()
{ {
std::vector<CharacterSkills> all_entries; std::vector<CharacterSkills> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -244,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterSkills> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterSkills> GetWhere(std::string where_filter)
{ {
std::vector<CharacterSkills> all_entries; std::vector<CharacterSkills> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -271,9 +296,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -284,9 +309,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_SPELLS_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_SPELLS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_spells"); return std::string("character_spells");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static CharacterSpells FindOne( static CharacterSpells FindOne(
Database& db,
int character_spells_id int character_spells_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_spells_id int character_spells_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterSpells character_spells_entry CharacterSpells character_spells_entry
) )
{ {
@@ -146,7 +175,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_spells_entry.slot_id)); update_values.push_back(columns[1] + " = " + std::to_string(character_spells_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_spells_entry.spell_id)); update_values.push_back(columns[2] + " = " + std::to_string(character_spells_entry.spell_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -160,17 +189,15 @@ public:
} }
static CharacterSpells InsertOne( static CharacterSpells InsertOne(
Database& db,
CharacterSpells character_spells_entry CharacterSpells character_spells_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_spells_entry.id));
insert_values.push_back(std::to_string(character_spells_entry.slot_id)); insert_values.push_back(std::to_string(character_spells_entry.slot_id));
insert_values.push_back(std::to_string(character_spells_entry.spell_id)); insert_values.push_back(std::to_string(character_spells_entry.spell_id));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -189,7 +216,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterSpells> character_spells_entries std::vector<CharacterSpells> character_spells_entries
) )
{ {
@@ -198,7 +224,6 @@ public:
for (auto &character_spells_entry: character_spells_entries) { for (auto &character_spells_entry: character_spells_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_spells_entry.id));
insert_values.push_back(std::to_string(character_spells_entry.slot_id)); insert_values.push_back(std::to_string(character_spells_entry.slot_id));
insert_values.push_back(std::to_string(character_spells_entry.spell_id)); insert_values.push_back(std::to_string(character_spells_entry.spell_id));
@@ -207,7 +232,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -218,11 +243,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterSpells> All(Database& db) static std::vector<CharacterSpells> All()
{ {
std::vector<CharacterSpells> all_entries; std::vector<CharacterSpells> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -244,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterSpells> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterSpells> GetWhere(std::string where_filter)
{ {
std::vector<CharacterSpells> all_entries; std::vector<CharacterSpells> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -271,9 +296,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -284,9 +309,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CHARACTER_TASKS_REPOSITORY_H #ifndef EQEMU_BASE_CHARACTER_TASKS_REPOSITORY_H
@@ -46,6 +63,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("character_tasks"); return std::string("character_tasks");
@@ -65,7 +97,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -97,11 +129,10 @@ public:
} }
static CharacterTasks FindOne( static CharacterTasks FindOne(
Database& db,
int character_tasks_id int character_tasks_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -126,11 +157,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int character_tasks_id int character_tasks_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -143,7 +173,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CharacterTasks character_tasks_entry CharacterTasks character_tasks_entry
) )
{ {
@@ -157,7 +186,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(character_tasks_entry.type)); update_values.push_back(columns[3] + " = " + std::to_string(character_tasks_entry.type));
update_values.push_back(columns[4] + " = " + std::to_string(character_tasks_entry.acceptedtime)); update_values.push_back(columns[4] + " = " + std::to_string(character_tasks_entry.acceptedtime));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -171,7 +200,6 @@ public:
} }
static CharacterTasks InsertOne( static CharacterTasks InsertOne(
Database& db,
CharacterTasks character_tasks_entry CharacterTasks character_tasks_entry
) )
{ {
@@ -183,7 +211,7 @@ public:
insert_values.push_back(std::to_string(character_tasks_entry.type)); insert_values.push_back(std::to_string(character_tasks_entry.type));
insert_values.push_back(std::to_string(character_tasks_entry.acceptedtime)); insert_values.push_back(std::to_string(character_tasks_entry.acceptedtime));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -202,7 +230,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CharacterTasks> character_tasks_entries std::vector<CharacterTasks> character_tasks_entries
) )
{ {
@@ -222,7 +249,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -233,11 +260,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CharacterTasks> All(Database& db) static std::vector<CharacterTasks> All()
{ {
std::vector<CharacterTasks> all_entries; std::vector<CharacterTasks> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -261,11 +288,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CharacterTasks> GetWhere(Database& db, std::string where_filter) static std::vector<CharacterTasks> GetWhere(std::string where_filter)
{ {
std::vector<CharacterTasks> all_entries; std::vector<CharacterTasks> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -290,9 +317,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -303,9 +330,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_COMPLETED_TASKS_REPOSITORY_H #ifndef EQEMU_BASE_COMPLETED_TASKS_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("completed_tasks"); return std::string("completed_tasks");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static CompletedTasks FindOne( static CompletedTasks FindOne(
Database& db,
int completed_tasks_id int completed_tasks_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int completed_tasks_id int completed_tasks_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
CompletedTasks completed_tasks_entry CompletedTasks completed_tasks_entry
) )
{ {
@@ -152,7 +181,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(completed_tasks_entry.taskid)); update_values.push_back(columns[2] + " = " + std::to_string(completed_tasks_entry.taskid));
update_values.push_back(columns[3] + " = " + std::to_string(completed_tasks_entry.activityid)); update_values.push_back(columns[3] + " = " + std::to_string(completed_tasks_entry.activityid));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -166,7 +195,6 @@ public:
} }
static CompletedTasks InsertOne( static CompletedTasks InsertOne(
Database& db,
CompletedTasks completed_tasks_entry CompletedTasks completed_tasks_entry
) )
{ {
@@ -177,7 +205,7 @@ public:
insert_values.push_back(std::to_string(completed_tasks_entry.taskid)); insert_values.push_back(std::to_string(completed_tasks_entry.taskid));
insert_values.push_back(std::to_string(completed_tasks_entry.activityid)); insert_values.push_back(std::to_string(completed_tasks_entry.activityid));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -196,7 +224,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<CompletedTasks> completed_tasks_entries std::vector<CompletedTasks> completed_tasks_entries
) )
{ {
@@ -215,7 +242,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -226,11 +253,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<CompletedTasks> All(Database& db) static std::vector<CompletedTasks> All()
{ {
std::vector<CompletedTasks> all_entries; std::vector<CompletedTasks> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -253,11 +280,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<CompletedTasks> GetWhere(Database& db, std::string where_filter) static std::vector<CompletedTasks> GetWhere(std::string where_filter)
{ {
std::vector<CompletedTasks> all_entries; std::vector<CompletedTasks> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -281,9 +308,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -294,9 +321,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_CONTENT_FLAGS_REPOSITORY_H #ifndef EQEMU_BASE_CONTENT_FLAGS_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("content_flags"); return std::string("content_flags");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static ContentFlags FindOne( static ContentFlags FindOne(
Database& db,
int content_flags_id int content_flags_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int content_flags_id int content_flags_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
ContentFlags content_flags_entry ContentFlags content_flags_entry
) )
{ {
@@ -151,7 +180,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(content_flags_entry.enabled)); update_values.push_back(columns[2] + " = " + std::to_string(content_flags_entry.enabled));
update_values.push_back(columns[3] + " = '" + EscapeString(content_flags_entry.notes) + "'"); update_values.push_back(columns[3] + " = '" + EscapeString(content_flags_entry.notes) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -165,18 +194,16 @@ public:
} }
static ContentFlags InsertOne( static ContentFlags InsertOne(
Database& db,
ContentFlags content_flags_entry ContentFlags content_flags_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(content_flags_entry.id));
insert_values.push_back("'" + EscapeString(content_flags_entry.flag_name) + "'"); insert_values.push_back("'" + EscapeString(content_flags_entry.flag_name) + "'");
insert_values.push_back(std::to_string(content_flags_entry.enabled)); insert_values.push_back(std::to_string(content_flags_entry.enabled));
insert_values.push_back("'" + EscapeString(content_flags_entry.notes) + "'"); insert_values.push_back("'" + EscapeString(content_flags_entry.notes) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -195,7 +222,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<ContentFlags> content_flags_entries std::vector<ContentFlags> content_flags_entries
) )
{ {
@@ -204,7 +230,6 @@ public:
for (auto &content_flags_entry: content_flags_entries) { for (auto &content_flags_entry: content_flags_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(content_flags_entry.id));
insert_values.push_back("'" + EscapeString(content_flags_entry.flag_name) + "'"); insert_values.push_back("'" + EscapeString(content_flags_entry.flag_name) + "'");
insert_values.push_back(std::to_string(content_flags_entry.enabled)); insert_values.push_back(std::to_string(content_flags_entry.enabled));
insert_values.push_back("'" + EscapeString(content_flags_entry.notes) + "'"); insert_values.push_back("'" + EscapeString(content_flags_entry.notes) + "'");
@@ -214,7 +239,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -225,11 +250,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<ContentFlags> All(Database& db) static std::vector<ContentFlags> All()
{ {
std::vector<ContentFlags> all_entries; std::vector<ContentFlags> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -252,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<ContentFlags> GetWhere(Database& db, std::string where_filter) static std::vector<ContentFlags> GetWhere(std::string where_filter)
{ {
std::vector<ContentFlags> all_entries; std::vector<ContentFlags> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -280,9 +305,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -293,9 +318,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,293 +0,0 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_DAMAGESHIELDTYPES_REPOSITORY_H
#define EQEMU_BASE_DAMAGESHIELDTYPES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseDamageshieldtypesRepository {
public:
struct Damageshieldtypes {
int spellid;
int type;
};
static std::string PrimaryKey()
{
return std::string("spellid");
}
static std::vector<std::string> Columns()
{
return {
"spellid",
"type",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("damageshieldtypes");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static Damageshieldtypes NewEntity()
{
Damageshieldtypes entry{};
entry.spellid = 0;
entry.type = 0;
return entry;
}
static Damageshieldtypes GetDamageshieldtypesEntry(
const std::vector<Damageshieldtypes> &damageshieldtypess,
int damageshieldtypes_id
)
{
for (auto &damageshieldtypes : damageshieldtypess) {
if (damageshieldtypes.spellid == damageshieldtypes_id) {
return damageshieldtypes;
}
}
return NewEntity();
}
static Damageshieldtypes FindOne(
Database& db,
int damageshieldtypes_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
damageshieldtypes_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Damageshieldtypes entry{};
entry.spellid = atoi(row[0]);
entry.type = atoi(row[1]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int damageshieldtypes_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
damageshieldtypes_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
Damageshieldtypes damageshieldtypes_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(damageshieldtypes_entry.spellid));
update_values.push_back(columns[1] + " = " + std::to_string(damageshieldtypes_entry.type));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
damageshieldtypes_entry.spellid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Damageshieldtypes InsertOne(
Database& db,
Damageshieldtypes damageshieldtypes_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(damageshieldtypes_entry.spellid));
insert_values.push_back(std::to_string(damageshieldtypes_entry.type));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
damageshieldtypes_entry.spellid = results.LastInsertedID();
return damageshieldtypes_entry;
}
damageshieldtypes_entry = NewEntity();
return damageshieldtypes_entry;
}
static int InsertMany(
Database& db,
std::vector<Damageshieldtypes> damageshieldtypes_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &damageshieldtypes_entry: damageshieldtypes_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(damageshieldtypes_entry.spellid));
insert_values.push_back(std::to_string(damageshieldtypes_entry.type));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Damageshieldtypes> All(Database& db)
{
std::vector<Damageshieldtypes> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Damageshieldtypes entry{};
entry.spellid = atoi(row[0]);
entry.type = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Damageshieldtypes> GetWhere(Database& db, std::string where_filter)
{
std::vector<Damageshieldtypes> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Damageshieldtypes entry{};
entry.spellid = atoi(row[0]);
entry.type = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_DAMAGESHIELDTYPES_REPOSITORY_H
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_DATA_BUCKETS_REPOSITORY_H #ifndef EQEMU_BASE_DATA_BUCKETS_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("data_buckets"); return std::string("data_buckets");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static DataBuckets FindOne( static DataBuckets FindOne(
Database& db,
int data_buckets_id int data_buckets_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int data_buckets_id int data_buckets_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
DataBuckets data_buckets_entry DataBuckets data_buckets_entry
) )
{ {
@@ -151,7 +180,7 @@ public:
update_values.push_back(columns[2] + " = '" + EscapeString(data_buckets_entry.value) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(data_buckets_entry.value) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(data_buckets_entry.expires)); update_values.push_back(columns[3] + " = " + std::to_string(data_buckets_entry.expires));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -165,18 +194,16 @@ public:
} }
static DataBuckets InsertOne( static DataBuckets InsertOne(
Database& db,
DataBuckets data_buckets_entry DataBuckets data_buckets_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(data_buckets_entry.id));
insert_values.push_back("'" + EscapeString(data_buckets_entry.key) + "'"); insert_values.push_back("'" + EscapeString(data_buckets_entry.key) + "'");
insert_values.push_back("'" + EscapeString(data_buckets_entry.value) + "'"); insert_values.push_back("'" + EscapeString(data_buckets_entry.value) + "'");
insert_values.push_back(std::to_string(data_buckets_entry.expires)); insert_values.push_back(std::to_string(data_buckets_entry.expires));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -195,7 +222,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<DataBuckets> data_buckets_entries std::vector<DataBuckets> data_buckets_entries
) )
{ {
@@ -204,7 +230,6 @@ public:
for (auto &data_buckets_entry: data_buckets_entries) { for (auto &data_buckets_entry: data_buckets_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(data_buckets_entry.id));
insert_values.push_back("'" + EscapeString(data_buckets_entry.key) + "'"); insert_values.push_back("'" + EscapeString(data_buckets_entry.key) + "'");
insert_values.push_back("'" + EscapeString(data_buckets_entry.value) + "'"); insert_values.push_back("'" + EscapeString(data_buckets_entry.value) + "'");
insert_values.push_back(std::to_string(data_buckets_entry.expires)); insert_values.push_back(std::to_string(data_buckets_entry.expires));
@@ -214,7 +239,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -225,11 +250,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<DataBuckets> All(Database& db) static std::vector<DataBuckets> All()
{ {
std::vector<DataBuckets> all_entries; std::vector<DataBuckets> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -252,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<DataBuckets> GetWhere(Database& db, std::string where_filter) static std::vector<DataBuckets> GetWhere(std::string where_filter)
{ {
std::vector<DataBuckets> all_entries; std::vector<DataBuckets> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -280,9 +305,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -293,9 +318,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_DB_STR_REPOSITORY_H #ifndef EQEMU_BASE_DB_STR_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("db_str"); return std::string("db_str");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static DbStr FindOne( static DbStr FindOne(
Database& db,
int db_str_id int db_str_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int db_str_id int db_str_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
DbStr db_str_entry DbStr db_str_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(db_str_entry.type)); update_values.push_back(columns[1] + " = " + std::to_string(db_str_entry.type));
update_values.push_back(columns[2] + " = '" + EscapeString(db_str_entry.value) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(db_str_entry.value) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static DbStr InsertOne( static DbStr InsertOne(
Database& db,
DbStr db_str_entry DbStr db_str_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(db_str_entry.type)); insert_values.push_back(std::to_string(db_str_entry.type));
insert_values.push_back("'" + EscapeString(db_str_entry.value) + "'"); insert_values.push_back("'" + EscapeString(db_str_entry.value) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<DbStr> db_str_entries std::vector<DbStr> db_str_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<DbStr> All(Database& db) static std::vector<DbStr> All()
{ {
std::vector<DbStr> all_entries; std::vector<DbStr> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<DbStr> GetWhere(Database& db, std::string where_filter) static std::vector<DbStr> GetWhere(std::string where_filter)
{ {
std::vector<DbStr> all_entries; std::vector<DbStr> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_DISCOVERED_ITEMS_REPOSITORY_H #ifndef EQEMU_BASE_DISCOVERED_ITEMS_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("discovered_items"); return std::string("discovered_items");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static DiscoveredItems FindOne( static DiscoveredItems FindOne(
Database& db,
int discovered_items_id int discovered_items_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int discovered_items_id int discovered_items_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
DiscoveredItems discovered_items_entry DiscoveredItems discovered_items_entry
) )
{ {
@@ -152,7 +181,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(discovered_items_entry.discovered_date)); update_values.push_back(columns[2] + " = " + std::to_string(discovered_items_entry.discovered_date));
update_values.push_back(columns[3] + " = " + std::to_string(discovered_items_entry.account_status)); update_values.push_back(columns[3] + " = " + std::to_string(discovered_items_entry.account_status));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -166,7 +195,6 @@ public:
} }
static DiscoveredItems InsertOne( static DiscoveredItems InsertOne(
Database& db,
DiscoveredItems discovered_items_entry DiscoveredItems discovered_items_entry
) )
{ {
@@ -177,7 +205,7 @@ public:
insert_values.push_back(std::to_string(discovered_items_entry.discovered_date)); insert_values.push_back(std::to_string(discovered_items_entry.discovered_date));
insert_values.push_back(std::to_string(discovered_items_entry.account_status)); insert_values.push_back(std::to_string(discovered_items_entry.account_status));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -196,7 +224,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<DiscoveredItems> discovered_items_entries std::vector<DiscoveredItems> discovered_items_entries
) )
{ {
@@ -215,7 +242,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -226,11 +253,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<DiscoveredItems> All(Database& db) static std::vector<DiscoveredItems> All()
{ {
std::vector<DiscoveredItems> all_entries; std::vector<DiscoveredItems> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -253,11 +280,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<DiscoveredItems> GetWhere(Database& db, std::string where_filter) static std::vector<DiscoveredItems> GetWhere(std::string where_filter)
{ {
std::vector<DiscoveredItems> all_entries; std::vector<DiscoveredItems> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -281,9 +308,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -294,9 +321,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_DOORS_REPOSITORY_H #ifndef EQEMU_BASE_DOORS_REPOSITORY_H
@@ -53,7 +70,6 @@ public:
int max_expansion; int max_expansion;
std::string content_flags; std::string content_flags;
std::string content_flags_disabled; std::string content_flags_disabled;
int is_instance_door;
}; };
static std::string PrimaryKey() static std::string PrimaryKey()
@@ -99,7 +115,6 @@ public:
"max_expansion", "max_expansion",
"content_flags", "content_flags",
"content_flags_disabled", "content_flags_disabled",
"is_instance_door",
}; };
} }
@@ -108,6 +123,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("doors"); return std::string("doors");
@@ -127,7 +157,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -170,7 +200,6 @@ public:
entry.max_expansion = 0; entry.max_expansion = 0;
entry.content_flags = ""; entry.content_flags = "";
entry.content_flags_disabled = ""; entry.content_flags_disabled = "";
entry.is_instance_door = 0;
return entry; return entry;
} }
@@ -190,11 +219,10 @@ public:
} }
static Doors FindOne( static Doors FindOne(
Database& db,
int doors_id int doors_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -241,7 +269,6 @@ public:
entry.max_expansion = atoi(row[32]); entry.max_expansion = atoi(row[32]);
entry.content_flags = row[33] ? row[33] : ""; entry.content_flags = row[33] ? row[33] : "";
entry.content_flags_disabled = row[34] ? row[34] : ""; entry.content_flags_disabled = row[34] ? row[34] : "";
entry.is_instance_door = atoi(row[35]);
return entry; return entry;
} }
@@ -250,11 +277,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int doors_id int doors_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -267,7 +293,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Doors doors_entry Doors doors_entry
) )
{ {
@@ -309,9 +334,8 @@ public:
update_values.push_back(columns[32] + " = " + std::to_string(doors_entry.max_expansion)); update_values.push_back(columns[32] + " = " + std::to_string(doors_entry.max_expansion));
update_values.push_back(columns[33] + " = '" + EscapeString(doors_entry.content_flags) + "'"); update_values.push_back(columns[33] + " = '" + EscapeString(doors_entry.content_flags) + "'");
update_values.push_back(columns[34] + " = '" + EscapeString(doors_entry.content_flags_disabled) + "'"); update_values.push_back(columns[34] + " = '" + EscapeString(doors_entry.content_flags_disabled) + "'");
update_values.push_back(columns[35] + " = " + std::to_string(doors_entry.is_instance_door));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -325,13 +349,11 @@ public:
} }
static Doors InsertOne( static Doors InsertOne(
Database& db,
Doors doors_entry Doors doors_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(doors_entry.id));
insert_values.push_back(std::to_string(doors_entry.doorid)); insert_values.push_back(std::to_string(doors_entry.doorid));
insert_values.push_back("'" + EscapeString(doors_entry.zone) + "'"); insert_values.push_back("'" + EscapeString(doors_entry.zone) + "'");
insert_values.push_back(std::to_string(doors_entry.version)); insert_values.push_back(std::to_string(doors_entry.version));
@@ -366,9 +388,8 @@ public:
insert_values.push_back(std::to_string(doors_entry.max_expansion)); insert_values.push_back(std::to_string(doors_entry.max_expansion));
insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'"); insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'"); insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'");
insert_values.push_back(std::to_string(doors_entry.is_instance_door));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -387,7 +408,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Doors> doors_entries std::vector<Doors> doors_entries
) )
{ {
@@ -396,7 +416,6 @@ public:
for (auto &doors_entry: doors_entries) { for (auto &doors_entry: doors_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(doors_entry.id));
insert_values.push_back(std::to_string(doors_entry.doorid)); insert_values.push_back(std::to_string(doors_entry.doorid));
insert_values.push_back("'" + EscapeString(doors_entry.zone) + "'"); insert_values.push_back("'" + EscapeString(doors_entry.zone) + "'");
insert_values.push_back(std::to_string(doors_entry.version)); insert_values.push_back(std::to_string(doors_entry.version));
@@ -431,14 +450,13 @@ public:
insert_values.push_back(std::to_string(doors_entry.max_expansion)); insert_values.push_back(std::to_string(doors_entry.max_expansion));
insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'"); insert_values.push_back("'" + EscapeString(doors_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'"); insert_values.push_back("'" + EscapeString(doors_entry.content_flags_disabled) + "'");
insert_values.push_back(std::to_string(doors_entry.is_instance_door));
insert_chunks.push_back("(" + implode(",", insert_values) + ")"); insert_chunks.push_back("(" + implode(",", insert_values) + ")");
} }
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -449,11 +467,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Doors> All(Database& db) static std::vector<Doors> All()
{ {
std::vector<Doors> all_entries; std::vector<Doors> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -500,7 +518,6 @@ public:
entry.max_expansion = atoi(row[32]); entry.max_expansion = atoi(row[32]);
entry.content_flags = row[33] ? row[33] : ""; entry.content_flags = row[33] ? row[33] : "";
entry.content_flags_disabled = row[34] ? row[34] : ""; entry.content_flags_disabled = row[34] ? row[34] : "";
entry.is_instance_door = atoi(row[35]);
all_entries.push_back(entry); all_entries.push_back(entry);
} }
@@ -508,11 +525,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Doors> GetWhere(Database& db, std::string where_filter) static std::vector<Doors> GetWhere(std::string where_filter)
{ {
std::vector<Doors> all_entries; std::vector<Doors> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -560,7 +577,6 @@ public:
entry.max_expansion = atoi(row[32]); entry.max_expansion = atoi(row[32]);
entry.content_flags = row[33] ? row[33] : ""; entry.content_flags = row[33] ? row[33] : "";
entry.content_flags_disabled = row[34] ? row[34] : ""; entry.content_flags_disabled = row[34] ? row[34] : "";
entry.is_instance_door = atoi(row[35]);
all_entries.push_back(entry); all_entries.push_back(entry);
} }
@@ -568,9 +584,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -581,9 +597,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,427 +0,0 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_DYNAMIC_ZONES_REPOSITORY_H
#define EQEMU_BASE_DYNAMIC_ZONES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseDynamicZonesRepository {
public:
struct DynamicZones {
int id;
int instance_id;
int type;
int compass_zone_id;
float compass_x;
float compass_y;
float compass_z;
int safe_return_zone_id;
float safe_return_x;
float safe_return_y;
float safe_return_z;
float safe_return_heading;
float zone_in_x;
float zone_in_y;
float zone_in_z;
float zone_in_heading;
int has_zone_in;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"instance_id",
"type",
"compass_zone_id",
"compass_x",
"compass_y",
"compass_z",
"safe_return_zone_id",
"safe_return_x",
"safe_return_y",
"safe_return_z",
"safe_return_heading",
"zone_in_x",
"zone_in_y",
"zone_in_z",
"zone_in_heading",
"has_zone_in",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("dynamic_zones");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static DynamicZones NewEntity()
{
DynamicZones entry{};
entry.id = 0;
entry.instance_id = 0;
entry.type = 0;
entry.compass_zone_id = 0;
entry.compass_x = 0;
entry.compass_y = 0;
entry.compass_z = 0;
entry.safe_return_zone_id = 0;
entry.safe_return_x = 0;
entry.safe_return_y = 0;
entry.safe_return_z = 0;
entry.safe_return_heading = 0;
entry.zone_in_x = 0;
entry.zone_in_y = 0;
entry.zone_in_z = 0;
entry.zone_in_heading = 0;
entry.has_zone_in = 0;
return entry;
}
static DynamicZones GetDynamicZonesEntry(
const std::vector<DynamicZones> &dynamic_zoness,
int dynamic_zones_id
)
{
for (auto &dynamic_zones : dynamic_zoness) {
if (dynamic_zones.id == dynamic_zones_id) {
return dynamic_zones;
}
}
return NewEntity();
}
static DynamicZones FindOne(
Database& db,
int dynamic_zones_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
dynamic_zones_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
DynamicZones entry{};
entry.id = atoi(row[0]);
entry.instance_id = atoi(row[1]);
entry.type = atoi(row[2]);
entry.compass_zone_id = atoi(row[3]);
entry.compass_x = static_cast<float>(atof(row[4]));
entry.compass_y = static_cast<float>(atof(row[5]));
entry.compass_z = static_cast<float>(atof(row[6]));
entry.safe_return_zone_id = atoi(row[7]);
entry.safe_return_x = static_cast<float>(atof(row[8]));
entry.safe_return_y = static_cast<float>(atof(row[9]));
entry.safe_return_z = static_cast<float>(atof(row[10]));
entry.safe_return_heading = static_cast<float>(atof(row[11]));
entry.zone_in_x = static_cast<float>(atof(row[12]));
entry.zone_in_y = static_cast<float>(atof(row[13]));
entry.zone_in_z = static_cast<float>(atof(row[14]));
entry.zone_in_heading = static_cast<float>(atof(row[15]));
entry.has_zone_in = atoi(row[16]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int dynamic_zones_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
dynamic_zones_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
DynamicZones dynamic_zones_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(dynamic_zones_entry.instance_id));
update_values.push_back(columns[2] + " = " + std::to_string(dynamic_zones_entry.type));
update_values.push_back(columns[3] + " = " + std::to_string(dynamic_zones_entry.compass_zone_id));
update_values.push_back(columns[4] + " = " + std::to_string(dynamic_zones_entry.compass_x));
update_values.push_back(columns[5] + " = " + std::to_string(dynamic_zones_entry.compass_y));
update_values.push_back(columns[6] + " = " + std::to_string(dynamic_zones_entry.compass_z));
update_values.push_back(columns[7] + " = " + std::to_string(dynamic_zones_entry.safe_return_zone_id));
update_values.push_back(columns[8] + " = " + std::to_string(dynamic_zones_entry.safe_return_x));
update_values.push_back(columns[9] + " = " + std::to_string(dynamic_zones_entry.safe_return_y));
update_values.push_back(columns[10] + " = " + std::to_string(dynamic_zones_entry.safe_return_z));
update_values.push_back(columns[11] + " = " + std::to_string(dynamic_zones_entry.safe_return_heading));
update_values.push_back(columns[12] + " = " + std::to_string(dynamic_zones_entry.zone_in_x));
update_values.push_back(columns[13] + " = " + std::to_string(dynamic_zones_entry.zone_in_y));
update_values.push_back(columns[14] + " = " + std::to_string(dynamic_zones_entry.zone_in_z));
update_values.push_back(columns[15] + " = " + std::to_string(dynamic_zones_entry.zone_in_heading));
update_values.push_back(columns[16] + " = " + std::to_string(dynamic_zones_entry.has_zone_in));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
dynamic_zones_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static DynamicZones InsertOne(
Database& db,
DynamicZones dynamic_zones_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(dynamic_zones_entry.id));
insert_values.push_back(std::to_string(dynamic_zones_entry.instance_id));
insert_values.push_back(std::to_string(dynamic_zones_entry.type));
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_zone_id));
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_x));
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_y));
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_z));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_zone_id));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_x));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_y));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_z));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_heading));
insert_values.push_back(std::to_string(dynamic_zones_entry.zone_in_x));
insert_values.push_back(std::to_string(dynamic_zones_entry.zone_in_y));
insert_values.push_back(std::to_string(dynamic_zones_entry.zone_in_z));
insert_values.push_back(std::to_string(dynamic_zones_entry.zone_in_heading));
insert_values.push_back(std::to_string(dynamic_zones_entry.has_zone_in));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
dynamic_zones_entry.id = results.LastInsertedID();
return dynamic_zones_entry;
}
dynamic_zones_entry = NewEntity();
return dynamic_zones_entry;
}
static int InsertMany(
Database& db,
std::vector<DynamicZones> dynamic_zones_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &dynamic_zones_entry: dynamic_zones_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(dynamic_zones_entry.id));
insert_values.push_back(std::to_string(dynamic_zones_entry.instance_id));
insert_values.push_back(std::to_string(dynamic_zones_entry.type));
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_zone_id));
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_x));
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_y));
insert_values.push_back(std::to_string(dynamic_zones_entry.compass_z));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_zone_id));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_x));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_y));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_z));
insert_values.push_back(std::to_string(dynamic_zones_entry.safe_return_heading));
insert_values.push_back(std::to_string(dynamic_zones_entry.zone_in_x));
insert_values.push_back(std::to_string(dynamic_zones_entry.zone_in_y));
insert_values.push_back(std::to_string(dynamic_zones_entry.zone_in_z));
insert_values.push_back(std::to_string(dynamic_zones_entry.zone_in_heading));
insert_values.push_back(std::to_string(dynamic_zones_entry.has_zone_in));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<DynamicZones> All(Database& db)
{
std::vector<DynamicZones> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
DynamicZones entry{};
entry.id = atoi(row[0]);
entry.instance_id = atoi(row[1]);
entry.type = atoi(row[2]);
entry.compass_zone_id = atoi(row[3]);
entry.compass_x = static_cast<float>(atof(row[4]));
entry.compass_y = static_cast<float>(atof(row[5]));
entry.compass_z = static_cast<float>(atof(row[6]));
entry.safe_return_zone_id = atoi(row[7]);
entry.safe_return_x = static_cast<float>(atof(row[8]));
entry.safe_return_y = static_cast<float>(atof(row[9]));
entry.safe_return_z = static_cast<float>(atof(row[10]));
entry.safe_return_heading = static_cast<float>(atof(row[11]));
entry.zone_in_x = static_cast<float>(atof(row[12]));
entry.zone_in_y = static_cast<float>(atof(row[13]));
entry.zone_in_z = static_cast<float>(atof(row[14]));
entry.zone_in_heading = static_cast<float>(atof(row[15]));
entry.has_zone_in = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<DynamicZones> GetWhere(Database& db, std::string where_filter)
{
std::vector<DynamicZones> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
DynamicZones entry{};
entry.id = atoi(row[0]);
entry.instance_id = atoi(row[1]);
entry.type = atoi(row[2]);
entry.compass_zone_id = atoi(row[3]);
entry.compass_x = static_cast<float>(atof(row[4]));
entry.compass_y = static_cast<float>(atof(row[5]));
entry.compass_z = static_cast<float>(atof(row[6]));
entry.safe_return_zone_id = atoi(row[7]);
entry.safe_return_x = static_cast<float>(atof(row[8]));
entry.safe_return_y = static_cast<float>(atof(row[9]));
entry.safe_return_z = static_cast<float>(atof(row[10]));
entry.safe_return_heading = static_cast<float>(atof(row[11]));
entry.zone_in_x = static_cast<float>(atof(row[12]));
entry.zone_in_y = static_cast<float>(atof(row[13]));
entry.zone_in_z = static_cast<float>(atof(row[14]));
entry.zone_in_heading = static_cast<float>(atof(row[15]));
entry.has_zone_in = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_DYNAMIC_ZONES_REPOSITORY_H
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_EVENTLOG_REPOSITORY_H #ifndef EQEMU_BASE_EVENTLOG_REPOSITORY_H
@@ -56,6 +73,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("eventlog"); return std::string("eventlog");
@@ -75,7 +107,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -112,11 +144,10 @@ public:
} }
static Eventlog FindOne( static Eventlog FindOne(
Database& db,
int eventlog_id int eventlog_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -146,11 +177,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int eventlog_id int eventlog_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -163,7 +193,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Eventlog eventlog_entry Eventlog eventlog_entry
) )
{ {
@@ -181,7 +210,7 @@ public:
update_values.push_back(columns[8] + " = '" + EscapeString(eventlog_entry.description) + "'"); update_values.push_back(columns[8] + " = '" + EscapeString(eventlog_entry.description) + "'");
update_values.push_back(columns[9] + " = " + std::to_string(eventlog_entry.event_nid)); update_values.push_back(columns[9] + " = " + std::to_string(eventlog_entry.event_nid));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -195,13 +224,11 @@ public:
} }
static Eventlog InsertOne( static Eventlog InsertOne(
Database& db,
Eventlog eventlog_entry Eventlog eventlog_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(eventlog_entry.id));
insert_values.push_back("'" + EscapeString(eventlog_entry.accountname) + "'"); insert_values.push_back("'" + EscapeString(eventlog_entry.accountname) + "'");
insert_values.push_back(std::to_string(eventlog_entry.accountid)); insert_values.push_back(std::to_string(eventlog_entry.accountid));
insert_values.push_back(std::to_string(eventlog_entry.status)); insert_values.push_back(std::to_string(eventlog_entry.status));
@@ -212,7 +239,7 @@ public:
insert_values.push_back("'" + EscapeString(eventlog_entry.description) + "'"); insert_values.push_back("'" + EscapeString(eventlog_entry.description) + "'");
insert_values.push_back(std::to_string(eventlog_entry.event_nid)); insert_values.push_back(std::to_string(eventlog_entry.event_nid));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -231,7 +258,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Eventlog> eventlog_entries std::vector<Eventlog> eventlog_entries
) )
{ {
@@ -240,7 +266,6 @@ public:
for (auto &eventlog_entry: eventlog_entries) { for (auto &eventlog_entry: eventlog_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(eventlog_entry.id));
insert_values.push_back("'" + EscapeString(eventlog_entry.accountname) + "'"); insert_values.push_back("'" + EscapeString(eventlog_entry.accountname) + "'");
insert_values.push_back(std::to_string(eventlog_entry.accountid)); insert_values.push_back(std::to_string(eventlog_entry.accountid));
insert_values.push_back(std::to_string(eventlog_entry.status)); insert_values.push_back(std::to_string(eventlog_entry.status));
@@ -256,7 +281,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -267,11 +292,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Eventlog> All(Database& db) static std::vector<Eventlog> All()
{ {
std::vector<Eventlog> all_entries; std::vector<Eventlog> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -300,11 +325,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Eventlog> GetWhere(Database& db, std::string where_filter) static std::vector<Eventlog> GetWhere(std::string where_filter)
{ {
std::vector<Eventlog> all_entries; std::vector<Eventlog> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -334,9 +359,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -347,9 +372,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,328 +0,0 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
#define EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseExpeditionLockoutsRepository {
public:
struct ExpeditionLockouts {
int id;
int expedition_id;
std::string event_name;
std::string expire_time;
int duration;
std::string from_expedition_uuid;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"expedition_id",
"event_name",
"expire_time",
"duration",
"from_expedition_uuid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("expedition_lockouts");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static ExpeditionLockouts NewEntity()
{
ExpeditionLockouts entry{};
entry.id = 0;
entry.expedition_id = 0;
entry.event_name = "";
entry.expire_time = current_timestamp();
entry.duration = 0;
entry.from_expedition_uuid = "";
return entry;
}
static ExpeditionLockouts GetExpeditionLockoutsEntry(
const std::vector<ExpeditionLockouts> &expedition_lockoutss,
int expedition_lockouts_id
)
{
for (auto &expedition_lockouts : expedition_lockoutss) {
if (expedition_lockouts.id == expedition_lockouts_id) {
return expedition_lockouts;
}
}
return NewEntity();
}
static ExpeditionLockouts FindOne(
Database& db,
int expedition_lockouts_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
expedition_lockouts_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
ExpeditionLockouts entry{};
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.event_name = row[2] ? row[2] : "";
entry.expire_time = row[3] ? row[3] : "";
entry.duration = atoi(row[4]);
entry.from_expedition_uuid = row[5] ? row[5] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int expedition_lockouts_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
expedition_lockouts_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
ExpeditionLockouts expedition_lockouts_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(expedition_lockouts_entry.expedition_id));
update_values.push_back(columns[2] + " = '" + EscapeString(expedition_lockouts_entry.event_name) + "'");
update_values.push_back(columns[3] + " = '" + EscapeString(expedition_lockouts_entry.expire_time) + "'");
update_values.push_back(columns[4] + " = " + std::to_string(expedition_lockouts_entry.duration));
update_values.push_back(columns[5] + " = '" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
expedition_lockouts_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static ExpeditionLockouts InsertOne(
Database& db,
ExpeditionLockouts expedition_lockouts_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(expedition_lockouts_entry.id));
insert_values.push_back(std::to_string(expedition_lockouts_entry.expedition_id));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back(std::to_string(expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
expedition_lockouts_entry.id = results.LastInsertedID();
return expedition_lockouts_entry;
}
expedition_lockouts_entry = NewEntity();
return expedition_lockouts_entry;
}
static int InsertMany(
Database& db,
std::vector<ExpeditionLockouts> expedition_lockouts_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &expedition_lockouts_entry: expedition_lockouts_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(expedition_lockouts_entry.id));
insert_values.push_back(std::to_string(expedition_lockouts_entry.expedition_id));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back(std::to_string(expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<ExpeditionLockouts> All(Database& db)
{
std::vector<ExpeditionLockouts> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
ExpeditionLockouts entry{};
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.event_name = row[2] ? row[2] : "";
entry.expire_time = row[3] ? row[3] : "";
entry.duration = atoi(row[4]);
entry.from_expedition_uuid = row[5] ? row[5] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<ExpeditionLockouts> GetWhere(Database& db, std::string where_filter)
{
std::vector<ExpeditionLockouts> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
ExpeditionLockouts entry{};
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.event_name = row[2] ? row[2] : "";
entry.expire_time = row[3] ? row[3] : "";
entry.duration = atoi(row[4]);
entry.from_expedition_uuid = row[5] ? row[5] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_EXPEDITION_LOCKOUTS_REPOSITORY_H
@@ -1,310 +0,0 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_EXPEDITION_MEMBERS_REPOSITORY_H
#define EQEMU_BASE_EXPEDITION_MEMBERS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseExpeditionMembersRepository {
public:
struct ExpeditionMembers {
int id;
int expedition_id;
int character_id;
int is_current_member;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"expedition_id",
"character_id",
"is_current_member",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("expedition_members");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static ExpeditionMembers NewEntity()
{
ExpeditionMembers entry{};
entry.id = 0;
entry.expedition_id = 0;
entry.character_id = 0;
entry.is_current_member = 1;
return entry;
}
static ExpeditionMembers GetExpeditionMembersEntry(
const std::vector<ExpeditionMembers> &expedition_memberss,
int expedition_members_id
)
{
for (auto &expedition_members : expedition_memberss) {
if (expedition_members.id == expedition_members_id) {
return expedition_members;
}
}
return NewEntity();
}
static ExpeditionMembers FindOne(
Database& db,
int expedition_members_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
expedition_members_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
ExpeditionMembers entry{};
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.character_id = atoi(row[2]);
entry.is_current_member = atoi(row[3]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int expedition_members_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
expedition_members_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
ExpeditionMembers expedition_members_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(expedition_members_entry.expedition_id));
update_values.push_back(columns[2] + " = " + std::to_string(expedition_members_entry.character_id));
update_values.push_back(columns[3] + " = " + std::to_string(expedition_members_entry.is_current_member));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
expedition_members_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static ExpeditionMembers InsertOne(
Database& db,
ExpeditionMembers expedition_members_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(expedition_members_entry.id));
insert_values.push_back(std::to_string(expedition_members_entry.expedition_id));
insert_values.push_back(std::to_string(expedition_members_entry.character_id));
insert_values.push_back(std::to_string(expedition_members_entry.is_current_member));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
expedition_members_entry.id = results.LastInsertedID();
return expedition_members_entry;
}
expedition_members_entry = NewEntity();
return expedition_members_entry;
}
static int InsertMany(
Database& db,
std::vector<ExpeditionMembers> expedition_members_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &expedition_members_entry: expedition_members_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(expedition_members_entry.id));
insert_values.push_back(std::to_string(expedition_members_entry.expedition_id));
insert_values.push_back(std::to_string(expedition_members_entry.character_id));
insert_values.push_back(std::to_string(expedition_members_entry.is_current_member));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<ExpeditionMembers> All(Database& db)
{
std::vector<ExpeditionMembers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
ExpeditionMembers entry{};
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.character_id = atoi(row[2]);
entry.is_current_member = atoi(row[3]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<ExpeditionMembers> GetWhere(Database& db, std::string where_filter)
{
std::vector<ExpeditionMembers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
ExpeditionMembers entry{};
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.character_id = atoi(row[2]);
entry.is_current_member = atoi(row[3]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_EXPEDITION_MEMBERS_REPOSITORY_H
@@ -1,355 +0,0 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_EXPEDITIONS_REPOSITORY_H
#define EQEMU_BASE_EXPEDITIONS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseExpeditionsRepository {
public:
struct Expeditions {
int id;
std::string uuid;
int dynamic_zone_id;
std::string expedition_name;
int leader_id;
int min_players;
int max_players;
int add_replay_on_join;
int is_locked;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"uuid",
"dynamic_zone_id",
"expedition_name",
"leader_id",
"min_players",
"max_players",
"add_replay_on_join",
"is_locked",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("expeditions");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static Expeditions NewEntity()
{
Expeditions entry{};
entry.id = 0;
entry.uuid = "";
entry.dynamic_zone_id = 0;
entry.expedition_name = "";
entry.leader_id = 0;
entry.min_players = 0;
entry.max_players = 0;
entry.add_replay_on_join = 1;
entry.is_locked = 0;
return entry;
}
static Expeditions GetExpeditionsEntry(
const std::vector<Expeditions> &expeditionss,
int expeditions_id
)
{
for (auto &expeditions : expeditionss) {
if (expeditions.id == expeditions_id) {
return expeditions;
}
}
return NewEntity();
}
static Expeditions FindOne(
Database& db,
int expeditions_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
expeditions_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Expeditions entry{};
entry.id = atoi(row[0]);
entry.uuid = row[1] ? row[1] : "";
entry.dynamic_zone_id = atoi(row[2]);
entry.expedition_name = row[3] ? row[3] : "";
entry.leader_id = atoi(row[4]);
entry.min_players = atoi(row[5]);
entry.max_players = atoi(row[6]);
entry.add_replay_on_join = atoi(row[7]);
entry.is_locked = atoi(row[8]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int expeditions_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
expeditions_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
Expeditions expeditions_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(expeditions_entry.uuid) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(expeditions_entry.dynamic_zone_id));
update_values.push_back(columns[3] + " = '" + EscapeString(expeditions_entry.expedition_name) + "'");
update_values.push_back(columns[4] + " = " + std::to_string(expeditions_entry.leader_id));
update_values.push_back(columns[5] + " = " + std::to_string(expeditions_entry.min_players));
update_values.push_back(columns[6] + " = " + std::to_string(expeditions_entry.max_players));
update_values.push_back(columns[7] + " = " + std::to_string(expeditions_entry.add_replay_on_join));
update_values.push_back(columns[8] + " = " + std::to_string(expeditions_entry.is_locked));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
expeditions_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Expeditions InsertOne(
Database& db,
Expeditions expeditions_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(expeditions_entry.id));
insert_values.push_back("'" + EscapeString(expeditions_entry.uuid) + "'");
insert_values.push_back(std::to_string(expeditions_entry.dynamic_zone_id));
insert_values.push_back("'" + EscapeString(expeditions_entry.expedition_name) + "'");
insert_values.push_back(std::to_string(expeditions_entry.leader_id));
insert_values.push_back(std::to_string(expeditions_entry.min_players));
insert_values.push_back(std::to_string(expeditions_entry.max_players));
insert_values.push_back(std::to_string(expeditions_entry.add_replay_on_join));
insert_values.push_back(std::to_string(expeditions_entry.is_locked));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
expeditions_entry.id = results.LastInsertedID();
return expeditions_entry;
}
expeditions_entry = NewEntity();
return expeditions_entry;
}
static int InsertMany(
Database& db,
std::vector<Expeditions> expeditions_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &expeditions_entry: expeditions_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(expeditions_entry.id));
insert_values.push_back("'" + EscapeString(expeditions_entry.uuid) + "'");
insert_values.push_back(std::to_string(expeditions_entry.dynamic_zone_id));
insert_values.push_back("'" + EscapeString(expeditions_entry.expedition_name) + "'");
insert_values.push_back(std::to_string(expeditions_entry.leader_id));
insert_values.push_back(std::to_string(expeditions_entry.min_players));
insert_values.push_back(std::to_string(expeditions_entry.max_players));
insert_values.push_back(std::to_string(expeditions_entry.add_replay_on_join));
insert_values.push_back(std::to_string(expeditions_entry.is_locked));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Expeditions> All(Database& db)
{
std::vector<Expeditions> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Expeditions entry{};
entry.id = atoi(row[0]);
entry.uuid = row[1] ? row[1] : "";
entry.dynamic_zone_id = atoi(row[2]);
entry.expedition_name = row[3] ? row[3] : "";
entry.leader_id = atoi(row[4]);
entry.min_players = atoi(row[5]);
entry.max_players = atoi(row[6]);
entry.add_replay_on_join = atoi(row[7]);
entry.is_locked = atoi(row[8]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Expeditions> GetWhere(Database& db, std::string where_filter)
{
std::vector<Expeditions> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Expeditions entry{};
entry.id = atoi(row[0]);
entry.uuid = row[1] ? row[1] : "";
entry.dynamic_zone_id = atoi(row[2]);
entry.expedition_name = row[3] ? row[3] : "";
entry.leader_id = atoi(row[4]);
entry.min_players = atoi(row[5]);
entry.max_players = atoi(row[6]);
entry.add_replay_on_join = atoi(row[7]);
entry.is_locked = atoi(row[8]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_EXPEDITIONS_REPOSITORY_H
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_FACTION_BASE_DATA_REPOSITORY_H #ifndef EQEMU_BASE_FACTION_BASE_DATA_REPOSITORY_H
@@ -48,6 +65,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("faction_base_data"); return std::string("faction_base_data");
@@ -67,7 +99,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -100,11 +132,10 @@ public:
} }
static FactionBaseData FindOne( static FactionBaseData FindOne(
Database& db,
int faction_base_data_id int faction_base_data_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -130,11 +161,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int faction_base_data_id int faction_base_data_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -147,7 +177,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
FactionBaseData faction_base_data_entry FactionBaseData faction_base_data_entry
) )
{ {
@@ -162,7 +191,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(faction_base_data_entry.unk_hero2)); update_values.push_back(columns[4] + " = " + std::to_string(faction_base_data_entry.unk_hero2));
update_values.push_back(columns[5] + " = " + std::to_string(faction_base_data_entry.unk_hero3)); update_values.push_back(columns[5] + " = " + std::to_string(faction_base_data_entry.unk_hero3));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -176,7 +205,6 @@ public:
} }
static FactionBaseData InsertOne( static FactionBaseData InsertOne(
Database& db,
FactionBaseData faction_base_data_entry FactionBaseData faction_base_data_entry
) )
{ {
@@ -189,7 +217,7 @@ public:
insert_values.push_back(std::to_string(faction_base_data_entry.unk_hero2)); insert_values.push_back(std::to_string(faction_base_data_entry.unk_hero2));
insert_values.push_back(std::to_string(faction_base_data_entry.unk_hero3)); insert_values.push_back(std::to_string(faction_base_data_entry.unk_hero3));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -208,7 +236,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<FactionBaseData> faction_base_data_entries std::vector<FactionBaseData> faction_base_data_entries
) )
{ {
@@ -229,7 +256,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -240,11 +267,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<FactionBaseData> All(Database& db) static std::vector<FactionBaseData> All()
{ {
std::vector<FactionBaseData> all_entries; std::vector<FactionBaseData> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -269,11 +296,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<FactionBaseData> GetWhere(Database& db, std::string where_filter) static std::vector<FactionBaseData> GetWhere(std::string where_filter)
{ {
std::vector<FactionBaseData> all_entries; std::vector<FactionBaseData> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -299,9 +326,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -312,9 +339,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_FACTION_LIST_MOD_REPOSITORY_H #ifndef EQEMU_BASE_FACTION_LIST_MOD_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("faction_list_mod"); return std::string("faction_list_mod");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static FactionListMod FindOne( static FactionListMod FindOne(
Database& db,
int faction_list_mod_id int faction_list_mod_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int faction_list_mod_id int faction_list_mod_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
FactionListMod faction_list_mod_entry FactionListMod faction_list_mod_entry
) )
{ {
@@ -151,7 +180,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(faction_list_mod_entry.mod)); update_values.push_back(columns[2] + " = " + std::to_string(faction_list_mod_entry.mod));
update_values.push_back(columns[3] + " = '" + EscapeString(faction_list_mod_entry.mod_name) + "'"); update_values.push_back(columns[3] + " = '" + EscapeString(faction_list_mod_entry.mod_name) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -165,18 +194,16 @@ public:
} }
static FactionListMod InsertOne( static FactionListMod InsertOne(
Database& db,
FactionListMod faction_list_mod_entry FactionListMod faction_list_mod_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(faction_list_mod_entry.id));
insert_values.push_back(std::to_string(faction_list_mod_entry.faction_id)); insert_values.push_back(std::to_string(faction_list_mod_entry.faction_id));
insert_values.push_back(std::to_string(faction_list_mod_entry.mod)); insert_values.push_back(std::to_string(faction_list_mod_entry.mod));
insert_values.push_back("'" + EscapeString(faction_list_mod_entry.mod_name) + "'"); insert_values.push_back("'" + EscapeString(faction_list_mod_entry.mod_name) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -195,7 +222,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<FactionListMod> faction_list_mod_entries std::vector<FactionListMod> faction_list_mod_entries
) )
{ {
@@ -204,7 +230,6 @@ public:
for (auto &faction_list_mod_entry: faction_list_mod_entries) { for (auto &faction_list_mod_entry: faction_list_mod_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(faction_list_mod_entry.id));
insert_values.push_back(std::to_string(faction_list_mod_entry.faction_id)); insert_values.push_back(std::to_string(faction_list_mod_entry.faction_id));
insert_values.push_back(std::to_string(faction_list_mod_entry.mod)); insert_values.push_back(std::to_string(faction_list_mod_entry.mod));
insert_values.push_back("'" + EscapeString(faction_list_mod_entry.mod_name) + "'"); insert_values.push_back("'" + EscapeString(faction_list_mod_entry.mod_name) + "'");
@@ -214,7 +239,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -225,11 +250,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<FactionListMod> All(Database& db) static std::vector<FactionListMod> All()
{ {
std::vector<FactionListMod> all_entries; std::vector<FactionListMod> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -252,11 +277,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<FactionListMod> GetWhere(Database& db, std::string where_filter) static std::vector<FactionListMod> GetWhere(std::string where_filter)
{ {
std::vector<FactionListMod> all_entries; std::vector<FactionListMod> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -280,9 +305,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -293,9 +318,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_FACTION_LIST_REPOSITORY_H #ifndef EQEMU_BASE_FACTION_LIST_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("faction_list"); return std::string("faction_list");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static FactionList FindOne( static FactionList FindOne(
Database& db,
int faction_list_id int faction_list_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int faction_list_id int faction_list_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
FactionList faction_list_entry FactionList faction_list_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = '" + EscapeString(faction_list_entry.name) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(faction_list_entry.name) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(faction_list_entry.base)); update_values.push_back(columns[2] + " = " + std::to_string(faction_list_entry.base));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static FactionList InsertOne( static FactionList InsertOne(
Database& db,
FactionList faction_list_entry FactionList faction_list_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back("'" + EscapeString(faction_list_entry.name) + "'"); insert_values.push_back("'" + EscapeString(faction_list_entry.name) + "'");
insert_values.push_back(std::to_string(faction_list_entry.base)); insert_values.push_back(std::to_string(faction_list_entry.base));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<FactionList> faction_list_entries std::vector<FactionList> faction_list_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<FactionList> All(Database& db) static std::vector<FactionList> All()
{ {
std::vector<FactionList> all_entries; std::vector<FactionList> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<FactionList> GetWhere(Database& db, std::string where_filter) static std::vector<FactionList> GetWhere(std::string where_filter)
{ {
std::vector<FactionList> all_entries; std::vector<FactionList> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_FACTION_VALUES_REPOSITORY_H #ifndef EQEMU_BASE_FACTION_VALUES_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("faction_values"); return std::string("faction_values");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static FactionValues FindOne( static FactionValues FindOne(
Database& db,
int faction_values_id int faction_values_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int faction_values_id int faction_values_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
FactionValues faction_values_entry FactionValues faction_values_entry
) )
{ {
@@ -152,7 +181,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(faction_values_entry.current_value)); update_values.push_back(columns[2] + " = " + std::to_string(faction_values_entry.current_value));
update_values.push_back(columns[3] + " = " + std::to_string(faction_values_entry.temp)); update_values.push_back(columns[3] + " = " + std::to_string(faction_values_entry.temp));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -166,7 +195,6 @@ public:
} }
static FactionValues InsertOne( static FactionValues InsertOne(
Database& db,
FactionValues faction_values_entry FactionValues faction_values_entry
) )
{ {
@@ -177,7 +205,7 @@ public:
insert_values.push_back(std::to_string(faction_values_entry.current_value)); insert_values.push_back(std::to_string(faction_values_entry.current_value));
insert_values.push_back(std::to_string(faction_values_entry.temp)); insert_values.push_back(std::to_string(faction_values_entry.temp));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -196,7 +224,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<FactionValues> faction_values_entries std::vector<FactionValues> faction_values_entries
) )
{ {
@@ -215,7 +242,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -226,11 +253,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<FactionValues> All(Database& db) static std::vector<FactionValues> All()
{ {
std::vector<FactionValues> all_entries; std::vector<FactionValues> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -253,11 +280,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<FactionValues> GetWhere(Database& db, std::string where_filter) static std::vector<FactionValues> GetWhere(std::string where_filter)
{ {
std::vector<FactionValues> all_entries; std::vector<FactionValues> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -281,9 +308,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -294,9 +321,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_FISHING_REPOSITORY_H #ifndef EQEMU_BASE_FISHING_REPOSITORY_H
@@ -58,6 +75,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("fishing"); return std::string("fishing");
@@ -77,7 +109,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -115,11 +147,10 @@ public:
} }
static Fishing FindOne( static Fishing FindOne(
Database& db,
int fishing_id int fishing_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -150,11 +181,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int fishing_id int fishing_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -167,7 +197,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Fishing fishing_entry Fishing fishing_entry
) )
{ {
@@ -186,7 +215,7 @@ public:
update_values.push_back(columns[9] + " = '" + EscapeString(fishing_entry.content_flags) + "'"); update_values.push_back(columns[9] + " = '" + EscapeString(fishing_entry.content_flags) + "'");
update_values.push_back(columns[10] + " = '" + EscapeString(fishing_entry.content_flags_disabled) + "'"); update_values.push_back(columns[10] + " = '" + EscapeString(fishing_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -200,13 +229,11 @@ public:
} }
static Fishing InsertOne( static Fishing InsertOne(
Database& db,
Fishing fishing_entry Fishing fishing_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(fishing_entry.id));
insert_values.push_back(std::to_string(fishing_entry.zoneid)); insert_values.push_back(std::to_string(fishing_entry.zoneid));
insert_values.push_back(std::to_string(fishing_entry.Itemid)); insert_values.push_back(std::to_string(fishing_entry.Itemid));
insert_values.push_back(std::to_string(fishing_entry.skill_level)); insert_values.push_back(std::to_string(fishing_entry.skill_level));
@@ -218,7 +245,7 @@ public:
insert_values.push_back("'" + EscapeString(fishing_entry.content_flags) + "'"); insert_values.push_back("'" + EscapeString(fishing_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(fishing_entry.content_flags_disabled) + "'"); insert_values.push_back("'" + EscapeString(fishing_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -237,7 +264,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Fishing> fishing_entries std::vector<Fishing> fishing_entries
) )
{ {
@@ -246,7 +272,6 @@ public:
for (auto &fishing_entry: fishing_entries) { for (auto &fishing_entry: fishing_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(fishing_entry.id));
insert_values.push_back(std::to_string(fishing_entry.zoneid)); insert_values.push_back(std::to_string(fishing_entry.zoneid));
insert_values.push_back(std::to_string(fishing_entry.Itemid)); insert_values.push_back(std::to_string(fishing_entry.Itemid));
insert_values.push_back(std::to_string(fishing_entry.skill_level)); insert_values.push_back(std::to_string(fishing_entry.skill_level));
@@ -263,7 +288,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -274,11 +299,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Fishing> All(Database& db) static std::vector<Fishing> All()
{ {
std::vector<Fishing> all_entries; std::vector<Fishing> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -308,11 +333,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Fishing> GetWhere(Database& db, std::string where_filter) static std::vector<Fishing> GetWhere(std::string where_filter)
{ {
std::vector<Fishing> all_entries; std::vector<Fishing> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -343,9 +368,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -356,9 +381,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_FORAGE_REPOSITORY_H #ifndef EQEMU_BASE_FORAGE_REPOSITORY_H
@@ -54,6 +71,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("forage"); return std::string("forage");
@@ -73,7 +105,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -109,11 +141,10 @@ public:
} }
static Forage FindOne( static Forage FindOne(
Database& db,
int forage_id int forage_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -142,11 +173,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int forage_id int forage_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -159,7 +189,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Forage forage_entry Forage forage_entry
) )
{ {
@@ -176,7 +205,7 @@ public:
update_values.push_back(columns[7] + " = '" + EscapeString(forage_entry.content_flags) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(forage_entry.content_flags) + "'");
update_values.push_back(columns[8] + " = '" + EscapeString(forage_entry.content_flags_disabled) + "'"); update_values.push_back(columns[8] + " = '" + EscapeString(forage_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -190,13 +219,11 @@ public:
} }
static Forage InsertOne( static Forage InsertOne(
Database& db,
Forage forage_entry Forage forage_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(forage_entry.id));
insert_values.push_back(std::to_string(forage_entry.zoneid)); insert_values.push_back(std::to_string(forage_entry.zoneid));
insert_values.push_back(std::to_string(forage_entry.Itemid)); insert_values.push_back(std::to_string(forage_entry.Itemid));
insert_values.push_back(std::to_string(forage_entry.level)); insert_values.push_back(std::to_string(forage_entry.level));
@@ -206,7 +233,7 @@ public:
insert_values.push_back("'" + EscapeString(forage_entry.content_flags) + "'"); insert_values.push_back("'" + EscapeString(forage_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(forage_entry.content_flags_disabled) + "'"); insert_values.push_back("'" + EscapeString(forage_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -225,7 +252,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Forage> forage_entries std::vector<Forage> forage_entries
) )
{ {
@@ -234,7 +260,6 @@ public:
for (auto &forage_entry: forage_entries) { for (auto &forage_entry: forage_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(forage_entry.id));
insert_values.push_back(std::to_string(forage_entry.zoneid)); insert_values.push_back(std::to_string(forage_entry.zoneid));
insert_values.push_back(std::to_string(forage_entry.Itemid)); insert_values.push_back(std::to_string(forage_entry.Itemid));
insert_values.push_back(std::to_string(forage_entry.level)); insert_values.push_back(std::to_string(forage_entry.level));
@@ -249,7 +274,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -260,11 +285,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Forage> All(Database& db) static std::vector<Forage> All()
{ {
std::vector<Forage> all_entries; std::vector<Forage> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -292,11 +317,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Forage> GetWhere(Database& db, std::string where_filter) static std::vector<Forage> GetWhere(std::string where_filter)
{ {
std::vector<Forage> all_entries; std::vector<Forage> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -325,9 +350,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -338,9 +363,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_FRIENDS_REPOSITORY_H #ifndef EQEMU_BASE_FRIENDS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("friends"); return std::string("friends");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static Friends FindOne( static Friends FindOne(
Database& db,
int friends_id int friends_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int friends_id int friends_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Friends friends_entry Friends friends_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(friends_entry.type)); update_values.push_back(columns[1] + " = " + std::to_string(friends_entry.type));
update_values.push_back(columns[2] + " = '" + EscapeString(friends_entry.name) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(friends_entry.name) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static Friends InsertOne( static Friends InsertOne(
Database& db,
Friends friends_entry Friends friends_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(friends_entry.type)); insert_values.push_back(std::to_string(friends_entry.type));
insert_values.push_back("'" + EscapeString(friends_entry.name) + "'"); insert_values.push_back("'" + EscapeString(friends_entry.name) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Friends> friends_entries std::vector<Friends> friends_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Friends> All(Database& db) static std::vector<Friends> All()
{ {
std::vector<Friends> all_entries; std::vector<Friends> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Friends> GetWhere(Database& db, std::string where_filter) static std::vector<Friends> GetWhere(std::string where_filter)
{ {
std::vector<Friends> all_entries; std::vector<Friends> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GLOBAL_LOOT_REPOSITORY_H #ifndef EQEMU_BASE_GLOBAL_LOOT_REPOSITORY_H
@@ -70,6 +87,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("global_loot"); return std::string("global_loot");
@@ -89,7 +121,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -133,11 +165,10 @@ public:
} }
static GlobalLoot FindOne( static GlobalLoot FindOne(
Database& db,
int global_loot_id int global_loot_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -174,11 +205,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int global_loot_id int global_loot_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -191,7 +221,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GlobalLoot global_loot_entry GlobalLoot global_loot_entry
) )
{ {
@@ -216,7 +245,7 @@ public:
update_values.push_back(columns[15] + " = '" + EscapeString(global_loot_entry.content_flags) + "'"); update_values.push_back(columns[15] + " = '" + EscapeString(global_loot_entry.content_flags) + "'");
update_values.push_back(columns[16] + " = '" + EscapeString(global_loot_entry.content_flags_disabled) + "'"); update_values.push_back(columns[16] + " = '" + EscapeString(global_loot_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -230,13 +259,11 @@ public:
} }
static GlobalLoot InsertOne( static GlobalLoot InsertOne(
Database& db,
GlobalLoot global_loot_entry GlobalLoot global_loot_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(global_loot_entry.id));
insert_values.push_back("'" + EscapeString(global_loot_entry.description) + "'"); insert_values.push_back("'" + EscapeString(global_loot_entry.description) + "'");
insert_values.push_back(std::to_string(global_loot_entry.loottable_id)); insert_values.push_back(std::to_string(global_loot_entry.loottable_id));
insert_values.push_back(std::to_string(global_loot_entry.enabled)); insert_values.push_back(std::to_string(global_loot_entry.enabled));
@@ -254,7 +281,7 @@ public:
insert_values.push_back("'" + EscapeString(global_loot_entry.content_flags) + "'"); insert_values.push_back("'" + EscapeString(global_loot_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(global_loot_entry.content_flags_disabled) + "'"); insert_values.push_back("'" + EscapeString(global_loot_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -273,7 +300,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GlobalLoot> global_loot_entries std::vector<GlobalLoot> global_loot_entries
) )
{ {
@@ -282,7 +308,6 @@ public:
for (auto &global_loot_entry: global_loot_entries) { for (auto &global_loot_entry: global_loot_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(global_loot_entry.id));
insert_values.push_back("'" + EscapeString(global_loot_entry.description) + "'"); insert_values.push_back("'" + EscapeString(global_loot_entry.description) + "'");
insert_values.push_back(std::to_string(global_loot_entry.loottable_id)); insert_values.push_back(std::to_string(global_loot_entry.loottable_id));
insert_values.push_back(std::to_string(global_loot_entry.enabled)); insert_values.push_back(std::to_string(global_loot_entry.enabled));
@@ -305,7 +330,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -316,11 +341,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GlobalLoot> All(Database& db) static std::vector<GlobalLoot> All()
{ {
std::vector<GlobalLoot> all_entries; std::vector<GlobalLoot> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -356,11 +381,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GlobalLoot> GetWhere(Database& db, std::string where_filter) static std::vector<GlobalLoot> GetWhere(std::string where_filter)
{ {
std::vector<GlobalLoot> all_entries; std::vector<GlobalLoot> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -397,9 +422,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -410,9 +435,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GM_IPS_REPOSITORY_H #ifndef EQEMU_BASE_GM_IPS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("gm_ips"); return std::string("gm_ips");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static GmIps FindOne( static GmIps FindOne(
Database& db,
int gm_ips_id int gm_ips_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int gm_ips_id int gm_ips_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GmIps gm_ips_entry GmIps gm_ips_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(gm_ips_entry.account_id)); update_values.push_back(columns[1] + " = " + std::to_string(gm_ips_entry.account_id));
update_values.push_back(columns[2] + " = '" + EscapeString(gm_ips_entry.ip_address) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(gm_ips_entry.ip_address) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static GmIps InsertOne( static GmIps InsertOne(
Database& db,
GmIps gm_ips_entry GmIps gm_ips_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(gm_ips_entry.account_id)); insert_values.push_back(std::to_string(gm_ips_entry.account_id));
insert_values.push_back("'" + EscapeString(gm_ips_entry.ip_address) + "'"); insert_values.push_back("'" + EscapeString(gm_ips_entry.ip_address) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GmIps> gm_ips_entries std::vector<GmIps> gm_ips_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GmIps> All(Database& db) static std::vector<GmIps> All()
{ {
std::vector<GmIps> all_entries; std::vector<GmIps> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GmIps> GetWhere(Database& db, std::string where_filter) static std::vector<GmIps> GetWhere(std::string where_filter)
{ {
std::vector<GmIps> all_entries; std::vector<GmIps> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GOALLISTS_REPOSITORY_H #ifndef EQEMU_BASE_GOALLISTS_REPOSITORY_H
@@ -40,6 +57,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("goallists"); return std::string("goallists");
@@ -59,7 +91,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -88,11 +120,10 @@ public:
} }
static Goallists FindOne( static Goallists FindOne(
Database& db,
int goallists_id int goallists_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -114,11 +145,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int goallists_id int goallists_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -131,7 +161,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Goallists goallists_entry Goallists goallists_entry
) )
{ {
@@ -142,7 +171,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(goallists_entry.listid)); update_values.push_back(columns[0] + " = " + std::to_string(goallists_entry.listid));
update_values.push_back(columns[1] + " = " + std::to_string(goallists_entry.entry)); update_values.push_back(columns[1] + " = " + std::to_string(goallists_entry.entry));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -156,7 +185,6 @@ public:
} }
static Goallists InsertOne( static Goallists InsertOne(
Database& db,
Goallists goallists_entry Goallists goallists_entry
) )
{ {
@@ -165,7 +193,7 @@ public:
insert_values.push_back(std::to_string(goallists_entry.listid)); insert_values.push_back(std::to_string(goallists_entry.listid));
insert_values.push_back(std::to_string(goallists_entry.entry)); insert_values.push_back(std::to_string(goallists_entry.entry));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -184,7 +212,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Goallists> goallists_entries std::vector<Goallists> goallists_entries
) )
{ {
@@ -201,7 +228,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -212,11 +239,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Goallists> All(Database& db) static std::vector<Goallists> All()
{ {
std::vector<Goallists> all_entries; std::vector<Goallists> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -237,11 +264,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Goallists> GetWhere(Database& db, std::string where_filter) static std::vector<Goallists> GetWhere(std::string where_filter)
{ {
std::vector<Goallists> all_entries; std::vector<Goallists> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -263,9 +290,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -276,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GRAVEYARD_REPOSITORY_H #ifndef EQEMU_BASE_GRAVEYARD_REPOSITORY_H
@@ -48,6 +65,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("graveyard"); return std::string("graveyard");
@@ -67,7 +99,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -100,11 +132,10 @@ public:
} }
static Graveyard FindOne( static Graveyard FindOne(
Database& db,
int graveyard_id int graveyard_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -130,11 +161,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int graveyard_id int graveyard_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -147,7 +177,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Graveyard graveyard_entry Graveyard graveyard_entry
) )
{ {
@@ -161,7 +190,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(graveyard_entry.z)); update_values.push_back(columns[4] + " = " + std::to_string(graveyard_entry.z));
update_values.push_back(columns[5] + " = " + std::to_string(graveyard_entry.heading)); update_values.push_back(columns[5] + " = " + std::to_string(graveyard_entry.heading));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -175,20 +204,18 @@ public:
} }
static Graveyard InsertOne( static Graveyard InsertOne(
Database& db,
Graveyard graveyard_entry Graveyard graveyard_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(graveyard_entry.id));
insert_values.push_back(std::to_string(graveyard_entry.zone_id)); insert_values.push_back(std::to_string(graveyard_entry.zone_id));
insert_values.push_back(std::to_string(graveyard_entry.x)); insert_values.push_back(std::to_string(graveyard_entry.x));
insert_values.push_back(std::to_string(graveyard_entry.y)); insert_values.push_back(std::to_string(graveyard_entry.y));
insert_values.push_back(std::to_string(graveyard_entry.z)); insert_values.push_back(std::to_string(graveyard_entry.z));
insert_values.push_back(std::to_string(graveyard_entry.heading)); insert_values.push_back(std::to_string(graveyard_entry.heading));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -207,7 +234,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Graveyard> graveyard_entries std::vector<Graveyard> graveyard_entries
) )
{ {
@@ -216,7 +242,6 @@ public:
for (auto &graveyard_entry: graveyard_entries) { for (auto &graveyard_entry: graveyard_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(graveyard_entry.id));
insert_values.push_back(std::to_string(graveyard_entry.zone_id)); insert_values.push_back(std::to_string(graveyard_entry.zone_id));
insert_values.push_back(std::to_string(graveyard_entry.x)); insert_values.push_back(std::to_string(graveyard_entry.x));
insert_values.push_back(std::to_string(graveyard_entry.y)); insert_values.push_back(std::to_string(graveyard_entry.y));
@@ -228,7 +253,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -239,11 +264,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Graveyard> All(Database& db) static std::vector<Graveyard> All()
{ {
std::vector<Graveyard> all_entries; std::vector<Graveyard> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -268,11 +293,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Graveyard> GetWhere(Database& db, std::string where_filter) static std::vector<Graveyard> GetWhere(std::string where_filter)
{ {
std::vector<Graveyard> all_entries; std::vector<Graveyard> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -298,9 +323,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -311,9 +336,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GROUND_SPAWNS_REPOSITORY_H #ifndef EQEMU_BASE_GROUND_SPAWNS_REPOSITORY_H
@@ -72,6 +89,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("ground_spawns"); return std::string("ground_spawns");
@@ -91,7 +123,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -136,11 +168,10 @@ public:
} }
static GroundSpawns FindOne( static GroundSpawns FindOne(
Database& db,
int ground_spawns_id int ground_spawns_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -178,11 +209,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int ground_spawns_id int ground_spawns_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -195,7 +225,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GroundSpawns ground_spawns_entry GroundSpawns ground_spawns_entry
) )
{ {
@@ -221,7 +250,7 @@ public:
update_values.push_back(columns[16] + " = '" + EscapeString(ground_spawns_entry.content_flags) + "'"); update_values.push_back(columns[16] + " = '" + EscapeString(ground_spawns_entry.content_flags) + "'");
update_values.push_back(columns[17] + " = '" + EscapeString(ground_spawns_entry.content_flags_disabled) + "'"); update_values.push_back(columns[17] + " = '" + EscapeString(ground_spawns_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -235,13 +264,11 @@ public:
} }
static GroundSpawns InsertOne( static GroundSpawns InsertOne(
Database& db,
GroundSpawns ground_spawns_entry GroundSpawns ground_spawns_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(ground_spawns_entry.id));
insert_values.push_back(std::to_string(ground_spawns_entry.zoneid)); insert_values.push_back(std::to_string(ground_spawns_entry.zoneid));
insert_values.push_back(std::to_string(ground_spawns_entry.version)); insert_values.push_back(std::to_string(ground_spawns_entry.version));
insert_values.push_back(std::to_string(ground_spawns_entry.max_x)); insert_values.push_back(std::to_string(ground_spawns_entry.max_x));
@@ -260,7 +287,7 @@ public:
insert_values.push_back("'" + EscapeString(ground_spawns_entry.content_flags) + "'"); insert_values.push_back("'" + EscapeString(ground_spawns_entry.content_flags) + "'");
insert_values.push_back("'" + EscapeString(ground_spawns_entry.content_flags_disabled) + "'"); insert_values.push_back("'" + EscapeString(ground_spawns_entry.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -279,7 +306,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GroundSpawns> ground_spawns_entries std::vector<GroundSpawns> ground_spawns_entries
) )
{ {
@@ -288,7 +314,6 @@ public:
for (auto &ground_spawns_entry: ground_spawns_entries) { for (auto &ground_spawns_entry: ground_spawns_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(ground_spawns_entry.id));
insert_values.push_back(std::to_string(ground_spawns_entry.zoneid)); insert_values.push_back(std::to_string(ground_spawns_entry.zoneid));
insert_values.push_back(std::to_string(ground_spawns_entry.version)); insert_values.push_back(std::to_string(ground_spawns_entry.version));
insert_values.push_back(std::to_string(ground_spawns_entry.max_x)); insert_values.push_back(std::to_string(ground_spawns_entry.max_x));
@@ -312,7 +337,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -323,11 +348,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GroundSpawns> All(Database& db) static std::vector<GroundSpawns> All()
{ {
std::vector<GroundSpawns> all_entries; std::vector<GroundSpawns> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -364,11 +389,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GroundSpawns> GetWhere(Database& db, std::string where_filter) static std::vector<GroundSpawns> GetWhere(std::string where_filter)
{ {
std::vector<GroundSpawns> all_entries; std::vector<GroundSpawns> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -406,9 +431,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -419,9 +444,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GROUP_ID_REPOSITORY_H #ifndef EQEMU_BASE_GROUP_ID_REPOSITORY_H
@@ -44,6 +61,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("group_id"); return std::string("group_id");
@@ -63,7 +95,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -94,11 +126,10 @@ public:
} }
static GroupId FindOne( static GroupId FindOne(
Database& db,
int group_id_id int group_id_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -122,11 +153,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int group_id_id int group_id_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -139,7 +169,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GroupId group_id_entry GroupId group_id_entry
) )
{ {
@@ -152,7 +181,7 @@ public:
update_values.push_back(columns[2] + " = '" + EscapeString(group_id_entry.name) + "'"); update_values.push_back(columns[2] + " = '" + EscapeString(group_id_entry.name) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(group_id_entry.ismerc)); update_values.push_back(columns[3] + " = " + std::to_string(group_id_entry.ismerc));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -166,7 +195,6 @@ public:
} }
static GroupId InsertOne( static GroupId InsertOne(
Database& db,
GroupId group_id_entry GroupId group_id_entry
) )
{ {
@@ -177,7 +205,7 @@ public:
insert_values.push_back("'" + EscapeString(group_id_entry.name) + "'"); insert_values.push_back("'" + EscapeString(group_id_entry.name) + "'");
insert_values.push_back(std::to_string(group_id_entry.ismerc)); insert_values.push_back(std::to_string(group_id_entry.ismerc));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -196,7 +224,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GroupId> group_id_entries std::vector<GroupId> group_id_entries
) )
{ {
@@ -215,7 +242,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -226,11 +253,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GroupId> All(Database& db) static std::vector<GroupId> All()
{ {
std::vector<GroupId> all_entries; std::vector<GroupId> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -253,11 +280,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GroupId> GetWhere(Database& db, std::string where_filter) static std::vector<GroupId> GetWhere(std::string where_filter)
{ {
std::vector<GroupId> all_entries; std::vector<GroupId> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -281,9 +308,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -294,9 +321,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GROUP_LEADERS_REPOSITORY_H #ifndef EQEMU_BASE_GROUP_LEADERS_REPOSITORY_H
@@ -54,6 +71,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("group_leaders"); return std::string("group_leaders");
@@ -73,7 +105,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -109,11 +141,10 @@ public:
} }
static GroupLeaders FindOne( static GroupLeaders FindOne(
Database& db,
int group_leaders_id int group_leaders_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -142,11 +173,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int group_leaders_id int group_leaders_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -159,7 +189,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GroupLeaders group_leaders_entry GroupLeaders group_leaders_entry
) )
{ {
@@ -177,7 +206,7 @@ public:
update_values.push_back(columns[7] + " = '" + EscapeString(group_leaders_entry.mentoree) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(group_leaders_entry.mentoree) + "'");
update_values.push_back(columns[8] + " = " + std::to_string(group_leaders_entry.mentor_percent)); update_values.push_back(columns[8] + " = " + std::to_string(group_leaders_entry.mentor_percent));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -191,7 +220,6 @@ public:
} }
static GroupLeaders InsertOne( static GroupLeaders InsertOne(
Database& db,
GroupLeaders group_leaders_entry GroupLeaders group_leaders_entry
) )
{ {
@@ -207,7 +235,7 @@ public:
insert_values.push_back("'" + EscapeString(group_leaders_entry.mentoree) + "'"); insert_values.push_back("'" + EscapeString(group_leaders_entry.mentoree) + "'");
insert_values.push_back(std::to_string(group_leaders_entry.mentor_percent)); insert_values.push_back(std::to_string(group_leaders_entry.mentor_percent));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -226,7 +254,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GroupLeaders> group_leaders_entries std::vector<GroupLeaders> group_leaders_entries
) )
{ {
@@ -250,7 +277,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -261,11 +288,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GroupLeaders> All(Database& db) static std::vector<GroupLeaders> All()
{ {
std::vector<GroupLeaders> all_entries; std::vector<GroupLeaders> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -293,11 +320,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GroupLeaders> GetWhere(Database& db, std::string where_filter) static std::vector<GroupLeaders> GetWhere(std::string where_filter)
{ {
std::vector<GroupLeaders> all_entries; std::vector<GroupLeaders> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -326,9 +353,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -339,9 +366,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GUILD_MEMBERS_REPOSITORY_H #ifndef EQEMU_BASE_GUILD_MEMBERS_REPOSITORY_H
@@ -54,6 +71,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("guild_members"); return std::string("guild_members");
@@ -73,7 +105,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -109,11 +141,10 @@ public:
} }
static GuildMembers FindOne( static GuildMembers FindOne(
Database& db,
int guild_members_id int guild_members_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -142,11 +173,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int guild_members_id int guild_members_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -159,7 +189,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GuildMembers guild_members_entry GuildMembers guild_members_entry
) )
{ {
@@ -177,7 +206,7 @@ public:
update_values.push_back(columns[7] + " = '" + EscapeString(guild_members_entry.public_note) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(guild_members_entry.public_note) + "'");
update_values.push_back(columns[8] + " = " + std::to_string(guild_members_entry.alt)); update_values.push_back(columns[8] + " = " + std::to_string(guild_members_entry.alt));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -191,7 +220,6 @@ public:
} }
static GuildMembers InsertOne( static GuildMembers InsertOne(
Database& db,
GuildMembers guild_members_entry GuildMembers guild_members_entry
) )
{ {
@@ -207,7 +235,7 @@ public:
insert_values.push_back("'" + EscapeString(guild_members_entry.public_note) + "'"); insert_values.push_back("'" + EscapeString(guild_members_entry.public_note) + "'");
insert_values.push_back(std::to_string(guild_members_entry.alt)); insert_values.push_back(std::to_string(guild_members_entry.alt));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -226,7 +254,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GuildMembers> guild_members_entries std::vector<GuildMembers> guild_members_entries
) )
{ {
@@ -250,7 +277,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -261,11 +288,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GuildMembers> All(Database& db) static std::vector<GuildMembers> All()
{ {
std::vector<GuildMembers> all_entries; std::vector<GuildMembers> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -293,11 +320,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GuildMembers> GetWhere(Database& db, std::string where_filter) static std::vector<GuildMembers> GetWhere(std::string where_filter)
{ {
std::vector<GuildMembers> all_entries; std::vector<GuildMembers> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -326,9 +353,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -339,9 +366,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GUILD_RANKS_REPOSITORY_H #ifndef EQEMU_BASE_GUILD_RANKS_REPOSITORY_H
@@ -58,6 +75,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("guild_ranks"); return std::string("guild_ranks");
@@ -77,7 +109,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -115,11 +147,10 @@ public:
} }
static GuildRanks FindOne( static GuildRanks FindOne(
Database& db,
int guild_ranks_id int guild_ranks_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -150,11 +181,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int guild_ranks_id int guild_ranks_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -167,7 +197,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GuildRanks guild_ranks_entry GuildRanks guild_ranks_entry
) )
{ {
@@ -187,7 +216,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(guild_ranks_entry.can_motd)); update_values.push_back(columns[9] + " = " + std::to_string(guild_ranks_entry.can_motd));
update_values.push_back(columns[10] + " = " + std::to_string(guild_ranks_entry.can_warpeace)); update_values.push_back(columns[10] + " = " + std::to_string(guild_ranks_entry.can_warpeace));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -201,7 +230,6 @@ public:
} }
static GuildRanks InsertOne( static GuildRanks InsertOne(
Database& db,
GuildRanks guild_ranks_entry GuildRanks guild_ranks_entry
) )
{ {
@@ -219,7 +247,7 @@ public:
insert_values.push_back(std::to_string(guild_ranks_entry.can_motd)); insert_values.push_back(std::to_string(guild_ranks_entry.can_motd));
insert_values.push_back(std::to_string(guild_ranks_entry.can_warpeace)); insert_values.push_back(std::to_string(guild_ranks_entry.can_warpeace));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -238,7 +266,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GuildRanks> guild_ranks_entries std::vector<GuildRanks> guild_ranks_entries
) )
{ {
@@ -264,7 +291,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -275,11 +302,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GuildRanks> All(Database& db) static std::vector<GuildRanks> All()
{ {
std::vector<GuildRanks> all_entries; std::vector<GuildRanks> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -309,11 +336,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GuildRanks> GetWhere(Database& db, std::string where_filter) static std::vector<GuildRanks> GetWhere(std::string where_filter)
{ {
std::vector<GuildRanks> all_entries; std::vector<GuildRanks> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -344,9 +371,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -357,9 +384,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GUILD_RELATIONS_REPOSITORY_H #ifndef EQEMU_BASE_GUILD_RELATIONS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("guild_relations"); return std::string("guild_relations");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static GuildRelations FindOne( static GuildRelations FindOne(
Database& db,
int guild_relations_id int guild_relations_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int guild_relations_id int guild_relations_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
GuildRelations guild_relations_entry GuildRelations guild_relations_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(guild_relations_entry.guild2)); update_values.push_back(columns[1] + " = " + std::to_string(guild_relations_entry.guild2));
update_values.push_back(columns[2] + " = " + std::to_string(guild_relations_entry.relation)); update_values.push_back(columns[2] + " = " + std::to_string(guild_relations_entry.relation));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static GuildRelations InsertOne( static GuildRelations InsertOne(
Database& db,
GuildRelations guild_relations_entry GuildRelations guild_relations_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(guild_relations_entry.guild2)); insert_values.push_back(std::to_string(guild_relations_entry.guild2));
insert_values.push_back(std::to_string(guild_relations_entry.relation)); insert_values.push_back(std::to_string(guild_relations_entry.relation));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<GuildRelations> guild_relations_entries std::vector<GuildRelations> guild_relations_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<GuildRelations> All(Database& db) static std::vector<GuildRelations> All()
{ {
std::vector<GuildRelations> all_entries; std::vector<GuildRelations> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<GuildRelations> GetWhere(Database& db, std::string where_filter) static std::vector<GuildRelations> GetWhere(std::string where_filter)
{ {
std::vector<GuildRelations> all_entries; std::vector<GuildRelations> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_GUILDS_REPOSITORY_H #ifndef EQEMU_BASE_GUILDS_REPOSITORY_H
@@ -54,6 +71,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("guilds"); return std::string("guilds");
@@ -73,7 +105,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -109,11 +141,10 @@ public:
} }
static Guilds FindOne( static Guilds FindOne(
Database& db,
int guilds_id int guilds_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -142,11 +173,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int guilds_id int guilds_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -159,7 +189,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Guilds guilds_entry Guilds guilds_entry
) )
{ {
@@ -176,7 +205,7 @@ public:
update_values.push_back(columns[7] + " = '" + EscapeString(guilds_entry.channel) + "'"); update_values.push_back(columns[7] + " = '" + EscapeString(guilds_entry.channel) + "'");
update_values.push_back(columns[8] + " = '" + EscapeString(guilds_entry.url) + "'"); update_values.push_back(columns[8] + " = '" + EscapeString(guilds_entry.url) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -190,13 +219,11 @@ public:
} }
static Guilds InsertOne( static Guilds InsertOne(
Database& db,
Guilds guilds_entry Guilds guilds_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(guilds_entry.id));
insert_values.push_back("'" + EscapeString(guilds_entry.name) + "'"); insert_values.push_back("'" + EscapeString(guilds_entry.name) + "'");
insert_values.push_back(std::to_string(guilds_entry.leader)); insert_values.push_back(std::to_string(guilds_entry.leader));
insert_values.push_back(std::to_string(guilds_entry.minstatus)); insert_values.push_back(std::to_string(guilds_entry.minstatus));
@@ -206,7 +233,7 @@ public:
insert_values.push_back("'" + EscapeString(guilds_entry.channel) + "'"); insert_values.push_back("'" + EscapeString(guilds_entry.channel) + "'");
insert_values.push_back("'" + EscapeString(guilds_entry.url) + "'"); insert_values.push_back("'" + EscapeString(guilds_entry.url) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -225,7 +252,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Guilds> guilds_entries std::vector<Guilds> guilds_entries
) )
{ {
@@ -234,7 +260,6 @@ public:
for (auto &guilds_entry: guilds_entries) { for (auto &guilds_entry: guilds_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(guilds_entry.id));
insert_values.push_back("'" + EscapeString(guilds_entry.name) + "'"); insert_values.push_back("'" + EscapeString(guilds_entry.name) + "'");
insert_values.push_back(std::to_string(guilds_entry.leader)); insert_values.push_back(std::to_string(guilds_entry.leader));
insert_values.push_back(std::to_string(guilds_entry.minstatus)); insert_values.push_back(std::to_string(guilds_entry.minstatus));
@@ -249,7 +274,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -260,11 +285,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Guilds> All(Database& db) static std::vector<Guilds> All()
{ {
std::vector<Guilds> all_entries; std::vector<Guilds> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -292,11 +317,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Guilds> GetWhere(Database& db, std::string where_filter) static std::vector<Guilds> GetWhere(std::string where_filter)
{ {
std::vector<Guilds> all_entries; std::vector<Guilds> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -325,9 +350,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -338,9 +363,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_HACKERS_REPOSITORY_H #ifndef EQEMU_BASE_HACKERS_REPOSITORY_H
@@ -48,6 +65,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("hackers"); return std::string("hackers");
@@ -67,7 +99,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -100,11 +132,10 @@ public:
} }
static Hackers FindOne( static Hackers FindOne(
Database& db,
int hackers_id int hackers_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -130,11 +161,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int hackers_id int hackers_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -147,7 +177,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Hackers hackers_entry Hackers hackers_entry
) )
{ {
@@ -161,7 +190,7 @@ public:
update_values.push_back(columns[4] + " = '" + EscapeString(hackers_entry.zone) + "'"); update_values.push_back(columns[4] + " = '" + EscapeString(hackers_entry.zone) + "'");
update_values.push_back(columns[5] + " = '" + EscapeString(hackers_entry.date) + "'"); update_values.push_back(columns[5] + " = '" + EscapeString(hackers_entry.date) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -175,20 +204,18 @@ public:
} }
static Hackers InsertOne( static Hackers InsertOne(
Database& db,
Hackers hackers_entry Hackers hackers_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(hackers_entry.id));
insert_values.push_back("'" + EscapeString(hackers_entry.account) + "'"); insert_values.push_back("'" + EscapeString(hackers_entry.account) + "'");
insert_values.push_back("'" + EscapeString(hackers_entry.name) + "'"); insert_values.push_back("'" + EscapeString(hackers_entry.name) + "'");
insert_values.push_back("'" + EscapeString(hackers_entry.hacked) + "'"); insert_values.push_back("'" + EscapeString(hackers_entry.hacked) + "'");
insert_values.push_back("'" + EscapeString(hackers_entry.zone) + "'"); insert_values.push_back("'" + EscapeString(hackers_entry.zone) + "'");
insert_values.push_back("'" + EscapeString(hackers_entry.date) + "'"); insert_values.push_back("'" + EscapeString(hackers_entry.date) + "'");
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -207,7 +234,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Hackers> hackers_entries std::vector<Hackers> hackers_entries
) )
{ {
@@ -216,7 +242,6 @@ public:
for (auto &hackers_entry: hackers_entries) { for (auto &hackers_entry: hackers_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(hackers_entry.id));
insert_values.push_back("'" + EscapeString(hackers_entry.account) + "'"); insert_values.push_back("'" + EscapeString(hackers_entry.account) + "'");
insert_values.push_back("'" + EscapeString(hackers_entry.name) + "'"); insert_values.push_back("'" + EscapeString(hackers_entry.name) + "'");
insert_values.push_back("'" + EscapeString(hackers_entry.hacked) + "'"); insert_values.push_back("'" + EscapeString(hackers_entry.hacked) + "'");
@@ -228,7 +253,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -239,11 +264,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Hackers> All(Database& db) static std::vector<Hackers> All()
{ {
std::vector<Hackers> all_entries; std::vector<Hackers> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -268,11 +293,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Hackers> GetWhere(Database& db, std::string where_filter) static std::vector<Hackers> GetWhere(std::string where_filter)
{ {
std::vector<Hackers> all_entries; std::vector<Hackers> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -298,9 +323,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -311,9 +336,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_INSTANCE_LIST_PLAYER_REPOSITORY_H #ifndef EQEMU_BASE_INSTANCE_LIST_PLAYER_REPOSITORY_H
@@ -40,6 +57,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("instance_list_player"); return std::string("instance_list_player");
@@ -59,7 +91,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -88,11 +120,10 @@ public:
} }
static InstanceListPlayer FindOne( static InstanceListPlayer FindOne(
Database& db,
int instance_list_player_id int instance_list_player_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -114,11 +145,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int instance_list_player_id int instance_list_player_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -131,7 +161,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
InstanceListPlayer instance_list_player_entry InstanceListPlayer instance_list_player_entry
) )
{ {
@@ -142,7 +171,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(instance_list_player_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(instance_list_player_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(instance_list_player_entry.charid)); update_values.push_back(columns[1] + " = " + std::to_string(instance_list_player_entry.charid));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -156,7 +185,6 @@ public:
} }
static InstanceListPlayer InsertOne( static InstanceListPlayer InsertOne(
Database& db,
InstanceListPlayer instance_list_player_entry InstanceListPlayer instance_list_player_entry
) )
{ {
@@ -165,7 +193,7 @@ public:
insert_values.push_back(std::to_string(instance_list_player_entry.id)); insert_values.push_back(std::to_string(instance_list_player_entry.id));
insert_values.push_back(std::to_string(instance_list_player_entry.charid)); insert_values.push_back(std::to_string(instance_list_player_entry.charid));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -184,7 +212,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<InstanceListPlayer> instance_list_player_entries std::vector<InstanceListPlayer> instance_list_player_entries
) )
{ {
@@ -201,7 +228,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -212,11 +239,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<InstanceListPlayer> All(Database& db) static std::vector<InstanceListPlayer> All()
{ {
std::vector<InstanceListPlayer> all_entries; std::vector<InstanceListPlayer> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -237,11 +264,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<InstanceListPlayer> GetWhere(Database& db, std::string where_filter) static std::vector<InstanceListPlayer> GetWhere(std::string where_filter)
{ {
std::vector<InstanceListPlayer> all_entries; std::vector<InstanceListPlayer> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -263,9 +290,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -276,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_INSTANCE_LIST_REPOSITORY_H #ifndef EQEMU_BASE_INSTANCE_LIST_REPOSITORY_H
@@ -50,6 +67,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("instance_list"); return std::string("instance_list");
@@ -69,7 +101,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -103,11 +135,10 @@ public:
} }
static InstanceList FindOne( static InstanceList FindOne(
Database& db,
int instance_list_id int instance_list_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -134,11 +165,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int instance_list_id int instance_list_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -151,7 +181,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
InstanceList instance_list_entry InstanceList instance_list_entry
) )
{ {
@@ -166,7 +195,7 @@ public:
update_values.push_back(columns[5] + " = " + std::to_string(instance_list_entry.duration)); update_values.push_back(columns[5] + " = " + std::to_string(instance_list_entry.duration));
update_values.push_back(columns[6] + " = " + std::to_string(instance_list_entry.never_expires)); update_values.push_back(columns[6] + " = " + std::to_string(instance_list_entry.never_expires));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -180,13 +209,11 @@ public:
} }
static InstanceList InsertOne( static InstanceList InsertOne(
Database& db,
InstanceList instance_list_entry InstanceList instance_list_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(instance_list_entry.id));
insert_values.push_back(std::to_string(instance_list_entry.zone)); insert_values.push_back(std::to_string(instance_list_entry.zone));
insert_values.push_back(std::to_string(instance_list_entry.version)); insert_values.push_back(std::to_string(instance_list_entry.version));
insert_values.push_back(std::to_string(instance_list_entry.is_global)); insert_values.push_back(std::to_string(instance_list_entry.is_global));
@@ -194,7 +221,7 @@ public:
insert_values.push_back(std::to_string(instance_list_entry.duration)); insert_values.push_back(std::to_string(instance_list_entry.duration));
insert_values.push_back(std::to_string(instance_list_entry.never_expires)); insert_values.push_back(std::to_string(instance_list_entry.never_expires));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -213,7 +240,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<InstanceList> instance_list_entries std::vector<InstanceList> instance_list_entries
) )
{ {
@@ -222,7 +248,6 @@ public:
for (auto &instance_list_entry: instance_list_entries) { for (auto &instance_list_entry: instance_list_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(instance_list_entry.id));
insert_values.push_back(std::to_string(instance_list_entry.zone)); insert_values.push_back(std::to_string(instance_list_entry.zone));
insert_values.push_back(std::to_string(instance_list_entry.version)); insert_values.push_back(std::to_string(instance_list_entry.version));
insert_values.push_back(std::to_string(instance_list_entry.is_global)); insert_values.push_back(std::to_string(instance_list_entry.is_global));
@@ -235,7 +260,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -246,11 +271,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<InstanceList> All(Database& db) static std::vector<InstanceList> All()
{ {
std::vector<InstanceList> all_entries; std::vector<InstanceList> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -276,11 +301,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<InstanceList> GetWhere(Database& db, std::string where_filter) static std::vector<InstanceList> GetWhere(std::string where_filter)
{ {
std::vector<InstanceList> all_entries; std::vector<InstanceList> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -307,9 +332,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -320,9 +345,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_INVENTORY_REPOSITORY_H #ifndef EQEMU_BASE_INVENTORY_REPOSITORY_H
@@ -68,6 +85,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("inventory"); return std::string("inventory");
@@ -87,7 +119,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -130,11 +162,10 @@ public:
} }
static Inventory FindOne( static Inventory FindOne(
Database& db,
int inventory_id int inventory_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -170,11 +201,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int inventory_id int inventory_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -187,7 +217,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Inventory inventory_entry Inventory inventory_entry
) )
{ {
@@ -212,7 +241,7 @@ public:
update_values.push_back(columns[14] + " = " + std::to_string(inventory_entry.ornamentidfile)); update_values.push_back(columns[14] + " = " + std::to_string(inventory_entry.ornamentidfile));
update_values.push_back(columns[15] + " = " + std::to_string(inventory_entry.ornament_hero_model)); update_values.push_back(columns[15] + " = " + std::to_string(inventory_entry.ornament_hero_model));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -226,7 +255,6 @@ public:
} }
static Inventory InsertOne( static Inventory InsertOne(
Database& db,
Inventory inventory_entry Inventory inventory_entry
) )
{ {
@@ -249,7 +277,7 @@ public:
insert_values.push_back(std::to_string(inventory_entry.ornamentidfile)); insert_values.push_back(std::to_string(inventory_entry.ornamentidfile));
insert_values.push_back(std::to_string(inventory_entry.ornament_hero_model)); insert_values.push_back(std::to_string(inventory_entry.ornament_hero_model));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -268,7 +296,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Inventory> inventory_entries std::vector<Inventory> inventory_entries
) )
{ {
@@ -299,7 +326,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -310,11 +337,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Inventory> All(Database& db) static std::vector<Inventory> All()
{ {
std::vector<Inventory> all_entries; std::vector<Inventory> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -349,11 +376,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Inventory> GetWhere(Database& db, std::string where_filter) static std::vector<Inventory> GetWhere(std::string where_filter)
{ {
std::vector<Inventory> all_entries; std::vector<Inventory> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -389,9 +416,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -402,9 +429,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_INVENTORY_SNAPSHOTS_REPOSITORY_H #ifndef EQEMU_BASE_INVENTORY_SNAPSHOTS_REPOSITORY_H
@@ -70,6 +87,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("inventory_snapshots"); return std::string("inventory_snapshots");
@@ -89,7 +121,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -133,11 +165,10 @@ public:
} }
static InventorySnapshots FindOne( static InventorySnapshots FindOne(
Database& db,
int inventory_snapshots_id int inventory_snapshots_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -174,11 +205,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int inventory_snapshots_id int inventory_snapshots_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -191,7 +221,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
InventorySnapshots inventory_snapshots_entry InventorySnapshots inventory_snapshots_entry
) )
{ {
@@ -217,7 +246,7 @@ public:
update_values.push_back(columns[15] + " = " + std::to_string(inventory_snapshots_entry.ornamentidfile)); update_values.push_back(columns[15] + " = " + std::to_string(inventory_snapshots_entry.ornamentidfile));
update_values.push_back(columns[16] + " = " + std::to_string(inventory_snapshots_entry.ornament_hero_model)); update_values.push_back(columns[16] + " = " + std::to_string(inventory_snapshots_entry.ornament_hero_model));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -231,7 +260,6 @@ public:
} }
static InventorySnapshots InsertOne( static InventorySnapshots InsertOne(
Database& db,
InventorySnapshots inventory_snapshots_entry InventorySnapshots inventory_snapshots_entry
) )
{ {
@@ -255,7 +283,7 @@ public:
insert_values.push_back(std::to_string(inventory_snapshots_entry.ornamentidfile)); insert_values.push_back(std::to_string(inventory_snapshots_entry.ornamentidfile));
insert_values.push_back(std::to_string(inventory_snapshots_entry.ornament_hero_model)); insert_values.push_back(std::to_string(inventory_snapshots_entry.ornament_hero_model));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -274,7 +302,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<InventorySnapshots> inventory_snapshots_entries std::vector<InventorySnapshots> inventory_snapshots_entries
) )
{ {
@@ -306,7 +333,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -317,11 +344,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<InventorySnapshots> All(Database& db) static std::vector<InventorySnapshots> All()
{ {
std::vector<InventorySnapshots> all_entries; std::vector<InventorySnapshots> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -357,11 +384,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<InventorySnapshots> GetWhere(Database& db, std::string where_filter) static std::vector<InventorySnapshots> GetWhere(std::string where_filter)
{ {
std::vector<InventorySnapshots> all_entries; std::vector<InventorySnapshots> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -398,9 +425,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -411,9 +438,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_IP_EXEMPTIONS_REPOSITORY_H #ifndef EQEMU_BASE_IP_EXEMPTIONS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("ip_exemptions"); return std::string("ip_exemptions");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static IpExemptions FindOne( static IpExemptions FindOne(
Database& db,
int ip_exemptions_id int ip_exemptions_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int ip_exemptions_id int ip_exemptions_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
IpExemptions ip_exemptions_entry IpExemptions ip_exemptions_entry
) )
{ {
@@ -146,7 +175,7 @@ public:
update_values.push_back(columns[1] + " = '" + EscapeString(ip_exemptions_entry.exemption_ip) + "'"); update_values.push_back(columns[1] + " = '" + EscapeString(ip_exemptions_entry.exemption_ip) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(ip_exemptions_entry.exemption_amount)); update_values.push_back(columns[2] + " = " + std::to_string(ip_exemptions_entry.exemption_amount));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -160,17 +189,15 @@ public:
} }
static IpExemptions InsertOne( static IpExemptions InsertOne(
Database& db,
IpExemptions ip_exemptions_entry IpExemptions ip_exemptions_entry
) )
{ {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(ip_exemptions_entry.exemption_id));
insert_values.push_back("'" + EscapeString(ip_exemptions_entry.exemption_ip) + "'"); insert_values.push_back("'" + EscapeString(ip_exemptions_entry.exemption_ip) + "'");
insert_values.push_back(std::to_string(ip_exemptions_entry.exemption_amount)); insert_values.push_back(std::to_string(ip_exemptions_entry.exemption_amount));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -189,7 +216,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<IpExemptions> ip_exemptions_entries std::vector<IpExemptions> ip_exemptions_entries
) )
{ {
@@ -198,7 +224,6 @@ public:
for (auto &ip_exemptions_entry: ip_exemptions_entries) { for (auto &ip_exemptions_entry: ip_exemptions_entries) {
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(ip_exemptions_entry.exemption_id));
insert_values.push_back("'" + EscapeString(ip_exemptions_entry.exemption_ip) + "'"); insert_values.push_back("'" + EscapeString(ip_exemptions_entry.exemption_ip) + "'");
insert_values.push_back(std::to_string(ip_exemptions_entry.exemption_amount)); insert_values.push_back(std::to_string(ip_exemptions_entry.exemption_amount));
@@ -207,7 +232,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -218,11 +243,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<IpExemptions> All(Database& db) static std::vector<IpExemptions> All()
{ {
std::vector<IpExemptions> all_entries; std::vector<IpExemptions> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -244,11 +269,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<IpExemptions> GetWhere(Database& db, std::string where_filter) static std::vector<IpExemptions> GetWhere(std::string where_filter)
{ {
std::vector<IpExemptions> all_entries; std::vector<IpExemptions> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -271,9 +296,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -284,9 +309,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ITEM_TICK_REPOSITORY_H #ifndef EQEMU_BASE_ITEM_TICK_REPOSITORY_H
@@ -48,6 +65,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("item_tick"); return std::string("item_tick");
@@ -67,7 +99,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -100,11 +132,10 @@ public:
} }
static ItemTick FindOne( static ItemTick FindOne(
Database& db,
int item_tick_id int item_tick_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -130,11 +161,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int item_tick_id int item_tick_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -147,7 +177,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
ItemTick item_tick_entry ItemTick item_tick_entry
) )
{ {
@@ -161,7 +190,7 @@ public:
update_values.push_back(columns[4] + " = '" + EscapeString(item_tick_entry.it_qglobal) + "'"); update_values.push_back(columns[4] + " = '" + EscapeString(item_tick_entry.it_qglobal) + "'");
update_values.push_back(columns[5] + " = " + std::to_string(item_tick_entry.it_bagslot)); update_values.push_back(columns[5] + " = " + std::to_string(item_tick_entry.it_bagslot));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -175,7 +204,6 @@ public:
} }
static ItemTick InsertOne( static ItemTick InsertOne(
Database& db,
ItemTick item_tick_entry ItemTick item_tick_entry
) )
{ {
@@ -184,11 +212,10 @@ public:
insert_values.push_back(std::to_string(item_tick_entry.it_itemid)); insert_values.push_back(std::to_string(item_tick_entry.it_itemid));
insert_values.push_back(std::to_string(item_tick_entry.it_chance)); insert_values.push_back(std::to_string(item_tick_entry.it_chance));
insert_values.push_back(std::to_string(item_tick_entry.it_level)); insert_values.push_back(std::to_string(item_tick_entry.it_level));
insert_values.push_back(std::to_string(item_tick_entry.it_id));
insert_values.push_back("'" + EscapeString(item_tick_entry.it_qglobal) + "'"); insert_values.push_back("'" + EscapeString(item_tick_entry.it_qglobal) + "'");
insert_values.push_back(std::to_string(item_tick_entry.it_bagslot)); insert_values.push_back(std::to_string(item_tick_entry.it_bagslot));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -207,7 +234,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<ItemTick> item_tick_entries std::vector<ItemTick> item_tick_entries
) )
{ {
@@ -219,7 +245,6 @@ public:
insert_values.push_back(std::to_string(item_tick_entry.it_itemid)); insert_values.push_back(std::to_string(item_tick_entry.it_itemid));
insert_values.push_back(std::to_string(item_tick_entry.it_chance)); insert_values.push_back(std::to_string(item_tick_entry.it_chance));
insert_values.push_back(std::to_string(item_tick_entry.it_level)); insert_values.push_back(std::to_string(item_tick_entry.it_level));
insert_values.push_back(std::to_string(item_tick_entry.it_id));
insert_values.push_back("'" + EscapeString(item_tick_entry.it_qglobal) + "'"); insert_values.push_back("'" + EscapeString(item_tick_entry.it_qglobal) + "'");
insert_values.push_back(std::to_string(item_tick_entry.it_bagslot)); insert_values.push_back(std::to_string(item_tick_entry.it_bagslot));
@@ -228,7 +253,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -239,11 +264,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<ItemTick> All(Database& db) static std::vector<ItemTick> All()
{ {
std::vector<ItemTick> all_entries; std::vector<ItemTick> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -268,11 +293,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<ItemTick> GetWhere(Database& db, std::string where_filter) static std::vector<ItemTick> GetWhere(std::string where_filter)
{ {
std::vector<ItemTick> all_entries; std::vector<ItemTick> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -298,9 +323,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -311,9 +336,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_ITEMS_REPOSITORY_H #ifndef EQEMU_BASE_ITEMS_REPOSITORY_H
@@ -606,6 +623,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("items"); return std::string("items");
@@ -625,7 +657,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -937,11 +969,10 @@ public:
} }
static Items FindOne( static Items FindOne(
Database& db,
int items_id int items_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -1246,11 +1277,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int items_id int items_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -1263,7 +1293,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Items items_entry Items items_entry
) )
{ {
@@ -1557,7 +1586,7 @@ public:
update_values.push_back(columns[283] + " = " + std::to_string(items_entry.UNK241)); update_values.push_back(columns[283] + " = " + std::to_string(items_entry.UNK241));
update_values.push_back(columns[284] + " = " + std::to_string(items_entry.epicitem)); update_values.push_back(columns[284] + " = " + std::to_string(items_entry.epicitem));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -1571,7 +1600,6 @@ public:
} }
static Items InsertOne( static Items InsertOne(
Database& db,
Items items_entry Items items_entry
) )
{ {
@@ -1863,7 +1891,7 @@ public:
insert_values.push_back(std::to_string(items_entry.UNK241)); insert_values.push_back(std::to_string(items_entry.UNK241));
insert_values.push_back(std::to_string(items_entry.epicitem)); insert_values.push_back(std::to_string(items_entry.epicitem));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -1882,7 +1910,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Items> items_entries std::vector<Items> items_entries
) )
{ {
@@ -2182,7 +2209,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -2193,11 +2220,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Items> All(Database& db) static std::vector<Items> All()
{ {
std::vector<Items> all_entries; std::vector<Items> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -2501,11 +2528,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Items> GetWhere(Database& db, std::string where_filter) static std::vector<Items> GetWhere(std::string where_filter)
{ {
std::vector<Items> all_entries; std::vector<Items> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -2810,9 +2837,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -2823,9 +2850,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_LDON_TRAP_ENTRIES_REPOSITORY_H #ifndef EQEMU_BASE_LDON_TRAP_ENTRIES_REPOSITORY_H
@@ -40,6 +57,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("ldon_trap_entries"); return std::string("ldon_trap_entries");
@@ -59,7 +91,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -88,11 +120,10 @@ public:
} }
static LdonTrapEntries FindOne( static LdonTrapEntries FindOne(
Database& db,
int ldon_trap_entries_id int ldon_trap_entries_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -114,11 +145,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int ldon_trap_entries_id int ldon_trap_entries_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -131,7 +161,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LdonTrapEntries ldon_trap_entries_entry LdonTrapEntries ldon_trap_entries_entry
) )
{ {
@@ -142,7 +171,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(ldon_trap_entries_entry.id)); update_values.push_back(columns[0] + " = " + std::to_string(ldon_trap_entries_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(ldon_trap_entries_entry.trap_id)); update_values.push_back(columns[1] + " = " + std::to_string(ldon_trap_entries_entry.trap_id));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -156,7 +185,6 @@ public:
} }
static LdonTrapEntries InsertOne( static LdonTrapEntries InsertOne(
Database& db,
LdonTrapEntries ldon_trap_entries_entry LdonTrapEntries ldon_trap_entries_entry
) )
{ {
@@ -165,7 +193,7 @@ public:
insert_values.push_back(std::to_string(ldon_trap_entries_entry.id)); insert_values.push_back(std::to_string(ldon_trap_entries_entry.id));
insert_values.push_back(std::to_string(ldon_trap_entries_entry.trap_id)); insert_values.push_back(std::to_string(ldon_trap_entries_entry.trap_id));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -184,7 +212,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LdonTrapEntries> ldon_trap_entries_entries std::vector<LdonTrapEntries> ldon_trap_entries_entries
) )
{ {
@@ -201,7 +228,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -212,11 +239,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LdonTrapEntries> All(Database& db) static std::vector<LdonTrapEntries> All()
{ {
std::vector<LdonTrapEntries> all_entries; std::vector<LdonTrapEntries> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -237,11 +264,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LdonTrapEntries> GetWhere(Database& db, std::string where_filter) static std::vector<LdonTrapEntries> GetWhere(std::string where_filter)
{ {
std::vector<LdonTrapEntries> all_entries; std::vector<LdonTrapEntries> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -263,9 +290,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -276,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_LDON_TRAP_TEMPLATES_REPOSITORY_H #ifndef EQEMU_BASE_LDON_TRAP_TEMPLATES_REPOSITORY_H
@@ -46,6 +63,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("ldon_trap_templates"); return std::string("ldon_trap_templates");
@@ -65,7 +97,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -97,11 +129,10 @@ public:
} }
static LdonTrapTemplates FindOne( static LdonTrapTemplates FindOne(
Database& db,
int ldon_trap_templates_id int ldon_trap_templates_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -126,11 +157,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int ldon_trap_templates_id int ldon_trap_templates_id
) )
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -143,7 +173,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LdonTrapTemplates ldon_trap_templates_entry LdonTrapTemplates ldon_trap_templates_entry
) )
{ {
@@ -157,7 +186,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(ldon_trap_templates_entry.skill)); update_values.push_back(columns[3] + " = " + std::to_string(ldon_trap_templates_entry.skill));
update_values.push_back(columns[4] + " = " + std::to_string(ldon_trap_templates_entry.locked)); update_values.push_back(columns[4] + " = " + std::to_string(ldon_trap_templates_entry.locked));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -171,7 +200,6 @@ public:
} }
static LdonTrapTemplates InsertOne( static LdonTrapTemplates InsertOne(
Database& db,
LdonTrapTemplates ldon_trap_templates_entry LdonTrapTemplates ldon_trap_templates_entry
) )
{ {
@@ -183,7 +211,7 @@ public:
insert_values.push_back(std::to_string(ldon_trap_templates_entry.skill)); insert_values.push_back(std::to_string(ldon_trap_templates_entry.skill));
insert_values.push_back(std::to_string(ldon_trap_templates_entry.locked)); insert_values.push_back(std::to_string(ldon_trap_templates_entry.locked));
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -202,7 +230,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LdonTrapTemplates> ldon_trap_templates_entries std::vector<LdonTrapTemplates> ldon_trap_templates_entries
) )
{ {
@@ -222,7 +249,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -233,11 +260,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LdonTrapTemplates> All(Database& db) static std::vector<LdonTrapTemplates> All()
{ {
std::vector<LdonTrapTemplates> all_entries; std::vector<LdonTrapTemplates> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -261,11 +288,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LdonTrapTemplates> GetWhere(Database& db, std::string where_filter) static std::vector<LdonTrapTemplates> GetWhere(std::string where_filter)
{ {
std::vector<LdonTrapTemplates> all_entries; std::vector<LdonTrapTemplates> all_entries;
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -290,9 +317,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -303,9 +330,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = content_db.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_LEVEL_EXP_MODS_REPOSITORY_H #ifndef EQEMU_BASE_LEVEL_EXP_MODS_REPOSITORY_H
@@ -42,6 +59,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("level_exp_mods"); return std::string("level_exp_mods");
@@ -61,7 +93,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -91,11 +123,10 @@ public:
} }
static LevelExpMods FindOne( static LevelExpMods FindOne(
Database& db,
int level_exp_mods_id int level_exp_mods_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -118,11 +149,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int level_exp_mods_id int level_exp_mods_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -135,7 +165,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
LevelExpMods level_exp_mods_entry LevelExpMods level_exp_mods_entry
) )
{ {
@@ -147,7 +176,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(level_exp_mods_entry.exp_mod)); update_values.push_back(columns[1] + " = " + std::to_string(level_exp_mods_entry.exp_mod));
update_values.push_back(columns[2] + " = " + std::to_string(level_exp_mods_entry.aa_exp_mod)); update_values.push_back(columns[2] + " = " + std::to_string(level_exp_mods_entry.aa_exp_mod));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -161,7 +190,6 @@ public:
} }
static LevelExpMods InsertOne( static LevelExpMods InsertOne(
Database& db,
LevelExpMods level_exp_mods_entry LevelExpMods level_exp_mods_entry
) )
{ {
@@ -171,7 +199,7 @@ public:
insert_values.push_back(std::to_string(level_exp_mods_entry.exp_mod)); insert_values.push_back(std::to_string(level_exp_mods_entry.exp_mod));
insert_values.push_back(std::to_string(level_exp_mods_entry.aa_exp_mod)); insert_values.push_back(std::to_string(level_exp_mods_entry.aa_exp_mod));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -190,7 +218,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<LevelExpMods> level_exp_mods_entries std::vector<LevelExpMods> level_exp_mods_entries
) )
{ {
@@ -208,7 +235,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -219,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<LevelExpMods> All(Database& db) static std::vector<LevelExpMods> All()
{ {
std::vector<LevelExpMods> all_entries; std::vector<LevelExpMods> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -245,11 +272,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<LevelExpMods> GetWhere(Database& db, std::string where_filter) static std::vector<LevelExpMods> GetWhere(std::string where_filter)
{ {
std::vector<LevelExpMods> all_entries; std::vector<LevelExpMods> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -272,9 +299,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -285,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()
@@ -1,12 +1,29 @@
/** /**
* DO NOT MODIFY THIS FILE * EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly. * This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base. * Any repository modifications are meant to be made to
* Any modifications to base repositories are to be made by the generator only * the repository extending the base. Any modifications to base repositories are to
* * be made by the generator only
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/ */
#ifndef EQEMU_BASE_LFGUILD_REPOSITORY_H #ifndef EQEMU_BASE_LFGUILD_REPOSITORY_H
@@ -54,6 +71,21 @@ public:
return std::string(implode(", ", Columns())); return std::string(implode(", ", Columns()));
} }
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName() static std::string TableName()
{ {
return std::string("lfguild"); return std::string("lfguild");
@@ -73,7 +105,7 @@ public:
return fmt::format( return fmt::format(
"INSERT INTO {} ({}) ", "INSERT INTO {} ({}) ",
TableName(), TableName(),
ColumnsRaw() InsertColumnsRaw()
); );
} }
@@ -109,11 +141,10 @@ public:
} }
static Lfguild FindOne( static Lfguild FindOne(
Database& db,
int lfguild_id int lfguild_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE id = {} LIMIT 1", "{} WHERE id = {} LIMIT 1",
BaseSelect(), BaseSelect(),
@@ -142,11 +173,10 @@ public:
} }
static int DeleteOne( static int DeleteOne(
Database& db,
int lfguild_id int lfguild_id
) )
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {} = {}", "DELETE FROM {} WHERE {} = {}",
TableName(), TableName(),
@@ -159,7 +189,6 @@ public:
} }
static int UpdateOne( static int UpdateOne(
Database& db,
Lfguild lfguild_entry Lfguild lfguild_entry
) )
{ {
@@ -177,7 +206,7 @@ public:
update_values.push_back(columns[7] + " = " + std::to_string(lfguild_entry.timezone)); update_values.push_back(columns[7] + " = " + std::to_string(lfguild_entry.timezone));
update_values.push_back(columns[8] + " = " + std::to_string(lfguild_entry.timeposted)); update_values.push_back(columns[8] + " = " + std::to_string(lfguild_entry.timeposted));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"UPDATE {} SET {} WHERE {} = {}", "UPDATE {} SET {} WHERE {} = {}",
TableName(), TableName(),
@@ -191,7 +220,6 @@ public:
} }
static Lfguild InsertOne( static Lfguild InsertOne(
Database& db,
Lfguild lfguild_entry Lfguild lfguild_entry
) )
{ {
@@ -207,7 +235,7 @@ public:
insert_values.push_back(std::to_string(lfguild_entry.timezone)); insert_values.push_back(std::to_string(lfguild_entry.timezone));
insert_values.push_back(std::to_string(lfguild_entry.timeposted)); insert_values.push_back(std::to_string(lfguild_entry.timeposted));
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES ({})", "{} VALUES ({})",
BaseInsert(), BaseInsert(),
@@ -226,7 +254,6 @@ public:
} }
static int InsertMany( static int InsertMany(
Database& db,
std::vector<Lfguild> lfguild_entries std::vector<Lfguild> lfguild_entries
) )
{ {
@@ -250,7 +277,7 @@ public:
std::vector<std::string> insert_values; std::vector<std::string> insert_values;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} VALUES {}", "{} VALUES {}",
BaseInsert(), BaseInsert(),
@@ -261,11 +288,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static std::vector<Lfguild> All(Database& db) static std::vector<Lfguild> All()
{ {
std::vector<Lfguild> all_entries; std::vector<Lfguild> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{}", "{}",
BaseSelect() BaseSelect()
@@ -293,11 +320,11 @@ public:
return all_entries; return all_entries;
} }
static std::vector<Lfguild> GetWhere(Database& db, std::string where_filter) static std::vector<Lfguild> GetWhere(std::string where_filter)
{ {
std::vector<Lfguild> all_entries; std::vector<Lfguild> all_entries;
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"{} WHERE {}", "{} WHERE {}",
BaseSelect(), BaseSelect(),
@@ -326,9 +353,9 @@ public:
return all_entries; return all_entries;
} }
static int DeleteWhere(Database& db, std::string where_filter) static int DeleteWhere(std::string where_filter)
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"DELETE FROM {} WHERE {}", "DELETE FROM {} WHERE {}",
TableName(), TableName(),
@@ -339,9 +366,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0); return (results.Success() ? results.RowsAffected() : 0);
} }
static int Truncate(Database& db) static int Truncate()
{ {
auto results = db.QueryDatabase( auto results = database.QueryDatabase(
fmt::format( fmt::format(
"TRUNCATE TABLE {}", "TRUNCATE TABLE {}",
TableName() TableName()

Some files were not shown because too many files have changed in this diff Show More