Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ environment:

- job_name: clang, C++23
appveyor_build_worker_image: Ubuntu2204
CC: clang-18
CXX: clang++-18
CC: clang-20
CXX: clang++-20
SQLITE_ORM_CXX_STANDARD: "-DSQLITE_ORM_ENABLE_CXX_23=ON"
cmake_build_parallel: ""

Expand Down Expand Up @@ -108,7 +108,7 @@ for:
install:
- |-
cd C:\Tools\vcpkg
git fetch --tags && git checkout 2025.04.09
git fetch --tags && git checkout 2025.08.27
cd %APPVEYOR_BUILD_FOLDER%
C:\Tools\vcpkg\bootstrap-vcpkg.bat -disableMetrics
C:\Tools\vcpkg\vcpkg integrate install
Expand Down Expand Up @@ -142,7 +142,7 @@ for:
install:
- |-
pushd $HOME/vcpkg
git fetch --tags && git checkout 2025.04.09
git fetch --tags && git checkout 2025.08.27
popd
$HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
Expand Down Expand Up @@ -170,7 +170,7 @@ for:
# using custom vcpkg triplets for building and linking dynamic dependent libraries
install:
- |-
git clone --depth 1 --branch 2025.04.09 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
git clone --depth 1 --branch 2025.08.27 https://github.com/microsoft/vcpkg.git $HOME/vcpkg
$HOME/vcpkg/bootstrap-vcpkg.sh -disableMetrics
$HOME/vcpkg/vcpkg integrate install --overlay-triplets=vcpkg/triplets
vcpkg install sqlite3[core,dbstat,math,json1,fts5,soundex] catch2 --overlay-triplets=vcpkg/triplets
Expand Down
7 changes: 5 additions & 2 deletions dev/result_set_iterator.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include "column_result_proxy.h"
#include "util.h"

#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
namespace sqlite_orm::internal {

template<class ColResult, class DBOs>
Expand Down Expand Up @@ -71,6 +70,11 @@ namespace sqlite_orm::internal {
friend bool operator==(const result_set_iterator& it, const result_set_sentinel_t&) noexcept {
return sqlite3_data_count(it.stmt.get()) == 0;
}
#ifndef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
friend bool operator!=(const result_set_iterator& it, const result_set_sentinel_t& s) noexcept {
return !(it == s);
}
#endif

private:
void step() {
Expand All @@ -87,4 +91,3 @@ namespace sqlite_orm::internal {
statement_finalizer stmt;
};
}
#endif
6 changes: 2 additions & 4 deletions dev/result_set_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef SQLITE_ORM_IMPORT_STD_MODULE
#include <utility> // std::move, std::remove_cvref
#include <functional> // std::reference_wrapper
#if defined(SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED) && defined(SQLITE_ORM_CPP20_RANGES_SUPPORTED)
#ifdef SQLITE_ORM_CPP20_RANGES_SUPPORTED
#include <ranges> // std::ranges::view_interface
#endif
#endif
Expand All @@ -18,7 +18,6 @@
#include "type_traits.h"
#include "storage_lookup.h"

#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
namespace sqlite_orm::internal {
/*
* A C++ view over a result set of a select statement, returned by `storage_t::iterate()`.
Expand Down Expand Up @@ -47,7 +46,7 @@ namespace sqlite_orm::internal {

auto begin() {
const auto& exprDBOs = db_objects_for_expression(this->db_objects.get(), this->expression);
using ExprDBOs = std::remove_cvref_t<decltype(exprDBOs)>;
using ExprDBOs = polyfill::remove_cvref_t<decltype(exprDBOs)>;
// note: Select can be `select_t` or `with_t`
using select_type = polyfill::detected_or_t<expression_type, expression_type_t, expression_type>;
using column_result_type = column_result_of_t<ExprDBOs, select_type>;
Expand Down Expand Up @@ -82,4 +81,3 @@ namespace sqlite_orm::internal {
template<class Select, class DBOs>
inline constexpr bool std::ranges::enable_borrowed_range<sqlite_orm::internal::result_set_view<Select, DBOs>> = true;
#endif
#endif
2 changes: 0 additions & 2 deletions dev/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,6 @@ namespace sqlite_orm {
}
#endif

#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
/*
* Iterate over a result set of a select statement.
*
Expand Down Expand Up @@ -331,7 +330,6 @@ namespace sqlite_orm {
return {this->db_objects, std::move(connection), std::move(expression)};
}
#endif
#endif

#ifdef SQLITE_ORM_CPP23_GENERATOR_SUPPORTED
/*
Expand Down
2 changes: 0 additions & 2 deletions examples/iteration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,12 @@ int main(int, char**) {
}
cout << "heroesByAlgorithm.size = " << heroesByAlgorithm.size() << endl;

#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
cout << "====" << endl;

cout << "Distinct hero names:" << endl;
for (std::string name: storage.iterate(select(distinct(&MarvelHero::name)))) {
cout << name << endl;
}
#endif

return 0;
}
15 changes: 7 additions & 8 deletions include/sqlite_orm/sqlite_orm.h
Original file line number Diff line number Diff line change
Expand Up @@ -16414,7 +16414,7 @@ inline constexpr bool std::ranges::enable_borrowed_range<sqlite_orm::internal::m
#ifndef SQLITE_ORM_IMPORT_STD_MODULE
#include <utility> // std::move, std::remove_cvref
#include <functional> // std::reference_wrapper
#if defined(SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED) && defined(SQLITE_ORM_CPP20_RANGES_SUPPORTED)
#ifdef SQLITE_ORM_CPP20_RANGES_SUPPORTED
#include <ranges> // std::ranges::view_interface
#endif
#endif
Expand All @@ -16440,7 +16440,6 @@ inline constexpr bool std::ranges::enable_borrowed_range<sqlite_orm::internal::m

// #include "util.h"

#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
namespace sqlite_orm::internal {

template<class ColResult, class DBOs>
Expand Down Expand Up @@ -16499,6 +16498,11 @@ namespace sqlite_orm::internal {
friend bool operator==(const result_set_iterator& it, const result_set_sentinel_t&) noexcept {
return sqlite3_data_count(it.stmt.get()) == 0;
}
#ifndef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
friend bool operator!=(const result_set_iterator& it, const result_set_sentinel_t& s) noexcept {
return !(it == s);
}
#endif

private:
void step() {
Expand All @@ -16515,7 +16519,6 @@ namespace sqlite_orm::internal {
statement_finalizer stmt;
};
}
#endif

// #include "ast_iterator.h"

Expand All @@ -16527,7 +16530,6 @@ namespace sqlite_orm::internal {

// #include "storage_lookup.h"

#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
namespace sqlite_orm::internal {
/*
* A C++ view over a result set of a select statement, returned by `storage_t::iterate()`.
Expand Down Expand Up @@ -16556,7 +16558,7 @@ namespace sqlite_orm::internal {

auto begin() {
const auto& exprDBOs = db_objects_for_expression(this->db_objects.get(), this->expression);
using ExprDBOs = std::remove_cvref_t<decltype(exprDBOs)>;
using ExprDBOs = polyfill::remove_cvref_t<decltype(exprDBOs)>;
// note: Select can be `select_t` or `with_t`
using select_type = polyfill::detected_or_t<expression_type, expression_type_t, expression_type>;
using column_result_type = column_result_of_t<ExprDBOs, select_type>;
Expand Down Expand Up @@ -16591,7 +16593,6 @@ namespace sqlite_orm::internal {
template<class Select, class DBOs>
inline constexpr bool std::ranges::enable_borrowed_range<sqlite_orm::internal::result_set_view<Select, DBOs>> = true;
#endif
#endif

// #include "ast_iterator.h"

Expand Down Expand Up @@ -23411,7 +23412,6 @@ namespace sqlite_orm {
}
#endif

#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
/*
* Iterate over a result set of a select statement.
*
Expand Down Expand Up @@ -23444,7 +23444,6 @@ namespace sqlite_orm {
return {this->db_objects, std::move(connection), std::move(expression)};
}
#endif
#endif

#ifdef SQLITE_ORM_CPP23_GENERATOR_SUPPORTED
/*
Expand Down
8 changes: 6 additions & 2 deletions tests/iterate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,18 @@ TEST_CASE("Iterate mapped") {
}
}

#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
TEST_CASE("Iterate select statement") {
struct Test {
int64_t id = 0;
std::vector<char> key;

#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
bool operator==(const Test&) const = default;
#else
bool operator==(const Test& right) const {
return this->id == right.id && this->key == right.key;
}
#endif
};
#ifdef SQLITE_ORM_CPP20_CONCEPTS_SUPPORTED
constexpr orm_table_reference auto test_table = c<Test>();
Expand Down Expand Up @@ -144,4 +149,3 @@ TEST_CASE("Iterate select statement") {
#endif
#endif
}
#endif
8 changes: 3 additions & 5 deletions tests/static_tests/iterator_t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
using namespace sqlite_orm;
using internal::mapped_iterator;
using internal::mapped_view;
using internal::structure;
#ifdef SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED
using internal::result_set_iterator;
using internal::result_set_sentinel_t;
using internal::result_set_view;
#endif
using internal::structure;
#ifdef SQLITE_ORM_WITH_CPP20_ALIASES
using internal::table_reference;
#endif
Expand Down Expand Up @@ -81,7 +79,7 @@ concept storage_iterate_mapped_ref = requires(S& storage_type) {
};
#endif

#if defined(SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED) && defined(SQLITE_ORM_CPP20_CONCEPTS_SUPPORTED)
#ifdef SQLITE_ORM_CPP20_CONCEPTS_SUPPORTED
template<class Iter, class Value>
concept can_iterate_result_set = requires(Iter it) {
requires std::input_iterator<Iter>;
Expand Down Expand Up @@ -190,7 +188,7 @@ TEST_CASE("can view and iterate mapped") {
#endif
}

#if defined(SQLITE_ORM_DEFAULT_COMPARISONS_SUPPORTED) && defined(SQLITE_ORM_CPP20_CONCEPTS_SUPPORTED)
#ifdef SQLITE_ORM_CPP20_CONCEPTS_SUPPORTED
TEST_CASE("can view and iterate result set") {
struct Object {};
using empty_storage_type = decltype(make_storage(""));
Expand Down