mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-01 06:01:38 +00:00
[Repositories] Insert repository improvements (#1236)
* Insert repository improvements * Remove no longer necessary code, remove license banner since we have a license at the repo level * Update template comments
This commit is contained in:
@@ -1,29 +1,12 @@
|
||||
/**
|
||||
* EQEmulator: Everquest Server Emulator
|
||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
||||
* DO NOT MODIFY THIS FILE
|
||||
*
|
||||
* 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.
|
||||
* 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
|
||||
* 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_DOORS_REPOSITORY_H
|
||||
@@ -70,6 +53,7 @@ public:
|
||||
int max_expansion;
|
||||
std::string content_flags;
|
||||
std::string content_flags_disabled;
|
||||
int is_instance_door;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -115,6 +99,7 @@ public:
|
||||
"max_expansion",
|
||||
"content_flags",
|
||||
"content_flags_disabled",
|
||||
"is_instance_door",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -123,21 +108,6 @@ public:
|
||||
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()
|
||||
{
|
||||
return std::string("doors");
|
||||
@@ -157,7 +127,7 @@ public:
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
InsertColumnsRaw()
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -200,6 +170,7 @@ public:
|
||||
entry.max_expansion = 0;
|
||||
entry.content_flags = "";
|
||||
entry.content_flags_disabled = "";
|
||||
entry.is_instance_door = 0;
|
||||
|
||||
return entry;
|
||||
}
|
||||
@@ -270,6 +241,7 @@ public:
|
||||
entry.max_expansion = atoi(row[32]);
|
||||
entry.content_flags = row[33] ? row[33] : "";
|
||||
entry.content_flags_disabled = row[34] ? row[34] : "";
|
||||
entry.is_instance_door = atoi(row[35]);
|
||||
|
||||
return entry;
|
||||
}
|
||||
@@ -337,6 +309,7 @@ public:
|
||||
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[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(
|
||||
fmt::format(
|
||||
@@ -358,6 +331,7 @@ public:
|
||||
{
|
||||
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("'" + EscapeString(doors_entry.zone) + "'");
|
||||
insert_values.push_back(std::to_string(doors_entry.version));
|
||||
@@ -392,6 +366,7 @@ public:
|
||||
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_disabled) + "'");
|
||||
insert_values.push_back(std::to_string(doors_entry.is_instance_door));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -421,6 +396,7 @@ public:
|
||||
for (auto &doors_entry: doors_entries) {
|
||||
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("'" + EscapeString(doors_entry.zone) + "'");
|
||||
insert_values.push_back(std::to_string(doors_entry.version));
|
||||
@@ -455,6 +431,7 @@ public:
|
||||
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_disabled) + "'");
|
||||
insert_values.push_back(std::to_string(doors_entry.is_instance_door));
|
||||
|
||||
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
|
||||
}
|
||||
@@ -523,6 +500,7 @@ public:
|
||||
entry.max_expansion = atoi(row[32]);
|
||||
entry.content_flags = row[33] ? row[33] : "";
|
||||
entry.content_flags_disabled = row[34] ? row[34] : "";
|
||||
entry.is_instance_door = atoi(row[35]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
@@ -582,6 +560,7 @@ public:
|
||||
entry.max_expansion = atoi(row[32]);
|
||||
entry.content_flags = row[33] ? row[33] : "";
|
||||
entry.content_flags_disabled = row[34] ? row[34] : "";
|
||||
entry.is_instance_door = atoi(row[35]);
|
||||
|
||||
all_entries.push_back(entry);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user