mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +00:00
[Repositories] Update repositories (#2040)
This commit is contained in:
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../string_util.h"
|
||||
#include <ctime>
|
||||
|
||||
class BaseDataBucketsRepository {
|
||||
public:
|
||||
@@ -39,11 +40,26 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"key",
|
||||
"value",
|
||||
"expires",
|
||||
};
|
||||
}
|
||||
|
||||
static std::string ColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", Columns()));
|
||||
}
|
||||
|
||||
static std::string SelectColumnsRaw()
|
||||
{
|
||||
return std::string(implode(", ", SelectColumns()));
|
||||
}
|
||||
|
||||
static std::string TableName()
|
||||
{
|
||||
return std::string("data_buckets");
|
||||
@@ -53,7 +69,7 @@ public:
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
ColumnsRaw(),
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
@@ -110,7 +126,7 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
DataBuckets entry{};
|
||||
|
||||
entry.id = strtoll(row[0], NULL, 10);
|
||||
entry.id = strtoll(row[0], nullptr, 10);
|
||||
entry.key = row[1] ? row[1] : "";
|
||||
entry.value = row[2] ? row[2] : "";
|
||||
entry.expires = atoi(row[3]);
|
||||
@@ -241,7 +257,7 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
DataBuckets entry{};
|
||||
|
||||
entry.id = strtoll(row[0], NULL, 10);
|
||||
entry.id = strtoll(row[0], nullptr, 10);
|
||||
entry.key = row[1] ? row[1] : "";
|
||||
entry.value = row[2] ? row[2] : "";
|
||||
entry.expires = atoi(row[3]);
|
||||
@@ -269,7 +285,7 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
DataBuckets entry{};
|
||||
|
||||
entry.id = strtoll(row[0], NULL, 10);
|
||||
entry.id = strtoll(row[0], nullptr, 10);
|
||||
entry.key = row[1] ? row[1] : "";
|
||||
entry.value = row[2] ? row[2] : "";
|
||||
entry.expires = atoi(row[3]);
|
||||
|
||||
Reference in New Issue
Block a user