From 542f091f2f6fc62be02781d5a75b12a435c220b3 Mon Sep 17 00:00:00 2001 From: vaijns Date: Fri, 6 Dec 2024 20:02:55 +0100 Subject: [PATCH] Support binding a result of type time_of_day with SQLite3 --- include/sqlpp11/sqlite3/bind_result.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/sqlpp11/sqlite3/bind_result.h b/include/sqlpp11/sqlite3/bind_result.h index 5fcee824..95405f18 100644 --- a/include/sqlpp11/sqlite3/bind_result.h +++ b/include/sqlpp11/sqlite3/bind_result.h @@ -204,6 +204,29 @@ namespace sqlpp } } + void _bind_time_of_day_result(size_t index, ::std::chrono::microseconds* value, bool* is_null) + { + if (_handle->debug) + std::cerr << "Sqlite3 debug: binding time_of_day result at index: " << index << std::endl; + + *value = {}; + *is_null = sqlite3_column_type(_handle->sqlite_statement, static_cast(index)) == SQLITE_NULL; + if (*is_null) + { + return; + } + + const auto time_string = + reinterpret_cast(sqlite3_column_text(_handle->sqlite_statement, static_cast(index))); + if (_handle->debug) + std::cerr << "Sqlite3 debug: time string: " << time_string << std::endl; + if (::sqlpp::detail::parse_time_of_day(*value, time_string) == false) + { + if (_handle->debug) + std::cerr << "Sqlite3 debug: invalid time result: " << time_string << std::endl; + } + } + private: bool next_impl() {