From 9a0913a21aade62dd02ef9e06a7c23daed965b27 Mon Sep 17 00:00:00 2001 From: "Michaut.Francois" Date: Sat, 23 Jan 2021 19:53:46 +0000 Subject: [PATCH 1/6] Added a tagged branch for catch2 (fixes #648) --- dependencies/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 376ede119..7078b1bd3 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -4,6 +4,7 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) FetchContent_Declare( catch2 GIT_REPOSITORY https://github.com/catchorg/Catch2.git + GIT_TAG v2.13.2 ) endif() From 6960914391c368d85c5ca5343b36315ec5f65400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wiktor=20=C5=BBurawik?= Date: Sat, 13 Feb 2021 19:08:47 +0100 Subject: [PATCH 2/6] Ensure that CHECK's expressions are wrapped in parentheses --- dev/statement_serializator.h | 6 ++++++ include/sqlite_orm/sqlite_orm.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/dev/statement_serializator.h b/dev/statement_serializator.h index e43801bac..a50d1c317 100644 --- a/dev/statement_serializator.h +++ b/dev/statement_serializator.h @@ -498,6 +498,9 @@ namespace sqlite_orm { std::string operator()(const statement_type &c, const C &context) const { std::stringstream ss; auto leftString = serialize(c.l, context); + if(context.use_parentheses) { + ss << '('; + } ss << leftString << " " << static_cast(c) << " ( "; for(size_t index = 0; index < c.arg.size(); ++index) { auto &value = c.arg[index]; @@ -507,6 +510,9 @@ namespace sqlite_orm { } } ss << " )"; + if(context.use_parentheses) { + ss << ')'; + } return ss.str(); } }; diff --git a/include/sqlite_orm/sqlite_orm.h b/include/sqlite_orm/sqlite_orm.h index 2567a34f8..22c493422 100644 --- a/include/sqlite_orm/sqlite_orm.h +++ b/include/sqlite_orm/sqlite_orm.h @@ -10048,6 +10048,9 @@ namespace sqlite_orm { std::string operator()(const statement_type &c, const C &context) const { std::stringstream ss; auto leftString = serialize(c.l, context); + if(context.use_parentheses) { + ss << '('; + } ss << leftString << " " << static_cast(c) << " ( "; for(size_t index = 0; index < c.arg.size(); ++index) { auto &value = c.arg[index]; @@ -10057,6 +10060,9 @@ namespace sqlite_orm { } } ss << " )"; + if(context.use_parentheses) { + ss << ')'; + } return ss.str(); } }; From 3bfec0187a037389b011b0a374a741995921a185 Mon Sep 17 00:00:00 2001 From: andrei-datcu Date: Mon, 15 Mar 2021 12:55:41 +0200 Subject: [PATCH 3/6] Use constant references when iterating over ranges in replace_range / insert_range --- include/sqlite_orm/sqlite_orm.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/sqlite_orm/sqlite_orm.h b/include/sqlite_orm/sqlite_orm.h index 22c493422..d42ac9dae 100644 --- a/include/sqlite_orm/sqlite_orm.h +++ b/include/sqlite_orm/sqlite_orm.h @@ -12358,7 +12358,7 @@ namespace sqlite_orm { auto stmt = statement.stmt; sqlite3_reset(stmt); for(auto it = statement.t.range.first; it != statement.t.range.second; ++it) { - auto &o = *it; + const auto &o = *it; tImpl.table.for_each_column([&o, &index, &stmt, db](auto &c) { using column_type = typename std::decay::type; using field_type = typename column_type::field_type; @@ -12399,7 +12399,7 @@ namespace sqlite_orm { auto &tImpl = this->get_impl(); sqlite3_reset(stmt); for(auto it = statement.t.range.first; it != statement.t.range.second; ++it) { - auto &o = *it; + const auto &o = *it; tImpl.table.for_each_column([&o, &index, &stmt, db](auto &c) { if(!c.template has>()) { using column_type = typename std::decay::type; From c4c67d2361122cd2c43e35cd93009d0e105cb5c4 Mon Sep 17 00:00:00 2001 From: andrei-datcu Date: Mon, 15 Mar 2021 13:02:59 +0200 Subject: [PATCH 4/6] Update sqlite_orm.h --- include/sqlite_orm/sqlite_orm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sqlite_orm/sqlite_orm.h b/include/sqlite_orm/sqlite_orm.h index d42ac9dae..45c43a32b 100644 --- a/include/sqlite_orm/sqlite_orm.h +++ b/include/sqlite_orm/sqlite_orm.h @@ -12399,7 +12399,7 @@ namespace sqlite_orm { auto &tImpl = this->get_impl(); sqlite3_reset(stmt); for(auto it = statement.t.range.first; it != statement.t.range.second; ++it) { - const auto &o = *it; + auto &o = *it; tImpl.table.for_each_column([&o, &index, &stmt, db](auto &c) { if(!c.template has>()) { using column_type = typename std::decay::type; From f7b7c9aa605a1af92386a71f42de3a5c9740bd1c Mon Sep 17 00:00:00 2001 From: Yevgeniy Zakharov Date: Mon, 15 Mar 2021 20:15:31 +0600 Subject: [PATCH 5/6] Revert "Use constant references when iterating over ranges in replace_range" --- include/sqlite_orm/sqlite_orm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sqlite_orm/sqlite_orm.h b/include/sqlite_orm/sqlite_orm.h index 45c43a32b..22c493422 100644 --- a/include/sqlite_orm/sqlite_orm.h +++ b/include/sqlite_orm/sqlite_orm.h @@ -12358,7 +12358,7 @@ namespace sqlite_orm { auto stmt = statement.stmt; sqlite3_reset(stmt); for(auto it = statement.t.range.first; it != statement.t.range.second; ++it) { - const auto &o = *it; + auto &o = *it; tImpl.table.for_each_column([&o, &index, &stmt, db](auto &c) { using column_type = typename std::decay::type; using field_type = typename column_type::field_type; From 1c082e12b57805c8a5082f3855c1b3ced7c9450e Mon Sep 17 00:00:00 2001 From: Timothy Strutz Date: Mon, 4 Oct 2021 17:00:45 -0400 Subject: [PATCH 6/6] Added the actual changes back in now that merge appears clean. --- include/sqlite_orm/sqlite_orm.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/sqlite_orm/sqlite_orm.h b/include/sqlite_orm/sqlite_orm.h index 8e47be88f..f47608156 100644 --- a/include/sqlite_orm/sqlite_orm.h +++ b/include/sqlite_orm/sqlite_orm.h @@ -8761,6 +8761,12 @@ namespace sqlite_orm { prepared_statement_t(T t_, sqlite3_stmt* stmt_, connection_ref con_) : prepared_statement_base{stmt_, std::move(con_)}, t(std::move(t_)) {} + + + prepared_statement_t(prepared_statement_t && prepared_stmt) : + prepared_statement_base{prepared_stmt.stmt, std::move(prepared_stmt.con)}, t(std::move(prepared_stmt.t)) { + prepared_stmt.stmt = nullptr; + } }; template @@ -13744,6 +13750,16 @@ namespace sqlite_orm { } public: + + template + std::vector get_table_info() const { + this->assert_mapped_type(); + + auto & tInfo = this->get_impl(); + + return tInfo.table.get_table_info(); + } + template view_t iterate(Args&&... args) { this->assert_mapped_type();