Fix changed temporal type parser calls

This commit is contained in:
Ante Pušić 2024-03-25 09:19:10 +01:00
parent 848212f73e
commit 6f228ad1a1
3 changed files with 7 additions and 7 deletions

View File

@ -1225,7 +1225,7 @@ TypedValue LocalTime(const TypedValue *args, int64_t nargs, const FunctionContex
} }
if (args[0].IsString()) { if (args[0].IsString()) {
const auto &[local_time_parameters, is_extended] = utils::ParseLocalTimeParameters(args[0].ValueString()); const auto &[local_time_parameters, is_extended, _] = utils::ParseLocalTimeParameters(args[0].ValueString());
return TypedValue(utils::LocalTime(local_time_parameters), ctx.memory); return TypedValue(utils::LocalTime(local_time_parameters), ctx.memory);
} }
@ -1252,7 +1252,7 @@ TypedValue LocalDateTime(const TypedValue *args, int64_t nargs, const FunctionCo
} }
if (args[0].IsString()) { if (args[0].IsString()) {
const auto &[date_parameters, local_time_parameters] = ParseLocalDateTimeParameters(args[0].ValueString()); const auto &[date_parameters, local_time_parameters, _] = ParseLocalDateTimeParameters(args[0].ValueString());
return TypedValue(utils::LocalDateTime(date_parameters, local_time_parameters), ctx.memory); return TypedValue(utils::LocalDateTime(date_parameters, local_time_parameters), ctx.memory);
} }

View File

@ -195,7 +195,7 @@ struct mgp_local_time {
static_assert(std::is_nothrow_copy_constructible_v<memgraph::utils::LocalTime>); static_assert(std::is_nothrow_copy_constructible_v<memgraph::utils::LocalTime>);
mgp_local_time(const std::string_view string, memgraph::utils::MemoryResource *memory) mgp_local_time(const std::string_view string, memgraph::utils::MemoryResource *memory)
: memory(memory), local_time(memgraph::utils::ParseLocalTimeParameters(string).first) {} : memory(memory), local_time(memgraph::utils::ParseLocalTimeParameters(string).parameters) {}
mgp_local_time(const mgp_local_time_parameters *parameters, memgraph::utils::MemoryResource *memory) mgp_local_time(const mgp_local_time_parameters *parameters, memgraph::utils::MemoryResource *memory)
: memory(memory), local_time(MapLocalTimeParameters(parameters)) {} : memory(memory), local_time(MapLocalTimeParameters(parameters)) {}
@ -229,7 +229,7 @@ struct mgp_local_time {
}; };
inline memgraph::utils::LocalDateTime CreateLocalDateTimeFromString(const std::string_view string) { inline memgraph::utils::LocalDateTime CreateLocalDateTimeFromString(const std::string_view string) {
const auto &[date_parameters, local_time_parameters] = memgraph::utils::ParseLocalDateTimeParameters(string); const auto &[date_parameters, local_time_parameters, _] = memgraph::utils::ParseLocalDateTimeParameters(string);
return memgraph::utils::LocalDateTime{date_parameters, local_time_parameters}; return memgraph::utils::LocalDateTime{date_parameters, local_time_parameters};
} }

View File

@ -1,4 +1,4 @@
// Copyright 2022 Memgraph Ltd. // Copyright 2024 Memgraph Ltd.
// //
// Use of this software is governed by the Business Source License // Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source // included in the file licenses/BSL.txt; by using this file, you agree to be bound by the terms of the Business Source
@ -127,7 +127,7 @@ void TestLocalTime(mg::Client &client) {
}; };
const auto parse = [](const std::string_view query) { const auto parse = [](const std::string_view query) {
return memgraph::utils::LocalTime(memgraph::utils::ParseLocalTimeParameters(fmt::format("{}", query)).first); return memgraph::utils::LocalTime(memgraph::utils::ParseLocalTimeParameters(fmt::format("{}", query)).parameters);
}; };
const auto str1 = lt(1, 3, 3, 33); const auto str1 = lt(1, 3, 3, 33);
@ -154,7 +154,7 @@ void TestLocalDateTime(mg::Client &client) {
return fmt::format("{:0>2}-{:0>2}-{:0>2}T{:0>2}:{:0>2}:{:0>2}", y, mo, d, h, m, s); return fmt::format("{:0>2}-{:0>2}-{:0>2}T{:0>2}:{:0>2}:{:0>2}", y, mo, d, h, m, s);
}; };
auto parse = [](const std::string_view str) { auto parse = [](const std::string_view str) {
const auto [dt, lt] = memgraph::utils::ParseLocalDateTimeParameters(str); const auto [dt, lt, _] = memgraph::utils::ParseLocalDateTimeParameters(str);
return memgraph::utils::LocalDateTime(dt, lt); return memgraph::utils::LocalDateTime(dt, lt);
}; };
auto ldt_query = [](const std::string_view str) { return fmt::format("\"{}\"", str); }; auto ldt_query = [](const std::string_view str) { return fmt::format("\"{}\"", str); };