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__))) \
110 :
std::runtime_error {
str }
137 template<
size_t Idx,
typename Seq>
143 template<
size_t Idx,
typename Seq>
149 template<
typename T, CtString str>
154 else if constexpr (
str.EndsWith (
'_'))
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
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>
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>
337 template<
typename Seq>
340 [&]<
size_t...
Ix> (std::index_sequence<
Ix...>)
347 qCritical () <<
"insert query execution failed";
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>
411 template<
typename Action = InsertAction::DefaultTag>
417 template<
typename ImplFactory>
423 template<
typename Action = InsertAction::DefaultTag>
429 template<
typename ImplFactory>
435 template<
typename ImplFactory,
typename 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 +
456 template<
typename ImplFactory,
typename T>
457 auto Run (T&
t,
auto action)
const
465 if constexpr (HasAutogen_)
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");
584 template<ExprType Type,
typename Seq,
typename L,
typename 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>
622 return L::GetFieldName () +
" = " + R::template
ToSql<
Seq,
S +
"r"> ();
627 template<
typename Seq, CtString S>
634 template<
typename OL,
typename OR>
641 template<ExprType Type,
typename L,
typename R>
653 template<
typename Seq, CtString S>
657 "Incompatible types passed to a relational operator.");
662 template<
typename Seq, CtString S>
695 template<
typename, CtString S>
698 return ":bound_" +
S;
701 template<
typename Seq, CtString S>
711 return std::tuple {};
730 template<
auto...
Ptr>
741 template<
typename Seq, CtString S>
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>
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>
895 template<CtString BindPrefix,
typename Seq,
typename Tree>
908 template<AggregateFunction, auto Ptr>
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>
1027 return std::forward<NewType> (
arg);
1029 return std::get<TupIdx> (
tuple);
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>
1070 return std::tuple_cat (std::move (
left), std::move (
right));
1073 template<
typename...
LArgs,
typename R>
1076 return std::tuple_cat (std::move (
left), std::tuple {
right });
1079 template<
typename L,
typename...
RArgs>
1082 return std::tuple_cat (std::tuple {
left }, std::move (
right));
1085 template<
typename L,
typename R>
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>
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>)
1168 if constexpr (!std::is_same_v<std::decay_t<O>, OffsetNone>)
1172 template<
typename T,
typename Selector>
1175 struct HSBaseAll {
constexpr inline static auto ResultBehaviour_v = ResultBehaviour::All; };
1177 struct HSBaseFirst {
constexpr inline static auto ResultBehaviour_v = ResultBehaviour::First; };
1179 template<
typename T>
1182 constexpr inline static auto Fields =
JoinTup (QualifiedFieldNames<T>,
", "_ct);
1186 return InitializeFromQuery<T> (q, SeqIndices<T>, startIdx);
1190 template<
typename T,
auto... Ptrs>
1194 template<
size_t... Ixs>
1195 constexpr static auto SelectFields ()
1197 return std::tuple { std::get<Ixs> (QualifiedFieldNames<T>)... };
1200 constexpr inline static auto Fields =
JoinTup (SelectFields<FieldIndex<Ptrs> ()...> (),
", ");
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>
1222 constexpr inline static auto Fields =
"count(" + GetQualifiedFieldNamePtr<Ptr> () +
")";
1226 return q.value (startIdx).toLongLong ();
1230 template<CtString Aggregate,
typename T, auto Ptr>
1233 constexpr inline static auto Fields = Aggregate +
"(" + GetQualifiedFieldNamePtr<Ptr> () +
")";
1237 return MakeIndexedQueryHandler<Ptr> (q, startIdx);
1241 template<
typename T, auto Ptr>
1244 template<
typename T, auto Ptr>
1249 if (l == ResultBehaviour::First && r == ResultBehaviour::First)
1250 return ResultBehaviour::First;
1251 return ResultBehaviour::All;
1254 template<
typename T,
typename L,
typename R>
1260 constexpr inline static auto ResultBehaviour_v =
CombineBehaviour (HL::ResultBehaviour_v, HR::ResultBehaviour_v);
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
1289 return RepTuple (ReplaceTupleElem<0> (std::move (Params_), std::forward<U> (selector)));
1292 template<
typename U>
1293 constexpr auto Where (U&& tree) &&
noexcept
1295 return RepTuple (ReplaceTupleElem<1> (std::move (Params_), std::forward<U> (tree)));
1298 template<
typename U>
1299 constexpr auto Order (U&& order) &&
noexcept
1301 return RepTuple (ReplaceTupleElem<2> (std::move (Params_), std::forward<U> (order)));
1304 template<
typename U>
1305 constexpr auto Group (U&& group) &&
noexcept
1307 return RepTuple (ReplaceTupleElem<3> (std::move (Params_), std::forward<U> (group)));
1310 constexpr auto Limit (
Limit limit) &&
noexcept
1312 return RepTuple (ReplaceTupleElem<4> (std::move (Params_), limit));
1315 constexpr auto Limit (uint64_t limit) &&
noexcept
1317 return std::move (*this).Limit (
oral::Limit { limit });
1322 return RepTuple (ReplaceTupleElem<5> (std::move (Params_), offset));
1325 constexpr auto Offset (uint64_t offset) &&
noexcept
1327 return std::move (*this).Offset (
oral::Offset { offset });
1330 auto operator() () &&
1332 return std::apply (W_, Params_);
1335 template<
auto... Ptrs>
1336 constexpr auto Group () &&
noexcept
1342 using SelectWrapperCommon::SelectWrapperCommon;
1346 std::tuple defParams
1355 return Builder<
decltype (defParams)> { *
this, defParams };
1358 auto operator() ()
const
1363 template<
typename Single>
1364 auto operator() (Single&& single)
const
1367 return (*
this) (
SelectWhole {}, std::forward<Single> (single));
1374 ExprType Type,
typename L,
typename R,
1380 auto operator() (Selector,
1384 Limit limit = LimitNone {},
1385 Offset offset = OffsetNone {})
const
1387 using TreeType_t = ExprTree<Type, L, R>;
1389 constexpr auto where = ExprTreeToSql<
"", T, TreeType_t> ();
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)
1400 BindExprTree<
"", T> (tree, query);
1401 BindLimitOffset (query, limit, offset);
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)) +
1410 LimitOffsetToString<Limit, Offset> ();
1411 auto selectResult = Select<HS> (ToString<query> (),
1413 return HandleResultBehaviour<HS::ResultBehaviour_v> (std::move (selectResult));
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
1455 return std::tuple { (GetQualifiedFieldNamePtr<Ptrs> () +
" ASC")... };
1458 template<
auto... Ptrs>
1459 constexpr static auto HandleSuborder (sph::desc<Ptrs...>)
noexcept
1461 return std::tuple { (GetQualifiedFieldNamePtr<Ptrs> () +
" DESC")... };
1464 template<
typename... Suborders>
1465 constexpr static auto HandleOrder (OrderBy<Suborders...>)
noexcept
1467 return " ORDER BY " +
JoinTup (std::tuple_cat (HandleSuborder (Suborders {})...),
", ");
1470 constexpr static auto HandleGroup (GroupNone)
noexcept
1475 template<
auto... Ptrs>
1476 constexpr static auto HandleGroup (GroupBy<Ptrs...>)
noexcept
1478 return " GROUP BY " +
Join (
", ", GetQualifiedFieldNamePtr<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_ };
1500 query.prepare (ToString<selectAll> ());
1506 template<
typename T>
1509 const QSqlDatabase DB_;
1512 QSqlQuery UpdateByPKey_ { DB_ };
1519 constexpr auto pkeyIdx = PKeyIndex_v<T>;
1520 constexpr auto statements =
ZipWith (FieldNames<T>,
" = ", BoundFieldNames<T>);
1521 constexpr auto update =
"UPDATE " + T::ClassName +
1522 " SET " +
JoinTup (statements,
", ") +
1523 " WHERE " + std::get<pkeyIdx> (statements);
1524 UpdateByPKey_.prepare (ToString<update> ());
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_ };
1547 query.prepare (ToString<update> ());
1552 qCritical () <<
"update query execution failed";
1553 DBLock::DumpError (query);
1554 throw QueryException (
"update query execution failed", std::make_shared<QSqlQuery> (query));
1557 return query.numRowsAffected ();
1561 template<
typename T,
size_t... Fields>
1564 return "UNIQUE (" +
Join (
", ", std::get<Fields> (FieldNames<T>)...) +
")";
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...>)
1580 return std::tuple { ExtractConstraintFields<T> (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>
1596 constexpr auto types = GetTypes<ImplFactory, T> (SeqIndices<T>);
1598 constexpr auto constraints = GetConstraintsStrings<T> ();
1599 constexpr auto constraintsStr = [&]
1601 if constexpr (!std::tuple_size_v<
decltype (constraints)>)
1604 return ", " +
JoinTup (constraints,
", ");
1607 constexpr auto statements =
ZipWith (FieldNames<T>,
" ", types);
1608 return "CREATE TABLE " +
1616 template<
typename ImplFactory,
typename T>
1619 return AdaptCreateTableNamed<T::ClassName, ImplFactory, T> ();
1623 template<
typename T>
1637 template<
typename T,
typename ImplFactory = detail::SQLite::ImplFactory>
1640 if (!db.tables ().contains (ToString<T::ClassName> (), Qt::CaseInsensitive))
1658 template<
typename T>
1661 template<
typename T,
typename ImplFactory = SQLiteImplFactory>
1664 return std::make_unique<ObjectInfo<T>> (Adapt<T, ImplFactory> (db));
1667 template<
typename ImplFactory,
typename... Ts>
1670 ((objects = AdaptPtr<Ts, ImplFactory> (db)), ...);
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
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
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
auto Build() const noexcept
QSqlQuery RunTextQuery(const QSqlDatabase &db, const QString &text)
Runs the given query text on the given db.
void RunQuery(const QSqlDatabase &db, const QString &pluginName, const QString &filename)
Loads the query from the given resource file and runs it.
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)
ObjectInfo_ptr< T > AdaptPtr(const QSqlDatabase &db)
constexpr detail::OrderBy< Orders... > OrderBy
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
Container< T > Filter(const Container< T > &c, F f)
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
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 auto Initializer(const QSqlQuery &q, int startIdx) noexcept
static auto Initializer(const QSqlQuery &q, int startIdx)
static auto Initializer(const QSqlQuery &q, int startIdx)
static auto Initializer(const QSqlQuery &q, int startIdx) noexcept
static auto Initializer(const QSqlQuery &q, int startIdx)
static auto Initializer(const QSqlQuery &q, int startIdx) noexcept