Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
varqox committed Jun 6, 2024
2 parents 91ebd92 + b9752bb commit 86b80c2
Show file tree
Hide file tree
Showing 55 changed files with 1,332 additions and 412 deletions.
6 changes: 4 additions & 2 deletions subprojects/sim/include/sim/inf_datetime.hh
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public:
}

InfDatetime& set_datetime(CStringView datetime) {
if (is_datetime(datetime)) {
if (is_datetime(datetime.c_str())) {
type = Type::DATE;
date = datetime;
} else {
Expand Down Expand Up @@ -158,7 +158,9 @@ inline InfDatetime inf_timestamp_to_InfDatetime(StringView str) {
} else if (str == "-inf") {
res.set_neg_inf();
} else {
res.set_datetime(from_unsafe{mysql_date(WONT_THROW(str2num<uint64_t>(str).value()))});
res.set_datetime(
from_unsafe{utc_mysql_datetime_from_time_t(WONT_THROW(str2num<uint64_t>(str).value()))}
);
}

return res;
Expand Down
5 changes: 3 additions & 2 deletions subprojects/sim/include/sim/internal_files/internal_file.hh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ inline std::string path_of(decltype(InternalFile::id) id) {
return concat_tostr("internal_files/", id);
}

inline decltype(InternalFile::id)
new_internal_file_id(mysql::Connection& mysql, const std::string& curr_datetime = mysql_date()) {
inline decltype(InternalFile::id) new_internal_file_id(
mysql::Connection& mysql, const std::string& curr_datetime = utc_mysql_datetime()
) {
auto stmt =
mysql.execute(sql::InsertInto("internal_files (created_at)").values("?", curr_datetime));
return stmt.insert_id();
Expand Down
1 change: 1 addition & 0 deletions subprojects/sim/include/sim/jobs/job.hh
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct Job {
uint8_t priority;
Status status;
std::optional<uint64_t> aux_id;
std::optional<uint64_t> aux_id_2;
sql::fields::Blob info;
sql::fields::Blob data;
};
Expand Down
1 change: 1 addition & 0 deletions subprojects/sim/include/sim/jobs/old_job.hh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ struct OldJob {
uint8_t priority;
EnumVal<Status> status;
std::optional<uint64_t> aux_id;
std::optional<uint64_t> aux_id_2;
old_sql_fields::Blob<128> info;
old_sql_fields::Blob<0> data;

Expand Down
4 changes: 2 additions & 2 deletions subprojects/sim/include/sim/old_sql_fields/datetime.hh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public:
constexpr explicit Datetime(T&& str)
: Varbinary([&]() -> decltype(auto) {
auto s = concat_tostr(str);
throw_assert(is_datetime(s));
throw_assert(is_datetime(s.c_str()));
return s;
}()) {}

Expand All @@ -39,7 +39,7 @@ public:
int> = 0>
Datetime& operator=(T&& str) {
auto s = concat_tostr(str);
throw_assert(is_datetime(s));
throw_assert(is_datetime(s.c_str()));
Varbinary::operator=(s);
return *this;
}
Expand Down
4 changes: 2 additions & 2 deletions subprojects/sim/include/sim/sql/fields/datetime.hh
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ public:

explicit Datetime(std::string str)
: Varbinary{[&]() -> decltype(auto) {
throw_assert(is_datetime(str));
throw_assert(is_datetime(str.c_str()));
return std::move(str);
}()} {}

Datetime& operator=(std::string str) {
throw_assert(is_datetime(str));
throw_assert(is_datetime(str.c_str()));
Varbinary::operator=(std::move(str));
return *this;
}
Expand Down
4 changes: 2 additions & 2 deletions subprojects/sim/include/sim/sql/fields/inf_datetime.hh
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ public:

explicit InfDatetime(std::string str)
: Varbinary{[&]() -> decltype(auto) {
throw_assert(is_datetime(str));
throw_assert(is_datetime(str.c_str()));
return std::move(str);
}()} {}

InfDatetime& operator=(std::string str) {
throw_assert(is_datetime(str));
throw_assert(is_datetime(str.c_str()));
Varbinary::operator=(std::move(str));
return *this;
}
Expand Down
Loading

0 comments on commit 86b80c2

Please sign in to comment.