LeechCraft  0.6.70-10870-g558588d6ec
Modular cross-platform feature rich live environment.
LeechCraft::Util::oral::detail Namespace Reference

Classes

struct  AdaptDelete
 
struct  AdaptInsert
 
class  AdaptUpdate
 
struct  AddressOf
 
struct  AggregateType
 
class  AssignList
 
struct  CachedFieldsData
 
struct  ConstraintToString
 
struct  ConstraintToString< PrimaryKey< Fields... > >
 
struct  ConstraintToString< UniqueSubset< Fields... > >
 
class  DeleteByFieldsWrapper
 
class  ExprTree
 
class  ExprTree< ExprType::ConstTrue, void, void >
 
class  ExprTree< ExprType::LeafData, T, void >
 
class  ExprTree< ExprType::LeafStaticPlaceholder, boost::mpl::int_< Idx >, void >
 
class  ExprTree< ExprType::LeafStaticPlaceholder, MemberPtrs< Ptr >, void >
 
struct  FieldsUnpacker
 
struct  FieldsUnpacker< HeadT >
 
struct  FindPKey
 
struct  GetBoundName
 
struct  GetFieldName
 
struct  GetFieldsNames
 
struct  IsExprTree
 
struct  IsExprTree< ExprTree< Type, L, R > >
 
struct  IsPKey
 
struct  IsPKey< PKey< U, Tags... > >
 
struct  MemberPtrs
 
struct  RelationalTypesChecker
 
struct  RelationalTypesChecker< Type, Seq, L, R, std::enable_if_t< IsRelational(Type)> >
 
struct  RelationalTypesCheckerBase
 
struct  RelationalTypesCheckerBase< Seq, L, R, std::enable_if_t< AreComparableTypes< Seq, L, R > > >
 
class  SelectWrapper
 
struct  ToSqlState
 
struct  ValueBinder
 
struct  ValueBinder< FieldsUnpacker, HeadArg >
 
struct  WrapDirect
 

Typedefs

template<typename U >
using MorpherDetector = decltype(std::declval< U >().FieldNameMorpher(QString {}))
 
template<typename Seq , int Idx>
using ValueAtC_t = typename boost::fusion::result_of::value_at_c< Seq, Idx >::type
 
template<typename Seq , typename Idx >
using ValueAt_t = typename boost::fusion::result_of::value_at< Seq, Idx >::type
 
template<typename Seq >
using FindPKeyDetector = boost::mpl::int_< FindPKey< Seq >::result_type::value >
 
template<typename T , typename... Args>
using AggregateDetector_t = decltype(new T { std::declval< Args >()... })
 
template<typename T >
using UnwrapIndirect_t = typename std::conditional_t< IsIndirect< T > {}, T, WrapDirect< T > >::value_type
 
template<typename Seq , typename L , typename R >
using ComparableDetector = decltype(std::declval< UnwrapIndirect_t< typename L::template ValueType_t< Seq > >>()==std::declval< UnwrapIndirect_t< typename R::template ValueType_t< Seq > >>())
 
template<typename L , typename R >
using EnableRelOp_t = std::enable_if_t< AnyOf< IsExprTree, L, R > >
 
template<typename T >
using ConstraintsDetector = typename T::Constraints
 
template<typename T >
using ConstraintsType = Util::IsDetected_t< Constraints<>, ConstraintsDetector, T >
 

Enumerations

enum  ExprType {
  ExprType::ConstTrue,
  ExprType::LeafStaticPlaceholder,
  ExprType::LeafData,
  ExprType::Greater,
  ExprType::Less,
  ExprType::Equal,
  ExprType::Geq,
  ExprType::Leq,
  ExprType::Neq,
  ExprType::And,
  ExprType::Or
}
 
enum  AggregateFunction { AggregateFunction::Count }
 
enum  SelectBehaviour {
  SelectBehaviour::Some,
  SelectBehaviour::One
}
 

Functions

bool MatchesSchema (const QString &baseName, const QString &schema, QSqlDatabase &db)
 
template<typename T >
QString MorphFieldName (QString str)
 
template<auto Ptr, size_t Idx = 0>
constexpr size_t FieldIndex ()
 
template<typename T >
QVariant ToVariantF (const T &t)
 
template<typename T >
CachedFieldsData BuildCachedFieldsData (const QString &table)
 
template<typename T >
CachedFieldsData BuildCachedFieldsData ()
 
template<typename T >
auto MakeInserter (const CachedFieldsData &data, const QSqlQuery_ptr &insertQuery, bool bindPrimaryKey)
 
template<typename Seq >
constexpr auto HasAutogenPKey ()
 
QString GetInsertPrefix (InsertAction action)
 
template<typename T , size_t... Indices>
InitializeFromQuery (const QSqlQuery &q, std::index_sequence< Indices... >)
 
QString TypeToSql (ExprType type)
 
constexpr bool IsRelational (ExprType type)
 
template<typename T >
constexpr auto AsLeafData (const T &node)
 
template<ExprType Type, typename L , typename R >
ExprTree< Type, L, R > MakeExprTree (const L &left, const R &right)
 
template<typename L , typename R , typename = EnableRelOp_t<L, R>>
auto operator< (const L &left, const R &right)
 
template<typename L , typename R , typename = EnableRelOp_t<L, R>>
auto operator> (const L &left, const R &right)
 
template<typename L , typename R , typename = EnableRelOp_t<L, R>>
auto operator== (const L &left, const R &right)
 
template<typename L , typename R , typename = EnableRelOp_t<L, R>>
auto operator && (const L &left, const R &right)
 
template<typename >
auto HandleExprTree (const ExprTree< ExprType::ConstTrue > &, int lastId=0)
 
template<typename Seq , typename Tree , typename = decltype (std::declval<Tree> ().ToSql (std::declval<ToSqlState<Seq>&> ()))>
auto HandleExprTree (const Tree &tree, int lastId=0)
 
template<auto... Ptrs, size_t... Idxs>
auto MakeIndexedQueryHandler (detail::MemberPtrs< Ptrs... >, std::index_sequence< Idxs... >)
 
template<auto... Ptrs>
QStringList BuildFieldNames ()
 
template<typename... Args>
QStringList GetConstraintsStringList (Constraints< Args... >, const CachedFieldsData &data)
 
template<typename T , size_t... Indices>
QList< QString > GetTypes (std::index_sequence< Indices... >)
 
template<typename T >
QString AdaptCreateTable (const CachedFieldsData &data)
 

Variables

template<typename S >
constexpr auto SeqSize = boost::fusion::result_of::size<S>::type::value
 
template<typename S >
constexpr auto SeqIndices = std::make_index_sequence<SeqSize<S>> {}
 
template<typename Seq >
constexpr auto HasPKey = IsDetected_v<FindPKeyDetector, Seq>
 
template<typename Seq , typename L , typename R >
constexpr auto AreComparableTypes = IsDetected_v<ComparableDetector, Seq, L, R> || IsDetected_v<ComparableDetector, Seq, R, L>
 
constexpr auto ConstTrueTree_v = ExprTree<ExprType::ConstTrue> {}
 
template<typename L , typename R >
constexpr auto AllTrees_v = AllOf<IsExprTree, L, R>
 

Typedef Documentation

◆ AggregateDetector_t

template<typename T , typename... Args>
using LeechCraft::Util::oral::detail::AggregateDetector_t = typedef decltype (new T { std::declval<Args> ()... })

Definition at line 510 of file oral.h.

◆ ComparableDetector

template<typename Seq , typename L , typename R >
using LeechCraft::Util::oral::detail::ComparableDetector = typedef decltype (std::declval<UnwrapIndirect_t<typename L::template ValueType_t<Seq> >> () == std::declval<UnwrapIndirect_t<typename R::template ValueType_t<Seq> >> ())

Definition at line 647 of file oral.h.

◆ ConstraintsDetector

template<typename T >
using LeechCraft::Util::oral::detail::ConstraintsDetector = typedef typename T::Constraints

Definition at line 1179 of file oral.h.

◆ ConstraintsType

Definition at line 1182 of file oral.h.

◆ EnableRelOp_t

template<typename L , typename R >
using LeechCraft::Util::oral::detail::EnableRelOp_t = typedef std::enable_if_t<AnyOf<IsExprTree, L, R> >

Definition at line 843 of file oral.h.

◆ FindPKeyDetector

template<typename Seq >
using LeechCraft::Util::oral::detail::FindPKeyDetector = typedef boost::mpl::int_<FindPKey<Seq>::result_type::value>

Definition at line 369 of file oral.h.

◆ MorpherDetector

template<typename U >
using LeechCraft::Util::oral::detail::MorpherDetector = typedef decltype (std::declval<U> ().FieldNameMorpher (QString {}))

Definition at line 101 of file oral.h.

◆ UnwrapIndirect_t

template<typename T >
using LeechCraft::Util::oral::detail::UnwrapIndirect_t = typedef typename std::conditional_t<IsIndirect<T> {}, T, WrapDirect<T> >::value_type

Definition at line 643 of file oral.h.

◆ ValueAt_t

template<typename Seq , typename Idx >
using LeechCraft::Util::oral::detail::ValueAt_t = typedef typename boost::fusion::result_of::value_at<Seq, Idx>::type

Definition at line 347 of file oral.h.

◆ ValueAtC_t

template<typename Seq , int Idx>
using LeechCraft::Util::oral::detail::ValueAtC_t = typedef typename boost::fusion::result_of::value_at_c<Seq, Idx>::type

Definition at line 344 of file oral.h.

Enumeration Type Documentation

◆ AggregateFunction

Enumerator
Count 

Definition at line 910 of file oral.h.

◆ ExprType

Enumerator
ConstTrue 
LeafStaticPlaceholder 
LeafData 
Greater 
Less 
Equal 
Geq 
Leq 
Neq 
And 
Or 

Definition at line 569 of file oral.h.

◆ SelectBehaviour

Enumerator
Some 
One 

Definition at line 959 of file oral.h.

Function Documentation

◆ AdaptCreateTable()

template<typename T >
QString LeechCraft::Util::oral::detail::AdaptCreateTable ( const CachedFieldsData data)

◆ AsLeafData()

template<typename T >
constexpr auto LeechCraft::Util::oral::detail::AsLeafData ( const T &  node)

◆ BuildCachedFieldsData() [1/2]

template<typename T >
CachedFieldsData LeechCraft::Util::oral::detail::BuildCachedFieldsData ( const QString &  table)

Definition at line 305 of file oral.h.

References LeechCraft::Util::oral::sph::fields, and LeechCraft::Util::Map().

+ Here is the call graph for this function:

◆ BuildCachedFieldsData() [2/2]

template<typename T >
CachedFieldsData LeechCraft::Util::oral::detail::BuildCachedFieldsData ( )

Definition at line 315 of file oral.h.

◆ BuildFieldNames()

template<auto... Ptrs>
QStringList LeechCraft::Util::oral::detail::BuildFieldNames ( )

Definition at line 954 of file oral.h.

◆ FieldIndex()

template<auto Ptr, size_t Idx = 0>
constexpr size_t LeechCraft::Util::oral::detail::FieldIndex ( )

Definition at line 171 of file oral.h.

◆ GetConstraintsStringList()

template<typename... Args>
QStringList LeechCraft::Util::oral::detail::GetConstraintsStringList ( Constraints< Args... >  ,
const CachedFieldsData data 
)

Definition at line 1206 of file oral.h.

Referenced by AdaptCreateTable().

+ Here is the caller graph for this function:

◆ GetInsertPrefix()

QString LeechCraft::Util::oral::detail::GetInsertPrefix ( InsertAction  action)
inline

Definition at line 383 of file oral.h.

References LeechCraft::Util::oral::Default, LeechCraft::Util::oral::Ignore, LeechCraft::Util::oral::Replace, and LeechCraft::Util::Unreachable().

+ Here is the call graph for this function:

◆ GetTypes()

template<typename T , size_t... Indices>
QList<QString> LeechCraft::Util::oral::detail::GetTypes ( std::index_sequence< Indices... >  )

Definition at line 1212 of file oral.h.

◆ HandleExprTree() [1/2]

template<typename >
auto LeechCraft::Util::oral::detail::HandleExprTree ( const ExprTree< ExprType::ConstTrue > &  ,
int  lastId = 0 
)

Definition at line 885 of file oral.h.

◆ HandleExprTree() [2/2]

template<typename Seq , typename Tree , typename = decltype (std::declval<Tree> ().ToSql (std::declval<ToSqlState<Seq>&> ()))>
auto LeechCraft::Util::oral::detail::HandleExprTree ( const Tree &  tree,
int  lastId = 0 
)

Definition at line 892 of file oral.h.

References LeechCraft::Util::oral::detail::ToSqlState< T >::LastID_, and LeechCraft::Util::Stlize().

+ Here is the call graph for this function:

◆ HasAutogenPKey()

template<typename Seq >
constexpr auto LeechCraft::Util::oral::detail::HasAutogenPKey ( )

Definition at line 375 of file oral.h.

◆ InitializeFromQuery()

template<typename T , size_t... Indices>
T LeechCraft::Util::oral::detail::InitializeFromQuery ( const QSqlQuery &  q,
std::index_sequence< Indices... >   
)

Definition at line 513 of file oral.h.

References LeechCraft::Util::IsDetected_v.

◆ IsRelational()

constexpr bool LeechCraft::Util::oral::detail::IsRelational ( ExprType  type)

Definition at line 617 of file oral.h.

References Equal, Geq, Greater, Leq, Less, and Neq.

◆ MakeExprTree()

template<ExprType Type, typename L , typename R >
ExprTree<Type, L, R> LeechCraft::Util::oral::detail::MakeExprTree ( const L &  left,
const R &  right 
)

Definition at line 837 of file oral.h.

◆ MakeIndexedQueryHandler()

template<auto... Ptrs, size_t... Idxs>
auto LeechCraft::Util::oral::detail::MakeIndexedQueryHandler ( detail::MemberPtrs< Ptrs... >  ,
std::index_sequence< Idxs... >   
)

Definition at line 942 of file oral.h.

◆ MakeInserter()

template<typename T >
auto LeechCraft::Util::oral::detail::MakeInserter ( const CachedFieldsData data,
const QSqlQuery_ptr insertQuery,
bool  bindPrimaryKey 
)

Definition at line 322 of file oral.h.

References LeechCraft::Util::oral::detail::CachedFieldsData::BoundFields_, LeechCraft::Util::DBLock::DumpError(), and ToVariantF().

+ Here is the call graph for this function:

◆ MatchesSchema()

bool LeechCraft::Util::oral::detail::MatchesSchema ( const QString &  baseName,
const QString &  schema,
QSqlDatabase &  db 
)

Definition at line 42 of file migrate.h.

References LeechCraft::Util::RunTextQuery().

Referenced by LeechCraft::Util::oral::Migrate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ MorphFieldName()

template<typename T >
QString LeechCraft::Util::oral::detail::MorphFieldName ( QString  str)

Definition at line 104 of file oral.h.

◆ operator &&()

template<typename L , typename R , typename = EnableRelOp_t<L, R>>
auto LeechCraft::Util::oral::detail::operator&& ( const L &  left,
const R &  right 
)

Definition at line 876 of file oral.h.

References AsLeafData().

+ Here is the call graph for this function:

◆ operator<()

template<typename L , typename R , typename = EnableRelOp_t<L, R>>
auto LeechCraft::Util::oral::detail::operator< ( const L &  left,
const R &  right 
)

Definition at line 849 of file oral.h.

References AsLeafData().

+ Here is the call graph for this function:

◆ operator==()

template<typename L , typename R , typename = EnableRelOp_t<L, R>>
auto LeechCraft::Util::oral::detail::operator== ( const L &  left,
const R &  right 
)

Definition at line 867 of file oral.h.

References AsLeafData().

+ Here is the call graph for this function:

◆ operator>()

template<typename L , typename R , typename = EnableRelOp_t<L, R>>
auto LeechCraft::Util::oral::detail::operator> ( const L &  left,
const R &  right 
)

Definition at line 858 of file oral.h.

References AsLeafData().

+ Here is the call graph for this function:

◆ ToVariantF()

template<typename T >
QVariant LeechCraft::Util::oral::detail::ToVariantF ( const T &  t)

◆ TypeToSql()

QString LeechCraft::Util::oral::detail::TypeToSql ( ExprType  type)
inline

Definition at line 587 of file oral.h.

References And, ConstTrue, Equal, Geq, Greater, LeafData, LeafStaticPlaceholder, Leq, Less, Neq, Or, and LeechCraft::Util::Unreachable().

Referenced by LeechCraft::Util::oral::detail::ExprTree< Type, L, R >::ToSql().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ AllTrees_v

template<typename L , typename R >
constexpr auto LeechCraft::Util::oral::detail::AllTrees_v = AllOf<IsExprTree, L, R>

Definition at line 846 of file oral.h.

◆ AreComparableTypes

template<typename Seq , typename L , typename R >
constexpr auto LeechCraft::Util::oral::detail::AreComparableTypes = IsDetected_v<ComparableDetector, Seq, L, R> || IsDetected_v<ComparableDetector, Seq, R, L>

Definition at line 650 of file oral.h.

◆ ConstTrueTree_v

constexpr auto LeechCraft::Util::oral::detail::ConstTrueTree_v = ExprTree<ExprType::ConstTrue> {}

◆ HasPKey

template<typename Seq >
constexpr auto LeechCraft::Util::oral::detail::HasPKey = IsDetected_v<FindPKeyDetector, Seq>

Definition at line 372 of file oral.h.

◆ SeqIndices

template<typename S >
constexpr auto LeechCraft::Util::oral::detail::SeqIndices = std::make_index_sequence<SeqSize<S>> {}

Definition at line 129 of file oral.h.

◆ SeqSize

template<typename S >
constexpr auto LeechCraft::Util::oral::detail::SeqSize = boost::fusion::result_of::size<S>::type::value

Definition at line 126 of file oral.h.