15#include <boost/preprocessor/stringize.hpp>
16#include <boost/preprocessor/tuple.hpp>
35#ifndef ORAL_ADAPT_STRUCT
37#define ORAL_STRING_FIELD(_, index, tuple) \
38 if constexpr (Idx == index) \
39 return CtString { BOOST_PP_STRINGIZE(BOOST_PP_TUPLE_ELEM(index, tuple)) };
41#define ORAL_GET_FIELD(_, index, tuple) \
42 if constexpr (Idx == index) \
43 return s.BOOST_PP_TUPLE_ELEM(index, tuple);
45#define ORAL_GET_FIELD_INDEX_IMPL(index, sname, field) \
47 constexpr size_t FieldIndexAccess<sname>::FieldIndex<&sname::field> () { return index; }
49#define ORAL_GET_FIELD_INDEX(_, index, args) \
50 ORAL_GET_FIELD_INDEX_IMPL(index, BOOST_PP_TUPLE_ELEM(0, args), BOOST_PP_TUPLE_ELEM(index, BOOST_PP_TUPLE_ELEM(1, args)))
52#define ORAL_ADAPT_STRUCT(sname, ...) \
53namespace LC::Util::oral \
56 constexpr auto SeqSize<sname> = BOOST_PP_TUPLE_SIZE((__VA_ARGS__)); \
59 struct MemberNames<sname> \
61 template<size_t Idx> \
62 constexpr static auto Get () \
64 BOOST_PP_REPEAT(BOOST_PP_TUPLE_SIZE((__VA_ARGS__)), ORAL_STRING_FIELD, (__VA_ARGS__)) \
69 struct FieldAccess<sname> \
71 template<size_t Idx> \
72 constexpr static const auto& Get (const sname& s) \
74 BOOST_PP_REPEAT(BOOST_PP_TUPLE_SIZE((__VA_ARGS__)), ORAL_GET_FIELD, (__VA_ARGS__)) \
77 template<size_t Idx> \
78 constexpr static auto& Get (sname& s) \
80 BOOST_PP_REPEAT(BOOST_PP_TUPLE_SIZE((__VA_ARGS__)), ORAL_GET_FIELD, (__VA_ARGS__)) \
85 struct FieldIndexAccess<sname> \
88 constexpr static size_t FieldIndex (); \
91 BOOST_PP_REPEAT(BOOST_PP_TUPLE_SIZE((__VA_ARGS__)), ORAL_GET_FIELD_INDEX, (sname, (__VA_ARGS__))) \
102 const QSqlQuery Query_;
110 :
std::runtime_error { str }
137 template<
size_t Idx,
typename Seq>
138 constexpr decltype (
auto)
Get (
const Seq& seq)
143 template<
size_t Idx,
typename Seq>
144 constexpr decltype (
auto)
Get (Seq& seq)
149 template<
typename T, CtString str>
152 if constexpr (
requires { T::template FieldNameMorpher<str> (); })
153 return T::template FieldNameMorpher<str> ();
154 else if constexpr (str.EndsWith (
'_'))
155 return str.template Chop<1> ();
160 template<
typename Seq,
int Idx>
168 constexpr auto SeqIndices = std::make_index_sequence<SeqSize<S>> {};
171 constexpr auto FieldNames = []<
size_t... Ix> (std::index_sequence<Ix...>)
constexpr
177 constexpr auto BoundFieldNames = []<
size_t... Ix> (std::index_sequence<Ix...>)
constexpr
216 template<
typename ImplFactory,
typename T,
typename =
void>
223 else if constexpr (std::is_same_v<T, double>)
225 else if constexpr (std::is_same_v<T, QString> || std::is_same_v<T, QDateTime> || std::is_same_v<T, QUrl>)
227 else if constexpr (std::is_same_v<T, QByteArray>)
228 return ImplFactory::TypeLits::Binary;
234 static_assert (std::is_same_v<T, struct Dummy>,
"Unsupported type");
238 template<
typename ImplFactory,
typename T>
244 template<
typename ImplFactory,
typename T>
250 template<
typename ImplFactory,
typename T,
typename...
Tags>
256 template<
typename ImplFactory,
typename...
Tags>
259 constexpr auto operator() () const noexcept {
return ImplFactory::TypeLits::IntAutoincrement; }
262 template<
typename ImplFactory, auto Ptr>
273 template<
typename T,
typename =
void>
278 if constexpr (std::is_same_v<T, QDateTime>)
279 return t.toString (Qt::ISODate);
280 else if constexpr (std::is_enum_v<T>)
281 return static_cast<qint64
> (t);
285 return t.ToVariant ();
293 template<
typename T,
typename =
void>
298 if constexpr (std::is_same_v<T, QDateTime>)
299 return QDateTime::fromString (var.toString (), Qt::ISODate);
300 else if constexpr (std::is_enum_v<T>)
301 return static_cast<T
> (var.value<qint64> ());
305 return T::FromVariant (var);
309 return var.value<T> ();
315 template<
typename Seq,
int Idx>
316 using ValueAtC_t = std::decay_t<decltype (Get<Idx> (std::declval<Seq> ()))>;
321 template<
typename U,
typename...
Tags>
330 template<
size_t Ix,
typename Seq>
331 void BindAtIndex (
const Seq& seq, QSqlQuery& query,
bool bindPrimaryKey)
337 template<
typename Seq>
338 auto DoInsert (
const Seq& seq, QSqlQuery& insertQuery,
bool bindPrimaryKey)
340 [&]<
size_t... Ix> (std::index_sequence<Ix...>)
345 if (!insertQuery.exec ())
347 qCritical () <<
"insert query execution failed";
349 throw QueryException (
"insert query execution failed", insertQuery);
353 template<
typename Seq>
356 auto run = []<
size_t... Idxes> (std::index_sequence<Idxes...>)
365 template<
typename Seq>
369 static_assert (idx >= 0);
373 template<
typename Seq>
376 template<
typename Seq>
379 template<
typename Seq>
388 template<
typename Seq>
394 template<
typename Seq,
auto... Ptrs>
397 return std::tuple { std::get<FieldIndex<Ptrs> ()> (
FieldNames<Seq>)... };
400 template<
typename Seq>
403 const QSqlDatabase DB_;
411 template<
typename Action = InsertAction::DefaultTag>
414 return Run<SQLite::ImplFactory> (t, action);
417 template<
typename ImplFactory>
420 return Run<ImplFactory> (t, action);
423 template<
typename Action = InsertAction::DefaultTag>
426 return Run<SQLite::ImplFactory> (t, action);
429 template<
typename ImplFactory>
430 auto operator() (ImplFactory,
const Seq& t,
auto action)
const
432 return Run<ImplFactory> (t, action);
435 template<
typename ImplFactory,
typename Action>
436 constexpr static auto MakeInsertSuffix (Action action)
438 if constexpr (std::is_same_v<Action, InsertAction::DefaultTag> || std::is_same_v<Action, InsertAction::IgnoreTag>)
439 return ImplFactory::GetInsertSuffix (action);
446 template<
typename ImplFactory>
447 constexpr static auto MakeQueryForAction (
auto action)
449 return ImplFactory::GetInsertPrefix (action) +
450 " INTO " + Seq::ClassName +
453 MakeInsertSuffix<ImplFactory> (action);
456 template<
typename ImplFactory,
typename T>
457 auto Run (T& t,
auto action)
const
459 QSqlQuery query { DB_ };
460 constexpr auto queryText = MakeQueryForAction<ImplFactory> (action);
465 if constexpr (HasAutogen_)
469 const auto& lastId = FromVariant<ValueAtC_t<Seq, index>> {} (query.lastInsertId ());
470 if constexpr (!std::is_const_v<T>)
478 template<
typename Seq>
489 constexpr auto del =
"DELETE FROM " + Seq::ClassName +
504 template<
typename T,
size_t...
Indices>
537 template<ExprType Type>
559 static_assert (std::is_same_v<struct D1, ExprType>,
"Invalid expression type");
582 WrapDirect<T>>::value_type;
584 template<ExprType Type,
typename Seq,
typename L,
typename R>
591 return requires (LReal l, RReal r) { l == r; };
597 template<ExprType Type,
typename L =
void,
typename R =
void>
603 template<ExprType Type,
typename L,
typename R>
606 template<
typename L,
typename R>
618 template<
typename Seq, CtString S>
619 constexpr static auto ToSql () noexcept
622 return L::GetFieldName () +
" = " + R::template
ToSql<Seq, S +
"r"> ();
627 template<
typename Seq, CtString S>
630 Left_.template
BindValues<Seq, S +
"l"> (query);
631 Right_.template
BindValues<Seq, S +
"r"> (query);
634 template<
typename OL,
typename OR>
641 template<ExprType Type,
typename L,
typename R>
647 constexpr ExprTree (
const L& l,
const R& r) noexcept
653 template<
typename Seq, CtString S>
654 constexpr static auto ToSql () noexcept
657 "Incompatible types passed to a relational operator.");
662 template<
typename Seq, CtString S>
665 Left_.template
BindValues<Seq, S +
"l"> (query);
666 Right_.template
BindValues<Seq, S +
"r"> (query);
695 template<
typename, CtString S>
696 constexpr static auto ToSql () noexcept
698 return ":bound_" + S;
701 template<
typename Seq, CtString S>
711 return std::tuple {};
730 template<
auto... Ptr>
741 template<
typename Seq, CtString S>
742 constexpr static auto ToSql () noexcept
747 template<
typename Seq, CtString S>
761 if constexpr (std::is_same_v<Seq, T>)
762 return std::tuple {};
764 return std::tuple { Seq::ClassName };
770 return !std::is_same_v<MemberPtrStruct_t<Ptr>, T>;
773 constexpr auto operator= (
const ExpectedType_t& r)
const noexcept
783 template<
typename, CtString>
784 constexpr static auto ToSql () noexcept
789 template<
typename, CtString>
803 template<ExprType Type,
typename L,
typename R>
811 template<
typename L,
typename R>
821 template<
typename L,
typename R>
824 template<
typename L,
typename R,
typename = EnableRelOp_t<L, R>>
830 template<
typename L,
typename R,
typename = EnableRelOp_t<L, R>>
836 template<
typename L,
typename R,
typename = EnableRelOp_t<L, R>>
842 template<
typename L,
typename R,
typename = EnableRelOp_t<L, R>>
848 template<ExprType Op>
859 template<
typename L, ExprType Op>
865 template<
typename L, ExprType Op>
871 template<
typename L, ExprType Op,
typename R>
877 template<
typename L,
typename R,
typename = EnableRelOp_t<L, R>>
883 template<
typename L,
typename R,
typename = EnableRelOp_t<L, R>>
889 template<CtString BindPrefix,
typename Seq,
typename Tree>
892 return Tree::template ToSql<Seq, BindPrefix> ();
895 template<CtString BindPrefix,
typename Seq,
typename Tree>
898 tree.template BindValues<Seq, BindPrefix> (query);
908 template<AggregateFunction, auto Ptr>
915 template<
typename... MemberDirectionList>
918 template<
auto... Ptrs>
923 template<
typename L,
typename R>
932 template<AggregateFunction Fun, auto Ptr>
935 template<
auto... Ptrs>
938 template<
typename L,
typename R>
941 template<
typename L,
typename R,
typename = std::enable_if_t<IsSelector<L> {} && IsSelector<R> {}>>
953 template<
auto... Ptrs>
958 template<
auto... Ptrs>
961 template<
auto... Ptrs>
964 template<auto Ptr = detail::CountAllPtr>
974 template<
typename... Orders>
977 template<
auto... Ptrs>
1004 template<
auto... Ptrs>
1007 if constexpr (
sizeof... (Ptrs) == 1)
1010 return [&]<
size_t... Ix> (std::index_sequence<Ix...>)
1013 } (std::make_index_sequence<
sizeof... (Ptrs)> {});
1023 template<
size_t RepIdx,
size_t TupIdx,
typename Tuple,
typename NewType>
1026 if constexpr (RepIdx == TupIdx)
1027 return std::forward<NewType> (arg);
1029 return std::get<TupIdx> (tuple);
1032 template<
size_t RepIdx,
typename NewType,
typename Tuple,
size_t... TupIdxs>
1041 template<
size_t RepIdx,
typename NewType,
typename... TupleArgs>
1045 std::forward<NewType> (arg),
1046 std::index_sequence_for<TupleArgs...> {});
1049 template<
typename Seq,
typename T>
1055 template<
typename Seq,
typename... Args>
1061 template<
typename Seq>
1067 template<
typename... LArgs,
typename... RArgs>
1068 auto Combine (std::tuple<LArgs...>&& left, std::tuple<RArgs...>&& right)
noexcept
1070 return std::tuple_cat (std::move (left), std::move (right));
1073 template<
typename... LArgs,
typename R>
1074 auto Combine (std::tuple<LArgs...>&& left,
const R& right)
noexcept
1076 return std::tuple_cat (std::move (left), std::tuple { right });
1079 template<
typename L,
typename... RArgs>
1080 auto Combine (
const L& left, std::tuple<RArgs...>&& right)
noexcept
1082 return std::tuple_cat (std::tuple { left }, std::move (right));
1085 template<
typename L,
typename R>
1086 auto Combine (
const L& left,
const R& right)
noexcept
1088 return std::tuple { left, right };
1097 template<ResultBehaviour ResultBehaviour,
typename ResList>
1101 return std::forward<ResList> (list);
1103 return list.value (0);
1106 template<
typename F,
typename R>
1114 template<
typename F,
typename R>
1119 const QSqlDatabase DB_;
1127 auto&& binder)
const
1129 QSqlQuery query { DB_ };
1130 query.prepare (queryStr);
1135 qCritical () <<
"select query execution failed";
1137 throw QueryException (
"fetch query execution failed", std::make_shared<QSqlQuery> (query));
1144 template<
typename L,
typename O>
1147 if constexpr (std::is_same_v<L, LimitNone>)
1149 static_assert (std::is_same_v<O, OffsetNone>,
"LIMIT-less queries currently cannot have OFFSET");
1153 return " LIMIT :limit "_ct +
1156 if constexpr (std::is_same_v<O, OffsetNone>)
1159 return " OFFSET :offset"_ct;
1163 template<
typename L,
typename O>
1166 if constexpr (!std::is_same_v<std::decay_t<L>,
LimitNone>)
1167 query.bindValue (
":limit", qulonglong { limit.Count });
1168 if constexpr (!std::is_same_v<std::decay_t<O>,
OffsetNone>)
1169 query.bindValue (
":offset", qulonglong { offset.Count });
1172 template<
typename T,
typename Selector>
1179 template<
typename T>
1190 template<
typename T,
auto... Ptrs>
1194 template<
size_t... Ixs>
1195 constexpr static auto SelectFields ()
1208 template<
typename T>
1211 constexpr inline static auto Fields =
"count(1)"_ct;
1215 return q.value (startIdx).toLongLong ();
1219 template<
typename T, auto Ptr>
1226 return q.value (startIdx).toLongLong ();
1230 template<CtString Aggregate,
typename T, auto Ptr>
1241 template<
typename T, auto Ptr>
1244 template<
typename T, auto Ptr>
1254 template<
typename T,
typename L,
typename R>
1262 constexpr inline static auto Fields = HL::Fields +
", " + HR::Fields;
1266 constexpr auto shift =
DetectShift<T,
decltype (HL::Initializer (q, 0))>::Value;
1267 return Combine (HL::Initializer (q, startIdx), HR::Initializer (q, startIdx + shift));
1271 template<
typename T, SelectBehaviour SelectBehaviour>
1274 template<
typename ParamsTuple>
1278 ParamsTuple Params_;
1280 template<
typename NewTuple>
1281 constexpr auto RepTuple (NewTuple&& tuple)
noexcept
1283 return Builder<NewTuple> { W_, tuple };
1286 template<
typename U>
1287 constexpr auto Select (U&& selector) &&
noexcept
1292 template<
typename U>
1293 constexpr auto Where (U&& tree) &&
noexcept
1298 template<
typename U>
1299 constexpr auto Order (U&& order) &&
noexcept
1304 template<
typename U>
1305 constexpr auto Group (U&& group) &&
noexcept
1310 constexpr auto Limit (
Limit limit) &&
noexcept
1315 constexpr auto Limit (uint64_t limit) &&
noexcept
1317 return std::move (*this).Limit (
oral::Limit { limit });
1325 constexpr auto Offset (uint64_t offset) &&
noexcept
1327 return std::move (*this).Offset (
oral::Offset { offset });
1332 return std::apply (W_, Params_);
1335 template<
auto... Ptrs>
1336 constexpr auto Group () &&
noexcept
1346 std::tuple defParams
1355 return Builder<
decltype (defParams)> { *
this, defParams };
1363 template<
typename Single>
1367 return (*
this) (
SelectWhole {}, std::forward<Single> (single));
1374 ExprType Type,
typename L,
typename R,
1384 Limit limit = LimitNone {},
1385 Offset offset = OffsetNone {})
const
1387 using TreeType_t = ExprTree<Type, L, R>;
1390 constexpr auto wherePrefix = [where]
1392 if constexpr (where.IsEmpty ())
1395 return " WHERE "_ct;
1397 constexpr auto from = BuildFromClause<TreeType_t> ();
1398 const auto binder = [&] (QSqlQuery& query)
1403 using HS = HandleSelector<T, Selector>;
1405 constexpr auto query =
"SELECT " + HS::Fields +
1407 wherePrefix + where +
1408 HandleOrder (std::forward<Order> (order)) +
1409 HandleGroup (std::forward<Group> (group)) +
1416 template<
typename HS,
typename Binder>
1417 auto Select (
const QString& queryStr,
1418 Binder&& binder)
const
1420 auto query =
RunQuery (queryStr, binder);
1424 QList<
decltype (HS::Initializer (query, 0))> result;
1425 while (query.next ())
1426 result << HS::Initializer (query, 0);
1431 using RetType_t = std::optional<
decltype (HS::Initializer (query, 0))>;
1432 return query.next () ?
1433 RetType_t { HS::Initializer (query, 0) } :
1438 template<
typename Tree>
1439 consteval static auto BuildFromClause () noexcept
1441 if constexpr (Tree::template HasAdditionalTables<T> ())
1442 return T::ClassName +
", " +
JoinTup (
Nub<Tree::template AdditionalTables<T>> (),
", ");
1444 return T::ClassName;
1447 constexpr static auto HandleOrder (OrderNone)
noexcept
1452 template<
auto... Ptrs>
1453 constexpr static auto HandleSuborder (sph::asc<Ptrs...>)
noexcept
1458 template<
auto... Ptrs>
1459 constexpr static auto HandleSuborder (sph::desc<Ptrs...>)
noexcept
1464 template<
typename... Suborders>
1467 return " ORDER BY " +
JoinTup (std::tuple_cat (HandleSuborder (Suborders {})...),
", ");
1470 constexpr static auto HandleGroup (GroupNone)
noexcept
1475 template<
auto... Ptrs>
1482 template<
typename T>
1485 const QSqlDatabase DB_;
1492 template<ExprType Type,
typename L,
typename R>
1497 constexpr auto selectAll =
"DELETE FROM " + T::ClassName +
" WHERE " + where;
1499 QSqlQuery query { DB_ };
1506 template<
typename T>
1509 const QSqlDatabase DB_;
1512 QSqlQuery UpdateByPKey_ { DB_ };
1521 constexpr auto update =
"UPDATE " + T::ClassName +
1522 " SET " +
JoinTup (statements,
", ") +
1523 " WHERE " + std::get<pkeyIdx> (statements);
1530 DoInsert (seq, UpdateByPKey_,
true);
1533 template<
typename SL,
typename SR, ExprType WType,
typename WL,
typename WR>
1537 "joins in update statements are not supported by SQL");
1542 constexpr auto update =
"UPDATE " + T::ClassName +
1543 " SET " + setClause +
1544 " WHERE " + whereClause;
1546 QSqlQuery query { DB_ };
1552 qCritical () <<
"update query execution failed";
1554 throw QueryException (
"update query execution failed", std::make_shared<QSqlQuery> (query));
1557 return query.numRowsAffected ();
1561 template<
typename T,
size_t... Fields>
1567 template<
typename T,
size_t... Fields>
1570 return "PRIMARY KEY (" +
Join (
", ", std::get<Fields> (
FieldNames<T>)...) +
")";
1573 template<
typename T>
1576 if constexpr (
requires {
typename T::Constraints; })
1578 return []<
typename... Args> (
Constraints<Args...>)
1581 } (
typename T::Constraints {});
1584 return std::tuple<> {};
1587 template<
typename ImplFactory,
typename T,
size_t...
Indices>
1588 constexpr auto GetTypes (std::index_sequence<Indices...>)
noexcept
1593 template<auto Name,
typename ImplFactory,
typename T>
1599 constexpr auto constraintsStr = [&]
1601 if constexpr (!std::tuple_size_v<
decltype (constraints)>)
1604 return ", " +
JoinTup (constraints,
", ");
1608 return "CREATE TABLE " +
1616 template<
typename ImplFactory,
typename T>
1623 template<
typename T>
1637 template<
typename T,
typename ImplFactory = detail::SQLite::ImplFactory>
1658 template<
typename T>
1661 template<
typename T,
typename ImplFactory = SQLiteImplFactory>
1667 template<
typename ImplFactory,
typename... Ts>
static UTIL_DB_API void DumpError(const QSqlError &error)
Dumps the error to the qWarning() stream.
A somewhat "strong" typedef.
QueryException(const std::string &str, const QSqlQuery &q)
QueryException(const std::string &str, const QSqlQuery_ptr &q)
const QSqlQuery & GetQuery() const
~QueryException() noexcept=default
auto operator()(Seq &t, Action action={}) const
AdaptInsert(const QSqlDatabase &db) noexcept
AdaptUpdate(const QSqlDatabase &db) noexcept
void operator()(const T &seq)
constexpr AssignList(const L &l, const R &r) noexcept
void BindValues(QSqlQuery &query) const noexcept
static constexpr auto ToSql() noexcept
constexpr auto operator,(const AssignList< OL, OR > &tail) noexcept
DeleteByFieldsWrapper(const QSqlDatabase &db) noexcept
void operator()(const ExprTree< Type, L, R > &tree) const noexcept
static constexpr bool HasAdditionalTables() noexcept
void BindValues(QSqlQuery &) const noexcept
static constexpr auto ToSql() noexcept
static constexpr auto ToSql() noexcept
static constexpr auto AdditionalTables() noexcept
void BindValues(QSqlQuery &query) const noexcept
static constexpr bool HasAdditionalTables() noexcept
constexpr ExprTree(const T &t) noexcept
ExpectedType_t ValueType_t
static constexpr bool HasAdditionalTables() noexcept
static constexpr auto GetFieldName() noexcept
static constexpr auto ToSql() noexcept
void BindValues(QSqlQuery &) const noexcept
static constexpr auto AdditionalTables() noexcept
constexpr ExprTree(const L &l, const R &r) noexcept
static constexpr bool HasAdditionalTables() noexcept
void BindValues(QSqlQuery &query) const noexcept
static constexpr auto ToSql() noexcept
static constexpr auto AdditionalTables() noexcept
auto RunQuery(const QString &queryStr, auto &&binder) const
SelectWrapperCommon(const QSqlDatabase &db) noexcept
SelectWrapperCommon(const QSqlDatabase &db) noexcept
auto Build() const noexcept
QSqlQuery RunTextQuery(const QSqlDatabase &db, const QString &text)
Runs the given query text on the given db.
constexpr auto GetTypes(std::index_sequence< Indices... >) noexcept
constexpr auto AdaptCreateTableNamed() noexcept
auto operator>(const L &left, const R &right) noexcept
auto MakeIndexedQueryHandler(const QSqlQuery &q, int startIdx=0) noexcept
consteval int PKeyIndex()
constexpr auto GetFieldNamePtr() noexcept
constexpr auto GetQualifiedFieldNamePtr() noexcept
constexpr auto ExprTreeToSql() noexcept
constexpr auto AsLeafData(const T &node) noexcept
constexpr auto LimitOffsetToString() noexcept
auto operator||(const L &left, const R &right) noexcept
T InitializeFromQuery(const QSqlQuery &q, std::index_sequence< Indices... >, int startIdx) noexcept
void BindLimitOffset(QSqlQuery &query, L limit, O offset) noexcept
auto Combine(std::tuple< LArgs... > &&left, std::tuple< RArgs... > &&right) noexcept
constexpr auto GetConstraintsStrings() noexcept
std::enable_if_t< EitherIsExprTree< L, R >()> EnableRelOp_t
consteval int PKeyIndexUnsafe()
decltype(auto) HandleResultBehaviour(ResList &&list) noexcept
constexpr CountAll * CountAllPtr
constexpr auto ConstTrueTree_v
auto DoInsert(const Seq &seq, QSqlQuery &insertQuery, bool bindPrimaryKey)
constexpr decltype(auto) Get(const Seq &seq)
QVariant ToVariantF(const T &t) noexcept
constexpr bool IsRelational(ExprType type) noexcept
constexpr auto AdaptCreateTable() noexcept
auto MemberFromVariant(const QVariant &var) noexcept
constexpr auto FieldNames
constexpr auto ExtractConstraintFields(UniqueSubset< Fields... >)
consteval auto GetFieldName()
constexpr auto TypeToSql() noexcept
constexpr decltype(auto) GetReplaceTupleElem(Tuple &&tuple, NewType &&arg) noexcept
SelectorUnion< L, R > operator+(L, R) noexcept
constexpr auto BoundFieldNames
constexpr auto ReplaceTupleElem(std::tuple< TupleArgs... > &&tuple, NewType &&arg) noexcept
auto operator!=(const L &left, const R &right) noexcept
constexpr auto CombineBehaviour(ResultBehaviour l, ResultBehaviour r) noexcept
constexpr bool EitherIsExprTree() noexcept
HandleSelectorResult(QString, F, R) -> HandleSelectorResult< F, R >
auto MakeExprTree(const L &left, const R &right) noexcept
void BindAtIndex(const Seq &seq, QSqlQuery &query, bool bindPrimaryKey)
constexpr auto QualifiedFieldNames
std::decay_t< decltype(Get< Idx >(std::declval< Seq >()))> ValueAtC_t
constexpr auto ReplaceTupleElemImpl(Tuple &&tuple, NewType &&arg, std::index_sequence< TupIdxs... >) noexcept
constexpr auto ExtractConflictingFields(InsertAction::Replace::PKeyType)
constexpr bool Typecheck()
typename std::conditional_t< IsIndirect< T > {}, T, WrapDirect< T > >::value_type UnwrapIndirect_t
auto operator==(const L &left, const R &right) noexcept
void BindExprTree(const Tree &tree, QSqlQuery &query)
auto operator<(const L &left, const R &right) noexcept
constexpr size_t FieldIndex() noexcept
constexpr int PKeyIndex_v
consteval auto MorphFieldName()
constexpr auto SeqIndices
constexpr auto HasAutogenPKey() noexcept
auto operator|(const L &left, InfixBinary< Op >) noexcept
auto operator&&(const L &left, const R &right) noexcept
constexpr detail::InfixBinary< detail::ExprType::Like > like
constexpr detail::ExprTree< detail::ExprType::LeafStaticPlaceholder, detail::MemberPtrs< Ptr > > f
constexpr detail::SelectWhole all
constexpr detail::AggregateType< detail::AggregateFunction::Count, Ptr > count
constexpr detail::AggregateType< detail::AggregateFunction::Min, Ptr > min
constexpr detail::MemberPtrs< Ptrs... > fields
constexpr detail::AggregateType< detail::AggregateFunction::Max, Ptr > max
void AdaptPtrs(const QSqlDatabase &db, ObjectInfo_ptr< Ts > &... objects)
Typelist< Args... > Constraints
ObjectInfo_ptr< T > AdaptPtr(const QSqlDatabase &db)
constexpr detail::OrderBy< Orders... > OrderBy
Typelist< Args... > Indices
constexpr detail::GroupBy< Ptrs... > GroupBy
ObjectInfo< T > Adapt(const QSqlDatabase &db)
std::unique_ptr< ObjectInfo< T > > ObjectInfo_ptr
std::shared_ptr< QSqlQuery > QSqlQuery_ptr
typename AsTypelist< T >::Result_t AsTypelist_t
std::tuple_element_t< 0, detail::CallTypeGetter_t< F > > RetType_t
constexpr auto ZipWith(Tup1 &&tup1, auto &&sep, Tup2 &&tup2) noexcept
constexpr auto JoinTup(auto &&stringsTuple, auto &&sep) noexcept
constexpr bool HasType(List< Args... >)
MemberTypeType_t< decltype(Ptr)> MemberPtrType_t
constexpr auto Join(auto &&) noexcept
MemberTypeStruct_t< decltype(Ptr)> MemberPtrStruct_t
T operator()(const QVariant &var) const noexcept
detail::AdaptUpdate< T > Update
detail::SelectWrapper< T, detail::SelectBehaviour::Some > Select
detail::AdaptDelete< T > Delete
detail::AdaptInsert< T > Insert
detail::DeleteByFieldsWrapper< T > DeleteBy
detail::SelectWrapper< T, detail::SelectBehaviour::One > SelectOne
QVariant operator()(const T &t) const noexcept
constexpr auto operator()() const noexcept
void operator()(const Seq &seq)
AdaptDelete(const QSqlDatabase &db) noexcept
static constexpr int Value
static constexpr int Value
static constexpr int Value
static constexpr auto ResultBehaviour_v
static constexpr auto ResultBehaviour_v
static auto Initializer(const QSqlQuery &q, int startIdx) noexcept
static constexpr auto Fields
static auto Initializer(const QSqlQuery &q, int startIdx)
static constexpr auto Fields
static constexpr auto Fields
static auto Initializer(const QSqlQuery &q, int startIdx)
static constexpr auto Fields
static auto Initializer(const QSqlQuery &q, int startIdx) noexcept
static auto Initializer(const QSqlQuery &q, int startIdx)
static constexpr auto Fields
static constexpr auto Fields
static constexpr auto ResultBehaviour_v
HandleSelector< T, L > HL
static auto Initializer(const QSqlQuery &q, int startIdx) noexcept
HandleSelector< T, R > HR