Skip to content

Commit b3ced5e

Browse files
fts5 first draft
1 parent 8b2f195 commit b3ced5e

33 files changed

+1027
-145
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ cmake-build-debug/
66
.idea/
77

88
/compile
9+
build

dev/ast/match.h

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#pragma once
2+
3+
namespace sqlite_orm {
4+
namespace internal {
5+
6+
template<class T, class X>
7+
struct match_t {
8+
using mapped_type = T;
9+
using argument_type = X;
10+
11+
argument_type argument;
12+
13+
match_t(argument_type argument): argument(std::move(argument)) {}
14+
};
15+
}
16+
17+
template<class T, class X>
18+
internal::match_t<T, X> match(X argument) {
19+
return {std::move(argument)};
20+
}
21+
22+
}

dev/ast_iterator.h

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "ast/group_by.h"
2121
#include "ast/exists.h"
2222
#include "ast/set.h"
23+
#include "ast/match.h"
2324

2425
namespace sqlite_orm {
2526

@@ -141,9 +142,19 @@ namespace sqlite_orm {
141142
using node_type = binary_operator<L, R, Ds...>;
142143

143144
template<class C>
144-
void operator()(const node_type& binaryOperator, C& lambda) const {
145-
iterate_ast(binaryOperator.lhs, lambda);
146-
iterate_ast(binaryOperator.rhs, lambda);
145+
void operator()(const node_type& node, C& lambda) const {
146+
iterate_ast(node.lhs, lambda);
147+
iterate_ast(node.rhs, lambda);
148+
}
149+
};
150+
151+
template<class L, class R>
152+
struct ast_iterator<is_equal_with_table_t<L, R>, void> {
153+
using node_type = is_equal_with_table_t<L, R>;
154+
155+
template<class C>
156+
void operator()(const node_type& node, C& lambda) const {
157+
iterate_ast(node.rhs, lambda);
147158
}
148159
};
149160

@@ -212,6 +223,16 @@ namespace sqlite_orm {
212223
}
213224
};
214225

226+
template<class T, class X>
227+
struct ast_iterator<match_t<T, X>, void> {
228+
using node_type = match_t<T, X>;
229+
230+
template<class L>
231+
void operator()(const node_type& node, L& lambda) const {
232+
iterate_ast(node.argument, lambda);
233+
}
234+
};
235+
215236
template<class T>
216237
struct ast_iterator<into_t<T>, void> {
217238
using node_type = into_t<T>;

dev/column_names_getter.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ namespace sqlite_orm {
2121

2222
namespace internal {
2323

24-
template<class T, class DBOs>
25-
std::string serialize(const T&, const serializer_context<DBOs>&);
24+
template<class T, class C>
25+
std::string serialize(const T& t, const C& context);
2626

2727
template<class T, class Ctx>
2828
std::vector<std::string>& collect_table_column_names(std::vector<std::string>& collectedExpressions,

dev/conditions.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,16 @@ namespace sqlite_orm {
210210
}
211211
};
212212

213+
template<class L, class R>
214+
struct is_equal_with_table_t: negatable_t {
215+
using left_type = L;
216+
using right_type = R;
217+
218+
right_type rhs;
219+
220+
is_equal_with_table_t(right_type rhs): rhs(std::move(rhs)) {}
221+
};
222+
213223
struct is_not_equal_string {
214224
operator std::string() const {
215225
return "!=";
@@ -1085,6 +1095,11 @@ namespace sqlite_orm {
10851095
return {std::move(l), std::move(r)};
10861096
}
10871097

1098+
template<class L, class R>
1099+
internal::is_equal_with_table_t<L, R> is_equal(R rhs) {
1100+
return {std::move(rhs)};
1101+
}
1102+
10881103
template<class L, class R>
10891104
internal::is_not_equal_t<L, R> is_not_equal(L l, R r) {
10901105
return {std::move(l), std::move(r)};

dev/default_value_extractor.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace sqlite_orm {
1010

1111
namespace internal {
1212

13-
template<class T, class DBOs>
14-
std::string serialize(const T&, const serializer_context<DBOs>&);
13+
template<class T, class C>
14+
std::string serialize(const T& t, const C& context);
1515

1616
/**
1717
* Serialize default value of a column's default valu

dev/eponymous_vtabs/dbstat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#endif
66

77
#include "../column.h"
8-
#include "../table.h"
8+
#include "../schema/table.h"
99

1010
namespace sqlite_orm {
1111
#ifdef SQLITE_ENABLE_DBSTAT_VTAB

dev/implementations/table_definitions.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "../functional/cxx_universal.h" // ::size_t
1111
#include "../type_printer.h"
1212
#include "../column.h"
13-
#include "../table.h"
13+
#include "../schema/table.h"
1414

1515
namespace sqlite_orm {
1616
namespace internal {

dev/node_tuple.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
#include "ast/where.h"
2121
#include "ast/into.h"
2222
#include "ast/group_by.h"
23+
#include "ast/match.h"
2324

2425
namespace sqlite_orm {
25-
2626
namespace internal {
2727

2828
template<class T, class SFINAE = void>
@@ -89,6 +89,9 @@ namespace sqlite_orm {
8989
template<class E>
9090
struct node_tuple<order_by_t<E>, void> : node_tuple<E> {};
9191

92+
template<class L, class R>
93+
struct node_tuple<is_equal_with_table_t<L, R>, void> : node_tuple<R> {};
94+
9295
template<class T>
9396
struct node_tuple<T, match_if<is_binary_condition, T>> {
9497
using node_type = T;
@@ -158,6 +161,9 @@ namespace sqlite_orm {
158161
template<class T>
159162
struct node_tuple<into_t<T>, void> : node_tuple<void> {};
160163

164+
template<class T, class X>
165+
struct node_tuple<match_t<T, X>, void> : node_tuple<X> {};
166+
161167
template<class... Args>
162168
struct node_tuple<values_t<Args...>, void> {
163169
using type = tuple_cat_t<node_tuple_t<Args>...>;
File renamed without changes.

0 commit comments

Comments
 (0)