[Repositories] Fix datetime zero-value save behavior (#3976)

This commit is contained in:
Chris Miles
2024-01-14 00:10:13 -06:00
committed by GitHub
parent e40267b9b8
commit 14509fcc4e
133 changed files with 3647 additions and 3658 deletions
@@ -231,34 +231,34 @@ public:
if (results.RowCount() == 1) {
Object e{};
e.id = static_cast<int32_t>(atoi(row[0]));
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.zoneid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
e.version = static_cast<int16_t>(atoi(row[2]));
e.version = row[2] ? static_cast<int16_t>(atoi(row[2])) : 0;
e.xpos = row[3] ? strtof(row[3], nullptr) : 0;
e.ypos = row[4] ? strtof(row[4], nullptr) : 0;
e.zpos = row[5] ? strtof(row[5], nullptr) : 0;
e.heading = row[6] ? strtof(row[6], nullptr) : 0;
e.itemid = static_cast<int32_t>(atoi(row[7]));
e.itemid = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
e.charges = row[8] ? static_cast<uint16_t>(strtoul(row[8], nullptr, 10)) : 0;
e.objectname = row[9] ? row[9] : "";
e.type = static_cast<int32_t>(atoi(row[10]));
e.icon = static_cast<int32_t>(atoi(row[11]));
e.type = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
e.icon = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
e.size_percentage = row[12] ? strtof(row[12], nullptr) : 0;
e.unknown24 = static_cast<int32_t>(atoi(row[13]));
e.unknown60 = static_cast<int32_t>(atoi(row[14]));
e.unknown64 = static_cast<int32_t>(atoi(row[15]));
e.unknown68 = static_cast<int32_t>(atoi(row[16]));
e.unknown72 = static_cast<int32_t>(atoi(row[17]));
e.unknown76 = static_cast<int32_t>(atoi(row[18]));
e.unknown84 = static_cast<int32_t>(atoi(row[19]));
e.unknown24 = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
e.unknown60 = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
e.unknown64 = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
e.unknown68 = row[16] ? static_cast<int32_t>(atoi(row[16])) : 0;
e.unknown72 = row[17] ? static_cast<int32_t>(atoi(row[17])) : 0;
e.unknown76 = row[18] ? static_cast<int32_t>(atoi(row[18])) : 0;
e.unknown84 = row[19] ? static_cast<int32_t>(atoi(row[19])) : 0;
e.size = row[20] ? strtof(row[20], nullptr) : 100;
e.solid_type = static_cast<int32_t>(atoi(row[21]));
e.incline = static_cast<int32_t>(atoi(row[22]));
e.solid_type = row[21] ? static_cast<int32_t>(atoi(row[21])) : 0;
e.incline = row[22] ? static_cast<int32_t>(atoi(row[22])) : 0;
e.tilt_x = row[23] ? strtof(row[23], nullptr) : 0;
e.tilt_y = row[24] ? strtof(row[24], nullptr) : 0;
e.display_name = row[25] ? row[25] : "";
e.min_expansion = static_cast<int8_t>(atoi(row[26]));
e.max_expansion = static_cast<int8_t>(atoi(row[27]));
e.min_expansion = row[26] ? static_cast<int8_t>(atoi(row[26])) : -1;
e.max_expansion = row[27] ? static_cast<int8_t>(atoi(row[27])) : -1;
e.content_flags = row[28] ? row[28] : "";
e.content_flags_disabled = row[29] ? row[29] : "";
@@ -466,34 +466,34 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
Object e{};
e.id = static_cast<int32_t>(atoi(row[0]));
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.zoneid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
e.version = static_cast<int16_t>(atoi(row[2]));
e.version = row[2] ? static_cast<int16_t>(atoi(row[2])) : 0;
e.xpos = row[3] ? strtof(row[3], nullptr) : 0;
e.ypos = row[4] ? strtof(row[4], nullptr) : 0;
e.zpos = row[5] ? strtof(row[5], nullptr) : 0;
e.heading = row[6] ? strtof(row[6], nullptr) : 0;
e.itemid = static_cast<int32_t>(atoi(row[7]));
e.itemid = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
e.charges = row[8] ? static_cast<uint16_t>(strtoul(row[8], nullptr, 10)) : 0;
e.objectname = row[9] ? row[9] : "";
e.type = static_cast<int32_t>(atoi(row[10]));
e.icon = static_cast<int32_t>(atoi(row[11]));
e.type = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
e.icon = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
e.size_percentage = row[12] ? strtof(row[12], nullptr) : 0;
e.unknown24 = static_cast<int32_t>(atoi(row[13]));
e.unknown60 = static_cast<int32_t>(atoi(row[14]));
e.unknown64 = static_cast<int32_t>(atoi(row[15]));
e.unknown68 = static_cast<int32_t>(atoi(row[16]));
e.unknown72 = static_cast<int32_t>(atoi(row[17]));
e.unknown76 = static_cast<int32_t>(atoi(row[18]));
e.unknown84 = static_cast<int32_t>(atoi(row[19]));
e.unknown24 = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
e.unknown60 = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
e.unknown64 = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
e.unknown68 = row[16] ? static_cast<int32_t>(atoi(row[16])) : 0;
e.unknown72 = row[17] ? static_cast<int32_t>(atoi(row[17])) : 0;
e.unknown76 = row[18] ? static_cast<int32_t>(atoi(row[18])) : 0;
e.unknown84 = row[19] ? static_cast<int32_t>(atoi(row[19])) : 0;
e.size = row[20] ? strtof(row[20], nullptr) : 100;
e.solid_type = static_cast<int32_t>(atoi(row[21]));
e.incline = static_cast<int32_t>(atoi(row[22]));
e.solid_type = row[21] ? static_cast<int32_t>(atoi(row[21])) : 0;
e.incline = row[22] ? static_cast<int32_t>(atoi(row[22])) : 0;
e.tilt_x = row[23] ? strtof(row[23], nullptr) : 0;
e.tilt_y = row[24] ? strtof(row[24], nullptr) : 0;
e.display_name = row[25] ? row[25] : "";
e.min_expansion = static_cast<int8_t>(atoi(row[26]));
e.max_expansion = static_cast<int8_t>(atoi(row[27]));
e.min_expansion = row[26] ? static_cast<int8_t>(atoi(row[26])) : -1;
e.max_expansion = row[27] ? static_cast<int8_t>(atoi(row[27])) : -1;
e.content_flags = row[28] ? row[28] : "";
e.content_flags_disabled = row[29] ? row[29] : "";
@@ -520,34 +520,34 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
Object e{};
e.id = static_cast<int32_t>(atoi(row[0]));
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.zoneid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
e.version = static_cast<int16_t>(atoi(row[2]));
e.version = row[2] ? static_cast<int16_t>(atoi(row[2])) : 0;
e.xpos = row[3] ? strtof(row[3], nullptr) : 0;
e.ypos = row[4] ? strtof(row[4], nullptr) : 0;
e.zpos = row[5] ? strtof(row[5], nullptr) : 0;
e.heading = row[6] ? strtof(row[6], nullptr) : 0;
e.itemid = static_cast<int32_t>(atoi(row[7]));
e.itemid = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
e.charges = row[8] ? static_cast<uint16_t>(strtoul(row[8], nullptr, 10)) : 0;
e.objectname = row[9] ? row[9] : "";
e.type = static_cast<int32_t>(atoi(row[10]));
e.icon = static_cast<int32_t>(atoi(row[11]));
e.type = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
e.icon = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
e.size_percentage = row[12] ? strtof(row[12], nullptr) : 0;
e.unknown24 = static_cast<int32_t>(atoi(row[13]));
e.unknown60 = static_cast<int32_t>(atoi(row[14]));
e.unknown64 = static_cast<int32_t>(atoi(row[15]));
e.unknown68 = static_cast<int32_t>(atoi(row[16]));
e.unknown72 = static_cast<int32_t>(atoi(row[17]));
e.unknown76 = static_cast<int32_t>(atoi(row[18]));
e.unknown84 = static_cast<int32_t>(atoi(row[19]));
e.unknown24 = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
e.unknown60 = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
e.unknown64 = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
e.unknown68 = row[16] ? static_cast<int32_t>(atoi(row[16])) : 0;
e.unknown72 = row[17] ? static_cast<int32_t>(atoi(row[17])) : 0;
e.unknown76 = row[18] ? static_cast<int32_t>(atoi(row[18])) : 0;
e.unknown84 = row[19] ? static_cast<int32_t>(atoi(row[19])) : 0;
e.size = row[20] ? strtof(row[20], nullptr) : 100;
e.solid_type = static_cast<int32_t>(atoi(row[21]));
e.incline = static_cast<int32_t>(atoi(row[22]));
e.solid_type = row[21] ? static_cast<int32_t>(atoi(row[21])) : 0;
e.incline = row[22] ? static_cast<int32_t>(atoi(row[22])) : 0;
e.tilt_x = row[23] ? strtof(row[23], nullptr) : 0;
e.tilt_y = row[24] ? strtof(row[24], nullptr) : 0;
e.display_name = row[25] ? row[25] : "";
e.min_expansion = static_cast<int8_t>(atoi(row[26]));
e.max_expansion = static_cast<int8_t>(atoi(row[27]));
e.min_expansion = row[26] ? static_cast<int8_t>(atoi(row[26])) : -1;
e.max_expansion = row[27] ? static_cast<int8_t>(atoi(row[27])) : -1;
e.content_flags = row[28] ? row[28] : "";
e.content_flags_disabled = row[29] ? row[29] : "";