LeechCraft 0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
oral.h File Reference
#include <stdexcept>
#include <type_traits>
#include <memory>
#include <optional>
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/tuple.hpp>
#include <QStringList>
#include <QDateTime>
#include <QSqlQuery>
#include <QSqlRecord>
#include <QVariant>
#include <QtDebug>
#include <util/sll/ctstringutils.h>
#include <util/sll/prelude.h>
#include <util/sll/typelist.h>
#include <util/sll/typegetter.h>
#include <util/sll/void.h>
#include <util/db/dblock.h>
#include <util/db/util.h>
#include "oraltypes.h"
#include "sqliteimpl.h"
Include dependency graph for oral.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  LC::Util::oral::QueryException
struct  LC::Util::oral::detail::UnspecializedSentinel
struct  LC::Util::oral::Type2Name< ImplFactory, T >
struct  LC::Util::oral::Type2Name< ImplFactory, Unique< T > >
struct  LC::Util::oral::Type2Name< ImplFactory, NotNull< T > >
struct  LC::Util::oral::Type2Name< ImplFactory, PKey< T, Tags... > >
struct  LC::Util::oral::Type2Name< ImplFactory, PKey< int, Tags... > >
struct  LC::Util::oral::Type2Name< ImplFactory, std::optional< T > >
struct  LC::Util::oral::Type2Name< ImplFactory, References< Ptr > >
struct  LC::Util::oral::ConvertT< T >
struct  LC::Util::oral::ConvertT< std::optional< T > >
class  LC::Util::oral::detail::AdaptInsert< Seq >
struct  LC::Util::oral::detail::AdaptDelete< Seq >
struct  LC::Util::oral::detail::WrapDirect< T >
class  LC::Util::oral::detail::AssignList< L, R >
class  LC::Util::oral::detail::ExprTree< Type, L, R >
class  LC::Util::oral::detail::ExprTree< ExprType::LeafData, T, void >
class  LC::Util::oral::detail::ExprTree< ExprType::LeafData, std::tuple< Ts... >, void >
struct  LC::Util::oral::detail::MemberPtrs< Ptr >
class  LC::Util::oral::detail::ExprTree< ExprType::LeafStaticPlaceholder, MemberPtrs< Ptr >, void >
class  LC::Util::oral::detail::ExprTree< ExprType::LeafStaticPlaceholder, MemberPtrs< Ptrs... >, void >
class  LC::Util::oral::detail::ExprTree< ExprType::ConstTrue, void, void >
struct  LC::Util::oral::detail::InfixBinary< Op >
struct  LC::Util::oral::detail::InfixBinaryProxy< L, Op >
struct  LC::Util::oral::detail::AggregateType< AggregateFunction, Ptr >
struct  LC::Util::oral::detail::CustomFunctionType< FunRetType, Fun, Ptr >
struct  LC::Util::oral::detail::CountAll
struct  LC::Util::oral::detail::OrderBy< MemberDirectionList >
struct  LC::Util::oral::detail::GroupBy< Ptrs >
struct  LC::Util::oral::detail::SelectWhole
struct  LC::Util::oral::detail::SelectorUnion< L, R >
struct  LC::Util::oral::detail::SelectDistinct< T >
struct  LC::Util::oral::sph::asc< Ptrs >
struct  LC::Util::oral::sph::desc< Ptrs >
struct  LC::Util::oral::Limit
struct  LC::Util::oral::Offset
struct  LC::Util::oral::detail::OrderNone
struct  LC::Util::oral::detail::GroupNone
struct  LC::Util::oral::detail::LimitNone
struct  LC::Util::oral::detail::OffsetNone
struct  LC::Util::oral::detail::DetectShift< Seq, T >
struct  LC::Util::oral::detail::DetectShift< Seq, std::tuple< Args... > >
struct  LC::Util::oral::detail::DetectShift< Seq, Seq >
class  LC::Util::oral::detail::SelectWrapperCommon
struct  LC::Util::oral::detail::HandleSelector< T, Selector >
struct  LC::Util::oral::detail::HSBaseAll
struct  LC::Util::oral::detail::HSBaseFirst
struct  LC::Util::oral::detail::HandleSelector< T, SelectWhole >
struct  LC::Util::oral::detail::HandleSelector< T, SelectDistinct< U > >
struct  LC::Util::oral::detail::HandleSelector< T, MemberPtrs< Ptrs... > >
struct  LC::Util::oral::detail::HandleSelector< T, CustomFunctionType< FunRetType, Fun, Ptr > >
struct  LC::Util::oral::detail::HandleSelector< T, AggregateType< AggregateFunction::Count, std::true_type {}> >
struct  LC::Util::oral::detail::HandleSelector< T, AggregateType< AggregateFunction::Count, Ptr > >
struct  LC::Util::oral::detail::HandleAggSelector< Aggregate, T, Ptr >
struct  LC::Util::oral::detail::HandleSelector< T, AggregateType< AggregateFunction::Min, Ptr > >
struct  LC::Util::oral::detail::HandleSelector< T, AggregateType< AggregateFunction::Max, Ptr > >
struct  LC::Util::oral::detail::HandleSelector< T, SelectorUnion< L, R > >
class  LC::Util::oral::detail::SelectWrapper< T, SelectBehaviour >
class  LC::Util::oral::detail::DeleteByFieldsWrapper< T >
class  LC::Util::oral::detail::AdaptUpdate< T >
struct  LC::Util::oral::ObjectInfo< T >

Namespaces

namespace  LC
namespace  LC::Util
namespace  LC::Util::oral
namespace  LC::Util::oral::detail
namespace  LC::Util::oral::infix
namespace  LC::Util::oral::sph

Concepts

concept  LC::Util::oral::detail::TypeNameCustomizedMember
concept  LC::Util::oral::detail::BaseTypeCustomized
concept  LC::Util::oral::detail::HasPKey
concept  LC::Util::oral::detail::EitherIsExprTree

Macros

#define ORAL_STRING_FIELD_IMPL(index, sname, field)
#define ORAL_STRING_FIELD(_, index, args)
#define ORAL_ADAPT_STRUCT(sname, ...)

Typedefs

using LC::Util::oral::QSqlQuery_ptr = std::shared_ptr<QSqlQuery>
template<typename Seq, int Idx>
using LC::Util::oral::detail::ValueAtC_t = std::decay_t<decltype (Get<Idx> (std::declval<Seq> ()))>
template<typename T>
using LC::Util::oral::detail::UnwrapIndirect_t
template<typename T>
using LC::Util::oral::sph::distinct = detail::SelectDistinct<T>
template<typename T>
using LC::Util::oral::ObjectInfo_ptr = std::unique_ptr<ObjectInfo<T>>

Enumerations

enum class  LC::Util::oral::detail::ExprType {
  LC::Util::oral::detail::ConstTrue ,
  LC::Util::oral::detail::LeafStaticPlaceholder ,
  LC::Util::oral::detail::LeafData ,
  LC::Util::oral::detail::Greater ,
  LC::Util::oral::detail::Less ,
  LC::Util::oral::detail::Equal ,
  LC::Util::oral::detail::Geq ,
  LC::Util::oral::detail::Leq ,
  LC::Util::oral::detail::Neq ,
  LC::Util::oral::detail::Like ,
  LC::Util::oral::detail::ILike ,
  LC::Util::oral::detail::And ,
  LC::Util::oral::detail::Or
}
enum class  LC::Util::oral::detail::AggregateFunction {
  LC::Util::oral::detail::Count ,
  LC::Util::oral::detail::Min ,
  LC::Util::oral::detail::Max
}
enum class  LC::Util::oral::detail::SelectBehaviour {
  LC::Util::oral::detail::Some ,
  LC::Util::oral::detail::One
}
enum class  LC::Util::oral::detail::ResultBehaviour {
  LC::Util::oral::detail::All ,
  LC::Util::oral::detail::First
}

Functions

template<size_t Idx, typename Seq>
constexpr decltype(auto) LC::Util::oral::detail::Get (const Seq &seq)
template<size_t Idx, typename Seq>
constexpr decltype(auto) LC::Util::oral::detail::Get (Seq &seq)
template<typename Seq>
constexpr auto LC::Util::oral::detail::GetFullSize (const Seq &seq)
template<typename T, CtString str>
consteval auto LC::Util::oral::detail::MorphFieldName ()
template<typename Seq, int Idx>
consteval auto LC::Util::oral::detail::GetFieldName ()
template<typename T>
QVariant LC::Util::oral::detail::ToVariantF (const T &t) noexcept
template<size_t Ix, typename Seq>
void LC::Util::oral::detail::BindAtIndex (const Seq &seq, QSqlQuery &query, bool bindPrimaryKey)
template<typename Seq>
auto LC::Util::oral::detail::DoInsert (const Seq &seq, QSqlQuery &insertQuery, bool bindPrimaryKey)
template<typename Seq>
consteval int LC::Util::oral::detail::PKeyIndexUnsafe ()
template<typename Seq>
consteval int LC::Util::oral::detail::PKeyIndex ()
template<typename Seq>
constexpr auto LC::Util::oral::detail::HasAutogenPKey () noexcept
template<typename Seq>
constexpr auto LC::Util::oral::detail::ExtractReplaceFields (InsertAction::Replace::WholeType)
template<typename Seq, auto... Ptrs>
constexpr auto LC::Util::oral::detail::ExtractReplaceFields (InsertAction::Replace::FieldsType< Ptrs... >)
template<typename T, size_t... Indices>
LC::Util::oral::detail::InitializeFromQuery (const QSqlQuery &q, std::index_sequence< Indices... >, int startIdx) noexcept
template<ExprType Type>
constexpr auto LC::Util::oral::detail::TypeToSql () noexcept
constexpr bool LC::Util::oral::detail::IsRelational (ExprType type) noexcept
template<ExprType Type>
constexpr auto LC::Util::oral::detail::WrapSubexpr (auto subexpr)
template<ExprType Type, typename Seq, typename L, typename R>
constexpr bool LC::Util::oral::detail::Typecheck ()
template<typename T>
constexpr auto LC::Util::oral::detail::AsLeafData (const T &node) noexcept
template<ExprType Type, typename L, typename R>
auto LC::Util::oral::detail::MakeExprTree (const L &left, const R &right) noexcept
template<typename L, typename R>
auto LC::Util::oral::detail::operator== (const L &left, const R &right) noexcept
template<typename L, typename R>
auto LC::Util::oral::detail::operator< (const L &left, const R &right) noexcept
template<typename L, typename R>
auto LC::Util::oral::detail::operator<= (const L &left, const R &right) noexcept
template<typename L, typename R>
auto LC::Util::oral::detail::operator> (const L &left, const R &right) noexcept
template<typename L, typename R>
auto LC::Util::oral::detail::operator>= (const L &left, const R &right) noexcept
template<typename L, typename R>
auto LC::Util::oral::detail::operator!= (const L &left, const R &right) noexcept
template<typename L, ExprType Op>
auto LC::Util::oral::detail::operator| (const L &left, InfixBinary< Op >) noexcept
template<typename L, ExprType Op, typename R>
auto LC::Util::oral::detail::operator| (const InfixBinaryProxy< L, Op > &left, const R &right) noexcept
template<typename L, typename R>
auto LC::Util::oral::detail::operator&& (const L &left, const R &right) noexcept
template<typename L, typename R>
auto LC::Util::oral::detail::operator|| (const L &left, const R &right) noexcept
template<CtString BindPrefix, typename Seq, typename Tree>
constexpr auto LC::Util::oral::detail::ExprTreeToSql () noexcept
template<CtString BindPrefix, typename Seq, typename Tree>
void LC::Util::oral::detail::BindExprTree (const Tree &tree, QSqlQuery &query)
template<typename L, typename R>
SelectorUnion< L, R > LC::Util::oral::detail::operator+ (L, R) noexcept
template<auto Ptr>
auto LC::Util::oral::detail::MemberFromVariant (const QVariant &var) noexcept
template<auto Ptr>
auto LC::Util::oral::detail::MakeIndexedQueryHandler (const QSqlQuery &q, int startIdx=0) noexcept
template<auto... Ptrs>
auto LC::Util::oral::detail::MakeIndexedQueryHandler (MemberPtrs< Ptrs... >, const QSqlQuery &q, int startIdx) noexcept
template<size_t RepIdx, size_t TupIdx, typename Tuple, typename NewType>
constexpr decltype(auto) LC::Util::oral::detail::GetReplaceTupleElem (Tuple &&tuple, NewType &&arg) noexcept
template<size_t RepIdx, typename NewType, typename Tuple, size_t... TupIdxs>
constexpr auto LC::Util::oral::detail::ReplaceTupleElemImpl (Tuple &&tuple, NewType &&arg, std::index_sequence< TupIdxs... >) noexcept
template<size_t RepIdx, typename NewType, typename... TupleArgs>
constexpr auto LC::Util::oral::detail::ReplaceTupleElem (std::tuple< TupleArgs... > &&tuple, NewType &&arg) noexcept
template<typename... LArgs, typename... RArgs>
auto LC::Util::oral::detail::Combine (std::tuple< LArgs... > &&left, std::tuple< RArgs... > &&right) noexcept
template<typename... LArgs, typename R>
auto LC::Util::oral::detail::Combine (std::tuple< LArgs... > &&left, const R &right) noexcept
template<typename L, typename... RArgs>
auto LC::Util::oral::detail::Combine (const L &left, std::tuple< RArgs... > &&right) noexcept
template<typename L, typename R>
auto LC::Util::oral::detail::Combine (const L &left, const R &right) noexcept
template<ResultBehaviour ResultBehaviour, typename ResList>
decltype(auto) LC::Util::oral::detail::HandleResultBehaviour (ResList &&list) noexcept
template<typename L, typename O>
constexpr auto LC::Util::oral::detail::LimitOffsetToString () noexcept
template<typename L, typename O>
void LC::Util::oral::detail::BindLimitOffset (QSqlQuery &query, L limit, O offset) noexcept
constexpr auto LC::Util::oral::detail::CombineBehaviour (ResultBehaviour l, ResultBehaviour r) noexcept
template<template< typename... > typename Tgt = std::tuple, template< typename... > typename Src, typename... Vals>
constexpr auto LC::Util::oral::detail::MapTy (Src< Vals... >, auto f)
template<typename Seq, auto... Ptrs>
constexpr auto LC::Util::oral::detail::CreateIndex (const QSqlDatabase &db, Index< Ptrs... >)
template<typename Seq>
void LC::Util::oral::detail::AdaptCreateIndices (const QSqlDatabase &db)
template<auto... Ptrs>
constexpr auto LC::Util::oral::detail::ExtractConstraintFields (UniqueSubset< Ptrs... >)
template<auto... Ptrs>
constexpr auto LC::Util::oral::detail::ExtractConstraintFields (PrimaryKey< Ptrs... >)
template<typename T>
constexpr auto LC::Util::oral::detail::GetConstraintsStrings () noexcept
template<typename ImplFactory, typename T, size_t... Indices>
constexpr auto LC::Util::oral::detail::GetTypes (std::index_sequence< Indices... >) noexcept
template<auto Name, typename ImplFactory, typename T>
constexpr auto LC::Util::oral::detail::AdaptCreateTableNamed () noexcept
template<typename ImplFactory, typename T>
constexpr auto LC::Util::oral::detail::AdaptCreateTable () noexcept
template<typename T, typename ImplFactory = detail::SQLite::ImplFactory>
ObjectInfo< T > LC::Util::oral::Adapt (const QSqlDatabase &db)
template<typename T, typename ImplFactory = SQLiteImplFactory>
ObjectInfo_ptr< T > LC::Util::oral::AdaptPtr (const QSqlDatabase &db)
template<typename ImplFactory = SQLiteImplFactory, typename... Ts>
void LC::Util::oral::AdaptPtrs (const QSqlDatabase &db, ObjectInfo_ptr< Ts > &... objects)

Variables

template<typename>
constexpr bool LC::Util::oral::BeenAdapted = false
template<typename>
constexpr size_t LC::Util::oral::SeqSize = 0
template<typename, int>
constexpr auto LC::Util::oral::MemberNameByIdx = detail::UnspecializedSentinel {}
template<auto>
constexpr auto LC::Util::oral::MemberNameByPtr = detail::UnspecializedSentinel {}
template<typename Seq>
constexpr auto LC::Util::oral::detail::FullSize = decltype (GetFullSize (std::declval<Seq> ()))::value
template<typename S>
constexpr auto LC::Util::oral::detail::SeqIndices = std::make_index_sequence<SeqSize<S>> {}
template<typename S>
constexpr auto LC::Util::oral::detail::FieldNames
template<typename S>
constexpr auto LC::Util::oral::detail::BoundFieldNames
template<typename S>
constexpr auto LC::Util::oral::detail::QualifiedFieldNames
template<auto Ptr>
constexpr auto LC::Util::oral::detail::FieldNameByPtr = MorphFieldName<MemberPtrStruct_t<Ptr>, MemberNameByPtr<Ptr>> ()
template<auto Ptr>
constexpr auto LC::Util::oral::detail::QualifiedFieldNameByPtr = MemberPtrStruct_t<Ptr>::ClassName + "." + FieldNameByPtr<Ptr>
template<typename T>
constexpr auto LC::Util::oral::Convert = ConvertT<T> {}
template<typename T>
constexpr bool LC::Util::oral::detail::IsPKey = false
template<typename U, typename... Tags>
constexpr bool LC::Util::oral::detail::IsPKey< PKey< U, Tags... > > = true
template<typename Seq>
constexpr int LC::Util::oral::detail::PKeyIndex_v = PKeyIndex<Seq> ()
template<typename T>
constexpr bool LC::Util::oral::detail::IsExprTree = false
template<ExprType Type, typename L, typename R>
constexpr bool LC::Util::oral::detail::IsExprTree< ExprTree< Type, L, R > > = true
constexpr auto LC::Util::oral::detail::ConstTrueTree_v = ExprTree<ExprType::ConstTrue> {}
constexpr detail::InfixBinary< detail::ExprType::LikeLC::Util::oral::infix::like {}
constexpr detail::InfixBinary< detail::ExprType::ILikeLC::Util::oral::infix::ilike {}
template<typename T>
constexpr bool LC::Util::oral::detail::IsSelector = false
template<>
constexpr bool LC::Util::oral::detail::IsSelector< SelectWhole > = true
template<AggregateFunction Fun, auto Ptr>
constexpr bool LC::Util::oral::detail::IsSelector< AggregateType< Fun, Ptr > > = true
template<typename FunRetType, CtString Fun, auto Ptr>
constexpr bool LC::Util::oral::detail::IsSelector< CustomFunctionType< FunRetType, Fun, Ptr > > = true
template<auto... Ptrs>
constexpr bool LC::Util::oral::detail::IsSelector< MemberPtrs< Ptrs... > > = true
template<typename L, typename R>
constexpr bool LC::Util::oral::detail::IsSelector< SelectorUnion< L, R > > = true
template<typename T>
constexpr bool LC::Util::oral::detail::IsSelector< SelectDistinct< T > > = true
template<auto Ptr>
constexpr detail::ExprTree< detail::ExprType::LeafStaticPlaceholder, detail::MemberPtrs< Ptr > > LC::Util::oral::sph::f {}
template<auto... Ptrs>
constexpr detail::ExprTree< detail::ExprType::LeafStaticPlaceholder, detail::MemberPtrs< Ptrs... > > LC::Util::oral::sph::tuple {}
template<auto... Ptrs>
constexpr detail::MemberPtrs< Ptrs... > LC::Util::oral::sph::fields {}
constexpr detail::SelectWhole LC::Util::oral::sph::all {}
template<auto Ptr = std::true_type {}>
constexpr detail::AggregateType< detail::AggregateFunction::Count, Ptr > LC::Util::oral::sph::count {}
template<auto Ptr>
constexpr detail::AggregateType< detail::AggregateFunction::Min, Ptr > LC::Util::oral::sph::min {}
template<auto Ptr>
constexpr detail::AggregateType< detail::AggregateFunction::Max, Ptr > LC::Util::oral::sph::max {}
template<typename FunRetType, CtString Fun, auto Ptr>
constexpr detail::CustomFunctionType< FunRetType, Fun, Ptr > LC::Util::oral::sph::fun {}
template<typename... Orders>
constexpr detail::OrderBy< Orders... > LC::Util::oral::OrderBy {}
template<auto... Ptrs>
constexpr detail::GroupBy< Ptrs... > LC::Util::oral::GroupBy {}

Macro Definition Documentation

◆ ORAL_ADAPT_STRUCT

#define ORAL_ADAPT_STRUCT ( sname,
... )
Value:
namespace LC::Util::oral \
{ \
template<> \
constexpr auto BeenAdapted<sname> = true; \
\
template<> \
constexpr auto SeqSize<sname> = BOOST_PP_TUPLE_SIZE((__VA_ARGS__)); \
\
static_assert (SeqSize<sname> == detail::FullSize<sname>); \
\
BOOST_PP_REPEAT(BOOST_PP_TUPLE_SIZE((__VA_ARGS__)), ORAL_STRING_FIELD, (sname, (__VA_ARGS__))) \
}
#define ORAL_STRING_FIELD(_, index, args)
Definition oral.h:41

Definition at line 44 of file oral.h.

◆ ORAL_STRING_FIELD

#define ORAL_STRING_FIELD ( _,
index,
args )
Value:
ORAL_STRING_FIELD_IMPL(index, BOOST_PP_TUPLE_ELEM(0, args), BOOST_PP_TUPLE_ELEM(index, BOOST_PP_TUPLE_ELEM(1, args)))
#define ORAL_STRING_FIELD_IMPL(index, sname, field)
Definition oral.h:35

Definition at line 41 of file oral.h.

◆ ORAL_STRING_FIELD_IMPL

#define ORAL_STRING_FIELD_IMPL ( index,
sname,
field )
Value:
template<> \
constexpr auto MemberNameByIdx<sname, index> = CtString { BOOST_PP_STRINGIZE(field) }; \
template<> \
constexpr auto MemberNameByPtr<&sname::field> = CtString { BOOST_PP_STRINGIZE(field) };

Definition at line 35 of file oral.h.