diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c8faa32dc..5d9fe9e35a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [22.43.1] - 1/14/2024 + +### Repositories + +* Revert #3976 - fix character corpses @Akkadius 2024-01-14 + ## [22.43.0] - 1/14/2024 ### Database diff --git a/common/repositories/base/base_account_repository.h b/common/repositories/base/base_account_repository.h index 96632cae73..4e7797b504 100644 --- a/common/repositories/base/base_account_repository.h +++ b/common/repositories/base/base_account_repository.h @@ -280,7 +280,7 @@ class BaseAccountRepository { v.push_back(columns[14] + " = '" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(columns[15] + " = " + std::to_string(e.hideme)); v.push_back(columns[16] + " = " + std::to_string(e.rulesflag)); - v.push_back(columns[17] + " = FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[17] + " = FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); v.push_back(columns[18] + " = " + std::to_string(e.time_creation)); v.push_back(columns[19] + " = '" + Strings::Escape(e.ban_reason) + "'"); v.push_back(columns[20] + " = '" + Strings::Escape(e.suspend_reason) + "'"); @@ -325,7 +325,7 @@ class BaseAccountRepository { v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(std::to_string(e.hideme)); v.push_back(std::to_string(e.rulesflag)); - v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); v.push_back(std::to_string(e.time_creation)); v.push_back("'" + Strings::Escape(e.ban_reason) + "'"); v.push_back("'" + Strings::Escape(e.suspend_reason) + "'"); @@ -378,7 +378,7 @@ class BaseAccountRepository { v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(std::to_string(e.hideme)); v.push_back(std::to_string(e.rulesflag)); - v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); v.push_back(std::to_string(e.time_creation)); v.push_back("'" + Strings::Escape(e.ban_reason) + "'"); v.push_back("'" + Strings::Escape(e.suspend_reason) + "'"); @@ -581,7 +581,7 @@ class BaseAccountRepository { v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(std::to_string(e.hideme)); v.push_back(std::to_string(e.rulesflag)); - v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); v.push_back(std::to_string(e.time_creation)); v.push_back("'" + Strings::Escape(e.ban_reason) + "'"); v.push_back("'" + Strings::Escape(e.suspend_reason) + "'"); @@ -627,7 +627,7 @@ class BaseAccountRepository { v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(std::to_string(e.hideme)); v.push_back(std::to_string(e.rulesflag)); - v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); v.push_back(std::to_string(e.time_creation)); v.push_back("'" + Strings::Escape(e.ban_reason) + "'"); v.push_back("'" + Strings::Escape(e.suspend_reason) + "'"); diff --git a/common/repositories/base/base_bug_reports_repository.h b/common/repositories/base/base_bug_reports_repository.h index 3f8dc7ff35..41f22bd4e8 100644 --- a/common/repositories/base/base_bug_reports_repository.h +++ b/common/repositories/base/base_bug_reports_repository.h @@ -330,9 +330,9 @@ class BaseBugReportsRepository { v.push_back(columns[24] + " = " + std::to_string(e._unknown_value)); v.push_back(columns[25] + " = '" + Strings::Escape(e.bug_report) + "'"); v.push_back(columns[26] + " = '" + Strings::Escape(e.system_info) + "'"); - v.push_back(columns[27] + " = FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[27] + " = FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); v.push_back(columns[28] + " = " + std::to_string(e.bug_status)); - v.push_back(columns[29] + " = FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[29] + " = FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); v.push_back(columns[30] + " = '" + Strings::Escape(e.last_reviewer) + "'"); v.push_back(columns[31] + " = '" + Strings::Escape(e.reviewer_notes) + "'"); @@ -383,9 +383,9 @@ class BaseBugReportsRepository { v.push_back(std::to_string(e._unknown_value)); v.push_back("'" + Strings::Escape(e.bug_report) + "'"); v.push_back("'" + Strings::Escape(e.system_info) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); v.push_back(std::to_string(e.bug_status)); - v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); v.push_back("'" + Strings::Escape(e.last_reviewer) + "'"); v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'"); @@ -444,9 +444,9 @@ class BaseBugReportsRepository { v.push_back(std::to_string(e._unknown_value)); v.push_back("'" + Strings::Escape(e.bug_report) + "'"); v.push_back("'" + Strings::Escape(e.system_info) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); v.push_back(std::to_string(e.bug_status)); - v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); v.push_back("'" + Strings::Escape(e.last_reviewer) + "'"); v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'"); @@ -671,9 +671,9 @@ class BaseBugReportsRepository { v.push_back(std::to_string(e._unknown_value)); v.push_back("'" + Strings::Escape(e.bug_report) + "'"); v.push_back("'" + Strings::Escape(e.system_info) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); v.push_back(std::to_string(e.bug_status)); - v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); v.push_back("'" + Strings::Escape(e.last_reviewer) + "'"); v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'"); @@ -725,9 +725,9 @@ class BaseBugReportsRepository { v.push_back(std::to_string(e._unknown_value)); v.push_back("'" + Strings::Escape(e.bug_report) + "'"); v.push_back("'" + Strings::Escape(e.system_info) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")"); v.push_back(std::to_string(e.bug_status)); - v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")"); v.push_back("'" + Strings::Escape(e.last_reviewer) + "'"); v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'"); diff --git a/common/repositories/base/base_character_corpses_repository.h b/common/repositories/base/base_character_corpses_repository.h index bbd1265b6f..b2cbfe96f8 100644 --- a/common/repositories/base/base_character_corpses_repository.h +++ b/common/repositories/base/base_character_corpses_repository.h @@ -387,7 +387,7 @@ class BaseCharacterCorpsesRepository { v.push_back(columns[6] + " = " + std::to_string(e.y)); v.push_back(columns[7] + " = " + std::to_string(e.z)); v.push_back(columns[8] + " = " + std::to_string(e.heading)); - v.push_back(columns[9] + " = FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[9] + " = FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); v.push_back(columns[10] + " = " + std::to_string(e.guild_consent_id)); v.push_back(columns[11] + " = " + std::to_string(e.is_rezzed)); v.push_back(columns[12] + " = " + std::to_string(e.is_buried)); @@ -455,7 +455,7 @@ class BaseCharacterCorpsesRepository { v.push_back(std::to_string(e.y)); v.push_back(std::to_string(e.z)); v.push_back(std::to_string(e.heading)); - v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); v.push_back(std::to_string(e.guild_consent_id)); v.push_back(std::to_string(e.is_rezzed)); v.push_back(std::to_string(e.is_buried)); @@ -531,7 +531,7 @@ class BaseCharacterCorpsesRepository { v.push_back(std::to_string(e.y)); v.push_back(std::to_string(e.z)); v.push_back(std::to_string(e.heading)); - v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); v.push_back(std::to_string(e.guild_consent_id)); v.push_back(std::to_string(e.is_rezzed)); v.push_back(std::to_string(e.is_buried)); @@ -803,7 +803,7 @@ class BaseCharacterCorpsesRepository { v.push_back(std::to_string(e.y)); v.push_back(std::to_string(e.z)); v.push_back(std::to_string(e.heading)); - v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); v.push_back(std::to_string(e.guild_consent_id)); v.push_back(std::to_string(e.is_rezzed)); v.push_back(std::to_string(e.is_buried)); @@ -872,7 +872,7 @@ class BaseCharacterCorpsesRepository { v.push_back(std::to_string(e.y)); v.push_back(std::to_string(e.z)); v.push_back(std::to_string(e.heading)); - v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")"); v.push_back(std::to_string(e.guild_consent_id)); v.push_back(std::to_string(e.is_rezzed)); v.push_back(std::to_string(e.is_buried)); diff --git a/common/repositories/base/base_character_data_repository.h b/common/repositories/base/base_character_data_repository.h index 196547563d..4d11814077 100644 --- a/common/repositories/base/base_character_data_repository.h +++ b/common/repositories/base/base_character_data_repository.h @@ -760,7 +760,7 @@ class BaseCharacterDataRepository { v.push_back(columns[99] + " = " + std::to_string(e.aa_points_spent_old)); v.push_back(columns[100] + " = " + std::to_string(e.aa_points_old)); v.push_back(columns[101] + " = " + std::to_string(e.e_last_invsnapshot)); - v.push_back(columns[102] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[102] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -884,7 +884,7 @@ class BaseCharacterDataRepository { v.push_back(std::to_string(e.aa_points_spent_old)); v.push_back(std::to_string(e.aa_points_old)); v.push_back(std::to_string(e.e_last_invsnapshot)); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -1016,7 +1016,7 @@ class BaseCharacterDataRepository { v.push_back(std::to_string(e.aa_points_spent_old)); v.push_back(std::to_string(e.aa_points_old)); v.push_back(std::to_string(e.e_last_invsnapshot)); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -1456,7 +1456,7 @@ class BaseCharacterDataRepository { v.push_back(std::to_string(e.aa_points_spent_old)); v.push_back(std::to_string(e.aa_points_old)); v.push_back(std::to_string(e.e_last_invsnapshot)); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -1581,7 +1581,7 @@ class BaseCharacterDataRepository { v.push_back(std::to_string(e.aa_points_spent_old)); v.push_back(std::to_string(e.aa_points_old)); v.push_back(std::to_string(e.e_last_invsnapshot)); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_character_expedition_lockouts_repository.h b/common/repositories/base/base_character_expedition_lockouts_repository.h index 60d181f5c4..35d34502a6 100644 --- a/common/repositories/base/base_character_expedition_lockouts_repository.h +++ b/common/repositories/base/base_character_expedition_lockouts_repository.h @@ -182,7 +182,7 @@ class BaseCharacterExpeditionLockoutsRepository { v.push_back(columns[1] + " = " + std::to_string(e.character_id)); v.push_back(columns[2] + " = '" + Strings::Escape(e.expedition_name) + "'"); v.push_back(columns[3] + " = '" + Strings::Escape(e.event_name) + "'"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(columns[5] + " = " + std::to_string(e.duration)); v.push_back(columns[6] + " = '" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -210,7 +210,7 @@ class BaseCharacterExpeditionLockoutsRepository { v.push_back(std::to_string(e.character_id)); v.push_back("'" + Strings::Escape(e.expedition_name) + "'"); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -246,7 +246,7 @@ class BaseCharacterExpeditionLockoutsRepository { v.push_back(std::to_string(e.character_id)); v.push_back("'" + Strings::Escape(e.expedition_name) + "'"); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -398,7 +398,7 @@ class BaseCharacterExpeditionLockoutsRepository { v.push_back(std::to_string(e.character_id)); v.push_back("'" + Strings::Escape(e.expedition_name) + "'"); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -427,7 +427,7 @@ class BaseCharacterExpeditionLockoutsRepository { v.push_back(std::to_string(e.character_id)); v.push_back("'" + Strings::Escape(e.expedition_name) + "'"); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); diff --git a/common/repositories/base/base_character_stats_record_repository.h b/common/repositories/base/base_character_stats_record_repository.h index 20d698f4b4..d4bd8d041f 100644 --- a/common/repositories/base/base_character_stats_record_repository.h +++ b/common/repositories/base/base_character_stats_record_repository.h @@ -586,8 +586,8 @@ class BaseCharacterStatsRecordRepository { v.push_back(columns[69] + " = " + std::to_string(e.alcohol)); v.push_back(columns[70] + " = " + std::to_string(e.fishing)); v.push_back(columns[71] + " = " + std::to_string(e.tinkering)); - v.push_back(columns[72] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[73] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[72] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back(columns[73] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -681,8 +681,8 @@ class BaseCharacterStatsRecordRepository { v.push_back(std::to_string(e.alcohol)); v.push_back(std::to_string(e.fishing)); v.push_back(std::to_string(e.tinkering)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -784,8 +784,8 @@ class BaseCharacterStatsRecordRepository { v.push_back(std::to_string(e.alcohol)); v.push_back(std::to_string(e.fishing)); v.push_back(std::to_string(e.tinkering)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -1137,8 +1137,8 @@ class BaseCharacterStatsRecordRepository { v.push_back(std::to_string(e.alcohol)); v.push_back(std::to_string(e.fishing)); v.push_back(std::to_string(e.tinkering)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -1233,8 +1233,8 @@ class BaseCharacterStatsRecordRepository { v.push_back(std::to_string(e.alcohol)); v.push_back(std::to_string(e.fishing)); v.push_back(std::to_string(e.tinkering)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_character_task_timers_repository.h b/common/repositories/base/base_character_task_timers_repository.h index ae23a88ba1..60240a8a42 100644 --- a/common/repositories/base/base_character_task_timers_repository.h +++ b/common/repositories/base/base_character_task_timers_repository.h @@ -178,7 +178,7 @@ class BaseCharacterTaskTimersRepository { v.push_back(columns[2] + " = " + std::to_string(e.task_id)); v.push_back(columns[3] + " = " + std::to_string(e.timer_type)); v.push_back(columns[4] + " = " + std::to_string(e.timer_group)); - v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -205,7 +205,7 @@ class BaseCharacterTaskTimersRepository { v.push_back(std::to_string(e.task_id)); v.push_back(std::to_string(e.timer_type)); v.push_back(std::to_string(e.timer_group)); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -240,7 +240,7 @@ class BaseCharacterTaskTimersRepository { v.push_back(std::to_string(e.task_id)); v.push_back(std::to_string(e.timer_type)); v.push_back(std::to_string(e.timer_group)); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -389,7 +389,7 @@ class BaseCharacterTaskTimersRepository { v.push_back(std::to_string(e.task_id)); v.push_back(std::to_string(e.timer_type)); v.push_back(std::to_string(e.timer_group)); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -417,7 +417,7 @@ class BaseCharacterTaskTimersRepository { v.push_back(std::to_string(e.task_id)); v.push_back(std::to_string(e.timer_type)); v.push_back(std::to_string(e.timer_group)); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_completed_shared_task_activity_state_repository.h b/common/repositories/base/base_completed_shared_task_activity_state_repository.h index d596c191c4..9de6c4696b 100644 --- a/common/repositories/base/base_completed_shared_task_activity_state_repository.h +++ b/common/repositories/base/base_completed_shared_task_activity_state_repository.h @@ -172,8 +172,8 @@ class BaseCompletedSharedTaskActivityStateRepository { v.push_back(columns[0] + " = " + std::to_string(e.shared_task_id)); v.push_back(columns[1] + " = " + std::to_string(e.activity_id)); v.push_back(columns[2] + " = " + std::to_string(e.done_count)); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -198,8 +198,8 @@ class BaseCompletedSharedTaskActivityStateRepository { v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -232,8 +232,8 @@ class BaseCompletedSharedTaskActivityStateRepository { v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -378,8 +378,8 @@ class BaseCompletedSharedTaskActivityStateRepository { v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -405,8 +405,8 @@ class BaseCompletedSharedTaskActivityStateRepository { v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_completed_shared_tasks_repository.h b/common/repositories/base/base_completed_shared_tasks_repository.h index a3a580d20b..7ebc6cb07c 100644 --- a/common/repositories/base/base_completed_shared_tasks_repository.h +++ b/common/repositories/base/base_completed_shared_tasks_repository.h @@ -176,9 +176,9 @@ class BaseCompletedSharedTasksRepository { v.push_back(columns[0] + " = " + std::to_string(e.id)); v.push_back(columns[1] + " = " + std::to_string(e.task_id)); - v.push_back(columns[2] + " = FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[2] + " = FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(columns[5] + " = " + std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -203,9 +203,9 @@ class BaseCompletedSharedTasksRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -238,9 +238,9 @@ class BaseCompletedSharedTasksRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(std::to_string(e.is_locked)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); @@ -387,9 +387,9 @@ class BaseCompletedSharedTasksRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -415,9 +415,9 @@ class BaseCompletedSharedTasksRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(std::to_string(e.is_locked)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); diff --git a/common/repositories/base/base_discord_webhooks_repository.h b/common/repositories/base/base_discord_webhooks_repository.h index ba897eed31..90dbf4afec 100644 --- a/common/repositories/base/base_discord_webhooks_repository.h +++ b/common/repositories/base/base_discord_webhooks_repository.h @@ -171,8 +171,8 @@ class BaseDiscordWebhooksRepository { v.push_back(columns[1] + " = '" + Strings::Escape(e.webhook_name) + "'"); v.push_back(columns[2] + " = '" + Strings::Escape(e.webhook_url) + "'"); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -197,8 +197,8 @@ class BaseDiscordWebhooksRepository { v.push_back(std::to_string(e.id)); v.push_back("'" + Strings::Escape(e.webhook_name) + "'"); v.push_back("'" + Strings::Escape(e.webhook_url) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -231,8 +231,8 @@ class BaseDiscordWebhooksRepository { v.push_back(std::to_string(e.id)); v.push_back("'" + Strings::Escape(e.webhook_name) + "'"); v.push_back("'" + Strings::Escape(e.webhook_url) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -377,8 +377,8 @@ class BaseDiscordWebhooksRepository { v.push_back(std::to_string(e.id)); v.push_back("'" + Strings::Escape(e.webhook_name) + "'"); v.push_back("'" + Strings::Escape(e.webhook_url) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -404,8 +404,8 @@ class BaseDiscordWebhooksRepository { v.push_back(std::to_string(e.id)); v.push_back("'" + Strings::Escape(e.webhook_name) + "'"); v.push_back("'" + Strings::Escape(e.webhook_url) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_expedition_lockouts_repository.h b/common/repositories/base/base_expedition_lockouts_repository.h index 2fa70e3298..b4ec21804e 100644 --- a/common/repositories/base/base_expedition_lockouts_repository.h +++ b/common/repositories/base/base_expedition_lockouts_repository.h @@ -176,7 +176,7 @@ class BaseExpeditionLockoutsRepository { v.push_back(columns[1] + " = " + std::to_string(e.expedition_id)); v.push_back(columns[2] + " = '" + Strings::Escape(e.event_name) + "'"); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(columns[4] + " = " + std::to_string(e.duration)); v.push_back(columns[5] + " = '" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -203,7 +203,7 @@ class BaseExpeditionLockoutsRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.expedition_id)); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -238,7 +238,7 @@ class BaseExpeditionLockoutsRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.expedition_id)); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -387,7 +387,7 @@ class BaseExpeditionLockoutsRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.expedition_id)); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); @@ -415,7 +415,7 @@ class BaseExpeditionLockoutsRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.expedition_id)); v.push_back("'" + Strings::Escape(e.event_name) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); v.push_back(std::to_string(e.duration)); v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'"); diff --git a/common/repositories/base/base_items_repository.h b/common/repositories/base/base_items_repository.h index f09af248fa..eb344f4a3b 100644 --- a/common/repositories/base/base_items_repository.h +++ b/common/repositories/base/base_items_repository.h @@ -1703,7 +1703,7 @@ class BaseItemsRepository { v.push_back(columns[131] + " = " + std::to_string(e.UNK124)); v.push_back(columns[132] + " = " + std::to_string(e.attuneable)); v.push_back(columns[133] + " = " + std::to_string(e.nopet)); - v.push_back(columns[134] + " = FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[134] + " = FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); v.push_back(columns[135] + " = '" + Strings::Escape(e.comment) + "'"); v.push_back(columns[136] + " = " + std::to_string(e.UNK127)); v.push_back(columns[137] + " = " + std::to_string(e.pointtype)); @@ -1733,8 +1733,8 @@ class BaseItemsRepository { v.push_back(columns[161] + " = " + std::to_string(e.scrolllevel2)); v.push_back(columns[162] + " = " + std::to_string(e.scrolllevel)); v.push_back(columns[163] + " = " + std::to_string(e.UNK157)); - v.push_back(columns[164] + " = FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[165] + " = FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[164] + " = FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); + v.push_back(columns[165] + " = FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); v.push_back(columns[166] + " = '" + Strings::Escape(e.serialization) + "'"); v.push_back(columns[167] + " = '" + Strings::Escape(e.source) + "'"); v.push_back(columns[168] + " = " + std::to_string(e.UNK033)); @@ -2009,7 +2009,7 @@ class BaseItemsRepository { v.push_back(std::to_string(e.UNK124)); v.push_back(std::to_string(e.attuneable)); v.push_back(std::to_string(e.nopet)); - v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); v.push_back("'" + Strings::Escape(e.comment) + "'"); v.push_back(std::to_string(e.UNK127)); v.push_back(std::to_string(e.pointtype)); @@ -2039,8 +2039,8 @@ class BaseItemsRepository { v.push_back(std::to_string(e.scrolllevel2)); v.push_back(std::to_string(e.scrolllevel)); v.push_back(std::to_string(e.UNK157)); - v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); v.push_back("'" + Strings::Escape(e.serialization) + "'"); v.push_back("'" + Strings::Escape(e.source) + "'"); v.push_back(std::to_string(e.UNK033)); @@ -2323,7 +2323,7 @@ class BaseItemsRepository { v.push_back(std::to_string(e.UNK124)); v.push_back(std::to_string(e.attuneable)); v.push_back(std::to_string(e.nopet)); - v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); v.push_back("'" + Strings::Escape(e.comment) + "'"); v.push_back(std::to_string(e.UNK127)); v.push_back(std::to_string(e.pointtype)); @@ -2353,8 +2353,8 @@ class BaseItemsRepository { v.push_back(std::to_string(e.scrolllevel2)); v.push_back(std::to_string(e.scrolllevel)); v.push_back(std::to_string(e.UNK157)); - v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); v.push_back("'" + Strings::Escape(e.serialization) + "'"); v.push_back("'" + Strings::Escape(e.source) + "'"); v.push_back(std::to_string(e.UNK033)); @@ -3309,7 +3309,7 @@ class BaseItemsRepository { v.push_back(std::to_string(e.UNK124)); v.push_back(std::to_string(e.attuneable)); v.push_back(std::to_string(e.nopet)); - v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); v.push_back("'" + Strings::Escape(e.comment) + "'"); v.push_back(std::to_string(e.UNK127)); v.push_back(std::to_string(e.pointtype)); @@ -3339,8 +3339,8 @@ class BaseItemsRepository { v.push_back(std::to_string(e.scrolllevel2)); v.push_back(std::to_string(e.scrolllevel)); v.push_back(std::to_string(e.UNK157)); - v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); v.push_back("'" + Strings::Escape(e.serialization) + "'"); v.push_back("'" + Strings::Escape(e.source) + "'"); v.push_back(std::to_string(e.UNK033)); @@ -3616,7 +3616,7 @@ class BaseItemsRepository { v.push_back(std::to_string(e.UNK124)); v.push_back(std::to_string(e.attuneable)); v.push_back(std::to_string(e.nopet)); - v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated > 0 ? std::to_string(e.updated) : "null") + ")"); v.push_back("'" + Strings::Escape(e.comment) + "'"); v.push_back(std::to_string(e.UNK127)); v.push_back(std::to_string(e.pointtype)); @@ -3646,8 +3646,8 @@ class BaseItemsRepository { v.push_back(std::to_string(e.scrolllevel2)); v.push_back(std::to_string(e.scrolllevel)); v.push_back(std::to_string(e.UNK157)); - v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.serialized > 0 ? std::to_string(e.serialized) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.verified > 0 ? std::to_string(e.verified) : "null") + ")"); v.push_back("'" + Strings::Escape(e.serialization) + "'"); v.push_back("'" + Strings::Escape(e.source) + "'"); v.push_back(std::to_string(e.UNK033)); diff --git a/common/repositories/base/base_login_accounts_repository.h b/common/repositories/base/base_login_accounts_repository.h index dbc4cccbe8..ed7610e4e1 100644 --- a/common/repositories/base/base_login_accounts_repository.h +++ b/common/repositories/base/base_login_accounts_repository.h @@ -195,9 +195,9 @@ class BaseLoginAccountsRepository { v.push_back(columns[3] + " = '" + Strings::Escape(e.account_email) + "'"); v.push_back(columns[4] + " = '" + Strings::Escape(e.source_loginserver) + "'"); v.push_back(columns[5] + " = '" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[7] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[8] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back(columns[7] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back(columns[8] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -225,9 +225,9 @@ class BaseLoginAccountsRepository { v.push_back("'" + Strings::Escape(e.account_email) + "'"); v.push_back("'" + Strings::Escape(e.source_loginserver) + "'"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -263,9 +263,9 @@ class BaseLoginAccountsRepository { v.push_back("'" + Strings::Escape(e.account_email) + "'"); v.push_back("'" + Strings::Escape(e.source_loginserver) + "'"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -421,9 +421,9 @@ class BaseLoginAccountsRepository { v.push_back("'" + Strings::Escape(e.account_email) + "'"); v.push_back("'" + Strings::Escape(e.source_loginserver) + "'"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -452,9 +452,9 @@ class BaseLoginAccountsRepository { v.push_back("'" + Strings::Escape(e.account_email) + "'"); v.push_back("'" + Strings::Escape(e.source_loginserver) + "'"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_login_api_tokens_repository.h b/common/repositories/base/base_login_api_tokens_repository.h index 82239dba1c..b7ad51f9ad 100644 --- a/common/repositories/base/base_login_api_tokens_repository.h +++ b/common/repositories/base/base_login_api_tokens_repository.h @@ -177,8 +177,8 @@ class BaseLoginApiTokensRepository { v.push_back(columns[1] + " = '" + Strings::Escape(e.token) + "'"); v.push_back(columns[2] + " = " + std::to_string(e.can_write)); v.push_back(columns[3] + " = " + std::to_string(e.can_read)); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -204,8 +204,8 @@ class BaseLoginApiTokensRepository { v.push_back("'" + Strings::Escape(e.token) + "'"); v.push_back(std::to_string(e.can_write)); v.push_back(std::to_string(e.can_read)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -239,8 +239,8 @@ class BaseLoginApiTokensRepository { v.push_back("'" + Strings::Escape(e.token) + "'"); v.push_back(std::to_string(e.can_write)); v.push_back(std::to_string(e.can_read)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -388,8 +388,8 @@ class BaseLoginApiTokensRepository { v.push_back("'" + Strings::Escape(e.token) + "'"); v.push_back(std::to_string(e.can_write)); v.push_back(std::to_string(e.can_read)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -416,8 +416,8 @@ class BaseLoginApiTokensRepository { v.push_back("'" + Strings::Escape(e.token) + "'"); v.push_back(std::to_string(e.can_write)); v.push_back(std::to_string(e.can_read)); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_login_server_admins_repository.h b/common/repositories/base/base_login_server_admins_repository.h index 06342c8fe5..2ec6237c2e 100644 --- a/common/repositories/base/base_login_server_admins_repository.h +++ b/common/repositories/base/base_login_server_admins_repository.h @@ -189,7 +189,7 @@ class BaseLoginServerAdminsRepository { v.push_back(columns[3] + " = '" + Strings::Escape(e.first_name) + "'"); v.push_back(columns[4] + " = '" + Strings::Escape(e.last_name) + "'"); v.push_back(columns[5] + " = '" + Strings::Escape(e.email) + "'"); - v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[6] + " = FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); v.push_back(columns[7] + " = '" + Strings::Escape(e.registration_ip_address) + "'"); auto results = db.QueryDatabase( @@ -218,7 +218,7 @@ class BaseLoginServerAdminsRepository { v.push_back("'" + Strings::Escape(e.first_name) + "'"); v.push_back("'" + Strings::Escape(e.last_name) + "'"); v.push_back("'" + Strings::Escape(e.email) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); v.push_back("'" + Strings::Escape(e.registration_ip_address) + "'"); auto results = db.QueryDatabase( @@ -255,7 +255,7 @@ class BaseLoginServerAdminsRepository { v.push_back("'" + Strings::Escape(e.first_name) + "'"); v.push_back("'" + Strings::Escape(e.last_name) + "'"); v.push_back("'" + Strings::Escape(e.email) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); v.push_back("'" + Strings::Escape(e.registration_ip_address) + "'"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); @@ -410,7 +410,7 @@ class BaseLoginServerAdminsRepository { v.push_back("'" + Strings::Escape(e.first_name) + "'"); v.push_back("'" + Strings::Escape(e.last_name) + "'"); v.push_back("'" + Strings::Escape(e.email) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); v.push_back("'" + Strings::Escape(e.registration_ip_address) + "'"); auto results = db.QueryDatabase( @@ -440,7 +440,7 @@ class BaseLoginServerAdminsRepository { v.push_back("'" + Strings::Escape(e.first_name) + "'"); v.push_back("'" + Strings::Escape(e.last_name) + "'"); v.push_back("'" + Strings::Escape(e.email) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.registration_date > 0 ? std::to_string(e.registration_date) : "null") + ")"); v.push_back("'" + Strings::Escape(e.registration_ip_address) + "'"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); diff --git a/common/repositories/base/base_login_world_servers_repository.h b/common/repositories/base/base_login_world_servers_repository.h index d8107936ef..b4112ac8cf 100644 --- a/common/repositories/base/base_login_world_servers_repository.h +++ b/common/repositories/base/base_login_world_servers_repository.h @@ -198,7 +198,7 @@ class BaseLoginWorldServersRepository { v.push_back(columns[2] + " = '" + Strings::Escape(e.short_name) + "'"); v.push_back(columns[3] + " = '" + Strings::Escape(e.tag_description) + "'"); v.push_back(columns[4] + " = " + std::to_string(e.login_server_list_type_id)); - v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); v.push_back(columns[6] + " = '" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(columns[7] + " = " + std::to_string(e.login_server_admin_id)); v.push_back(columns[8] + " = " + std::to_string(e.is_server_trusted)); @@ -229,7 +229,7 @@ class BaseLoginWorldServersRepository { v.push_back("'" + Strings::Escape(e.short_name) + "'"); v.push_back("'" + Strings::Escape(e.tag_description) + "'"); v.push_back(std::to_string(e.login_server_list_type_id)); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(std::to_string(e.login_server_admin_id)); v.push_back(std::to_string(e.is_server_trusted)); @@ -268,7 +268,7 @@ class BaseLoginWorldServersRepository { v.push_back("'" + Strings::Escape(e.short_name) + "'"); v.push_back("'" + Strings::Escape(e.tag_description) + "'"); v.push_back(std::to_string(e.login_server_list_type_id)); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(std::to_string(e.login_server_admin_id)); v.push_back(std::to_string(e.is_server_trusted)); @@ -429,7 +429,7 @@ class BaseLoginWorldServersRepository { v.push_back("'" + Strings::Escape(e.short_name) + "'"); v.push_back("'" + Strings::Escape(e.tag_description) + "'"); v.push_back(std::to_string(e.login_server_list_type_id)); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(std::to_string(e.login_server_admin_id)); v.push_back(std::to_string(e.is_server_trusted)); @@ -461,7 +461,7 @@ class BaseLoginWorldServersRepository { v.push_back("'" + Strings::Escape(e.short_name) + "'"); v.push_back("'" + Strings::Escape(e.tag_description) + "'"); v.push_back(std::to_string(e.login_server_list_type_id)); - v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.last_login_date > 0 ? std::to_string(e.last_login_date) : "null") + ")"); v.push_back("'" + Strings::Escape(e.last_ip_address) + "'"); v.push_back(std::to_string(e.login_server_admin_id)); v.push_back(std::to_string(e.is_server_trusted)); diff --git a/common/repositories/base/base_object_contents_repository.h b/common/repositories/base/base_object_contents_repository.h index d27a148ec5..e4198efb38 100644 --- a/common/repositories/base/base_object_contents_repository.h +++ b/common/repositories/base/base_object_contents_repository.h @@ -209,7 +209,7 @@ class BaseObjectContentsRepository { v.push_back(columns[2] + " = " + std::to_string(e.bagidx)); v.push_back(columns[3] + " = " + std::to_string(e.itemid)); v.push_back(columns[4] + " = " + std::to_string(e.charges)); - v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[5] + " = FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); v.push_back(columns[6] + " = " + std::to_string(e.augslot1)); v.push_back(columns[7] + " = " + std::to_string(e.augslot2)); v.push_back(columns[8] + " = " + std::to_string(e.augslot3)); @@ -242,7 +242,7 @@ class BaseObjectContentsRepository { v.push_back(std::to_string(e.bagidx)); v.push_back(std::to_string(e.itemid)); v.push_back(std::to_string(e.charges)); - v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); v.push_back(std::to_string(e.augslot1)); v.push_back(std::to_string(e.augslot2)); v.push_back(std::to_string(e.augslot3)); @@ -283,7 +283,7 @@ class BaseObjectContentsRepository { v.push_back(std::to_string(e.bagidx)); v.push_back(std::to_string(e.itemid)); v.push_back(std::to_string(e.charges)); - v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); v.push_back(std::to_string(e.augslot1)); v.push_back(std::to_string(e.augslot2)); v.push_back(std::to_string(e.augslot3)); @@ -450,7 +450,7 @@ class BaseObjectContentsRepository { v.push_back(std::to_string(e.bagidx)); v.push_back(std::to_string(e.itemid)); v.push_back(std::to_string(e.charges)); - v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); v.push_back(std::to_string(e.augslot1)); v.push_back(std::to_string(e.augslot2)); v.push_back(std::to_string(e.augslot3)); @@ -484,7 +484,7 @@ class BaseObjectContentsRepository { v.push_back(std::to_string(e.bagidx)); v.push_back(std::to_string(e.itemid)); v.push_back(std::to_string(e.charges)); - v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.droptime > 0 ? std::to_string(e.droptime) : "null") + ")"); v.push_back(std::to_string(e.augslot1)); v.push_back(std::to_string(e.augslot2)); v.push_back(std::to_string(e.augslot3)); diff --git a/common/repositories/base/base_player_event_logs_repository.h b/common/repositories/base/base_player_event_logs_repository.h index 6c7d7a8df0..91f0074b14 100644 --- a/common/repositories/base/base_player_event_logs_repository.h +++ b/common/repositories/base/base_player_event_logs_repository.h @@ -241,7 +241,7 @@ class BasePlayerEventLogsRepository { v.push_back(columns[9] + " = " + std::to_string(e.event_type_id)); v.push_back(columns[10] + " = '" + Strings::Escape(e.event_type_name) + "'"); v.push_back(columns[11] + " = '" + Strings::Escape(e.event_data) + "'"); - v.push_back(columns[12] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[12] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -275,7 +275,7 @@ class BasePlayerEventLogsRepository { v.push_back(std::to_string(e.event_type_id)); v.push_back("'" + Strings::Escape(e.event_type_name) + "'"); v.push_back("'" + Strings::Escape(e.event_data) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -317,7 +317,7 @@ class BasePlayerEventLogsRepository { v.push_back(std::to_string(e.event_type_id)); v.push_back("'" + Strings::Escape(e.event_type_name) + "'"); v.push_back("'" + Strings::Escape(e.event_data) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -487,7 +487,7 @@ class BasePlayerEventLogsRepository { v.push_back(std::to_string(e.event_type_id)); v.push_back("'" + Strings::Escape(e.event_type_name) + "'"); v.push_back("'" + Strings::Escape(e.event_data) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -522,7 +522,7 @@ class BasePlayerEventLogsRepository { v.push_back(std::to_string(e.event_type_id)); v.push_back("'" + Strings::Escape(e.event_type_name) + "'"); v.push_back("'" + Strings::Escape(e.event_data) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_server_scheduled_events_repository.h b/common/repositories/base/base_server_scheduled_events_repository.h index 3bca211ddd..d6793bb24b 100644 --- a/common/repositories/base/base_server_scheduled_events_repository.h +++ b/common/repositories/base/base_server_scheduled_events_repository.h @@ -243,8 +243,8 @@ class BaseServerScheduledEventsRepository { v.push_back(columns[12] + " = " + std::to_string(e.month_end)); v.push_back(columns[13] + " = " + std::to_string(e.year_end)); v.push_back(columns[14] + " = '" + Strings::Escape(e.cron_expression) + "'"); - v.push_back(columns[15] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[16] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[15] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back(columns[16] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -281,8 +281,8 @@ class BaseServerScheduledEventsRepository { v.push_back(std::to_string(e.month_end)); v.push_back(std::to_string(e.year_end)); v.push_back("'" + Strings::Escape(e.cron_expression) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -327,8 +327,8 @@ class BaseServerScheduledEventsRepository { v.push_back(std::to_string(e.month_end)); v.push_back(std::to_string(e.year_end)); v.push_back("'" + Strings::Escape(e.cron_expression) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -509,8 +509,8 @@ class BaseServerScheduledEventsRepository { v.push_back(std::to_string(e.month_end)); v.push_back(std::to_string(e.year_end)); v.push_back("'" + Strings::Escape(e.cron_expression) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -548,8 +548,8 @@ class BaseServerScheduledEventsRepository { v.push_back(std::to_string(e.month_end)); v.push_back(std::to_string(e.year_end)); v.push_back("'" + Strings::Escape(e.cron_expression) + "'"); - v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_shared_task_activity_state_repository.h b/common/repositories/base/base_shared_task_activity_state_repository.h index e10b7d333b..aaad53b66a 100644 --- a/common/repositories/base/base_shared_task_activity_state_repository.h +++ b/common/repositories/base/base_shared_task_activity_state_repository.h @@ -172,8 +172,8 @@ class BaseSharedTaskActivityStateRepository { v.push_back(columns[0] + " = " + std::to_string(e.shared_task_id)); v.push_back(columns[1] + " = " + std::to_string(e.activity_id)); v.push_back(columns[2] + " = " + std::to_string(e.done_count)); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -198,8 +198,8 @@ class BaseSharedTaskActivityStateRepository { v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -232,8 +232,8 @@ class BaseSharedTaskActivityStateRepository { v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -378,8 +378,8 @@ class BaseSharedTaskActivityStateRepository { v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -405,8 +405,8 @@ class BaseSharedTaskActivityStateRepository { v.push_back(std::to_string(e.shared_task_id)); v.push_back(std::to_string(e.activity_id)); v.push_back(std::to_string(e.done_count)); - v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.updated_time > 0 ? std::to_string(e.updated_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completed_time > 0 ? std::to_string(e.completed_time) : "null") + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_shared_tasks_repository.h b/common/repositories/base/base_shared_tasks_repository.h index 4d9956ffc7..85b9194022 100644 --- a/common/repositories/base/base_shared_tasks_repository.h +++ b/common/repositories/base/base_shared_tasks_repository.h @@ -175,9 +175,9 @@ class BaseSharedTasksRepository { auto columns = Columns(); v.push_back(columns[1] + " = " + std::to_string(e.task_id)); - v.push_back(columns[2] + " = FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back(columns[2] + " = FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(columns[5] + " = " + std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -202,9 +202,9 @@ class BaseSharedTasksRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -237,9 +237,9 @@ class BaseSharedTasksRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(std::to_string(e.is_locked)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); @@ -386,9 +386,9 @@ class BaseSharedTasksRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(std::to_string(e.is_locked)); auto results = db.QueryDatabase( @@ -414,9 +414,9 @@ class BaseSharedTasksRepository { v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.task_id)); - v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "UNIX_TIMESTAMP()") + ")"); - v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "UNIX_TIMESTAMP()") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.accepted_time > 0 ? std::to_string(e.accepted_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")"); + v.push_back("FROM_UNIXTIME(" + (e.completion_time > 0 ? std::to_string(e.completion_time) : "null") + ")"); v.push_back(std::to_string(e.is_locked)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); diff --git a/common/version.h b/common/version.h index 6c280b970e..d1fc0b8702 100644 --- a/common/version.h +++ b/common/version.h @@ -25,7 +25,7 @@ // Build variables // these get injected during the build pipeline -#define CURRENT_VERSION "22.43.0-dev" // always append -dev to the current version for custom-builds +#define CURRENT_VERSION "22.43.1-dev" // always append -dev to the current version for custom-builds #define LOGIN_VERSION "0.8.0" #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ diff --git a/package.json b/package.json index 724c527834..d51176e09a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eqemu-server", - "version": "22.43.0", + "version": "22.43.1", "repository": { "type": "git", "url": "https://github.com/EQEmu/Server.git" diff --git a/utils/scripts/generators/repository-generator.pl b/utils/scripts/generators/repository-generator.pl index 598c0dac43..b6f10d1492 100644 --- a/utils/scripts/generators/repository-generator.pl +++ b/utils/scripts/generators/repository-generator.pl @@ -294,7 +294,7 @@ $query_value = sprintf('" + std::to_string(e.%s));', $column_name_formatted); } elsif ($data_type =~ /datetime/) { - $query_value = sprintf('FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "UNIX_TIMESTAMP()") + ")");', $column_name_formatted, $column_name_formatted); + $query_value = sprintf('FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "null") + ")");', $column_name_formatted, $column_name_formatted); } $update_one_entries .= sprintf( @@ -310,7 +310,7 @@ $value = sprintf('std::to_string(e.%s)', $column_name_formatted); } elsif ($data_type =~ /datetime/) { - $value = sprintf('"FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "UNIX_TIMESTAMP()") + ")"', $column_name_formatted, $column_name_formatted); + $value = sprintf('"FROM_UNIXTIME(" + (e.%s > 0 ? std::to_string(e.%s) : "null") + ")"', $column_name_formatted, $column_name_formatted); } $insert_one_entries .= sprintf("\t\tv.push_back(%s);\n", $value); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index dfc2ee04d4..adb7320590 100755 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -3791,6 +3791,7 @@ uint32 ZoneDatabase::SaveCharacterCorpse( e.z = position.z; e.heading = position.w; e.guild_consent_id = guild_consent_id; + e.time_of_death = std::time(nullptr); e.is_locked = corpse.locked; e.exp = corpse.exp; e.size = corpse.size;