TreeFrogFramework  1.29
Public Member Functions | Protected Types | Protected Member Functions | Friends | List of all members
TCriteria Class Reference

#include <tcriteria.h>

Public Member Functions

 TCriteria ()
 
 TCriteria (const TCriteria &other)
 
 TCriteria (int property, const QVariant &val)
 
 TCriteria (int property, TSql::ComparisonOperator op)
 
 TCriteria (int property, TSql::ComparisonOperator op, const QVariant &val)
 
 TCriteria (int property, TSql::ComparisonOperator op, const QVariant &val1, const QVariant &val2)
 
 TCriteria (int property, TSql::ComparisonOperator op1, TSql::ComparisonOperator op2, const QVariant &val)
 
 TCriteria (int property, TMongo::ComparisonOperator op)
 
 TCriteria (int property, TMongo::ComparisonOperator op, const QVariant &val)
 
 ~TCriteria ()
 
TCriteriaadd (int property, const QVariant &val)
 
TCriteriaadd (int property, TSql::ComparisonOperator op)
 
TCriteriaadd (int property, TSql::ComparisonOperator op, const QVariant &val)
 
TCriteriaadd (int property, TSql::ComparisonOperator op, const QVariant &val1, const QVariant &val2)
 
TCriteriaadd (int property, TSql::ComparisonOperator op1, TSql::ComparisonOperator op2, const QVariant &val)
 
TCriteriaadd (const TCriteria &criteria)
 
TCriteriaaddOr (int property, const QVariant &val)
 
TCriteriaaddOr (int property, TSql::ComparisonOperator op)
 
TCriteriaaddOr (int property, TSql::ComparisonOperator op, const QVariant &val)
 
TCriteriaaddOr (int property, TSql::ComparisonOperator op, const QVariant &val1, const QVariant &val2)
 
TCriteriaaddOr (int property, TSql::ComparisonOperator op1, TSql::ComparisonOperator op2, const QVariant &val)
 
TCriteriaaddOr (const TCriteria &criteria)
 
TCriteriaadd (int property, TMongo::ComparisonOperator op)
 
TCriteriaadd (int property, TMongo::ComparisonOperator op, const QVariant &val)
 
TCriteriaaddOr (int property, TMongo::ComparisonOperator op)
 
TCriteriaaddOr (int property, TMongo::ComparisonOperator op, const QVariant &val)
 
bool isEmpty () const
 
void clear ()
 
const TCriteria operator&& (const TCriteria &criteria) const
 
const TCriteria operator|| (const TCriteria &criteria) const
 
const TCriteria operator! () const
 
TCriteriaoperator= (const TCriteria &other)
 

Protected Types

enum  LogicalOperator { None = 0, And, Or, Not }
 

Protected Member Functions

const QVariant & first () const
 
const QVariant & second () const
 
LogicalOperator logicalOperator () const
 
TCriteriaadd (LogicalOperator op, const TCriteria &criteria)
 

Friends

template<class T >
class TCriteriaConverter
 
template<class T >
class TCriteriaMongoConverter
 

Detailed Description

The TCriteria class represents a WHERE clause without SQL for the sake of database abstraction.

See also
TSqlObject

Member Enumeration Documentation

◆ LogicalOperator

Enumerator
None 
And 
Or 
Not 

Constructor & Destructor Documentation

◆ TCriteria() [1/9]

TCriteria::TCriteria ( )

Constructor.

◆ TCriteria() [2/9]

TCriteria::TCriteria ( const TCriteria other)

Copy constructor.

◆ TCriteria() [3/9]

TCriteria::TCriteria ( int  property,
const QVariant &  val 
)

Constructs a criteria initialized with a WHERE clause to which a property of ORM object with the index property equals the value val.

See also
TCriteria &TCriteria::add(int property, const QVariant &val)

◆ TCriteria() [4/9]

TCriteria::TCriteria ( int  property,
TSql::ComparisonOperator  op 
)

Constructs a criteria initialized with a WHERE clause to which a property of ORM object with the index property is NULL value or NOT NULL value.

See also
TCriteria &TCriteria::add(int property, TSql::ComparisonOperator op)

◆ TCriteria() [5/9]

TCriteria::TCriteria ( int  property,
TSql::ComparisonOperator  op,
const QVariant &  val 
)

Constructs a criteria initialized with a WHERE clause to which a property of ORM object with the index property is compared with the val value by a means of the op parameter.

See also
TCriteria &TCriteria::add(int property, TSql::ComparisonOperator op, const QVariant &val)

◆ TCriteria() [6/9]

TCriteria::TCriteria ( int  property,
TSql::ComparisonOperator  op,
const QVariant &  val1,
const QVariant &  val2 
)

Constructs a criteria initialized with a WHERE clause to which a property of ORM object with the index property is compared with the val1 value and the val2 value by a means of the op parameter.

See also
TCriteria &TCriteria::add(int property, TSql::ComparisonOperator op, const QVariant &val1, const QVariant &val2)

◆ TCriteria() [7/9]

TCriteria::TCriteria ( int  property,
TSql::ComparisonOperator  op1,
TSql::ComparisonOperator  op2,
const QVariant &  val 
)

Constructs a criteria initialized with a WHERE clause to which a property of ORM object with the index property is compared with the val value by a means of the op1 and op2 parameter.

See also
TCriteria &TCriteria::add(int property, TSql::ComparisonOperator op1, TSql::ComparisonOperator op2, const QVariant &val)

◆ TCriteria() [8/9]

TCriteria::TCriteria ( int  property,
TMongo::ComparisonOperator  op 
)

◆ TCriteria() [9/9]

TCriteria::TCriteria ( int  property,
TMongo::ComparisonOperator  op,
const QVariant &  val 
)

◆ ~TCriteria()

TCriteria::~TCriteria ( )
inline

Member Function Documentation

◆ add() [1/9]

TCriteria & TCriteria::add ( const TCriteria criteria)

Adds a WHERE clause of the criteria parameter with the AND operator.

◆ add() [2/9]

TCriteria & TCriteria::add ( int  property,
const QVariant &  val 
)

Adds a WHERE clause to which a property of ORM object with the index property equals the value val.

◆ add() [3/9]

TCriteria & TCriteria::add ( int  property,
TMongo::ComparisonOperator  op 
)

◆ add() [4/9]

TCriteria & TCriteria::add ( int  property,
TMongo::ComparisonOperator  op,
const QVariant &  val 
)

◆ add() [5/9]

TCriteria & TCriteria::add ( int  property,
TSql::ComparisonOperator  op 
)

Adds a WHERE clause to which a property of ORM object with the index property is NULL value or NOT NULL value.

The op parameter must be TSql::IsNull or TSql::IsNotNull.

◆ add() [6/9]

TCriteria & TCriteria::add ( int  property,
TSql::ComparisonOperator  op,
const QVariant &  val 
)

Adds a WHERE clause to which a property of ORM object with the index property is compared with the val value by a means of the op parameter.

The op parameter must be one of the following constants:
TSql::Equal, TSql::NotEqual, TSql::LessThan, TSql::GreaterThan, TSql::LessEqual, TSql::GreaterEqual, TSql::Like, TSql::NotLike, TSql::ILike, TSql::NotILike.

◆ add() [7/9]

TCriteria & TCriteria::add ( int  property,
TSql::ComparisonOperator  op,
const QVariant &  val1,
const QVariant &  val2 
)

Adds a WHERE clause to which a property of ORM object with the index property is compared with the val1 value and the val2 value by a means of the op parameter.

The op parameter must be one of the following constants:
TSql::LikeEscape, TSql::NotLikeEscape, TSql::ILikeEscape, TSql::NotILikeEscape, TSql::Between, TSql::NotBetween.

◆ add() [8/9]

TCriteria & TCriteria::add ( int  property,
TSql::ComparisonOperator  op1,
TSql::ComparisonOperator  op2,
const QVariant &  val 
)

Adds a WHERE clause to which a property of ORM object with the index property is compared with the val value by a means of the op1 and op2 parameter.

This function is used with TSql::Any or TSql::All constant as the op2 parameter to generate a WHERE clause such as "column >= any (10, 20, 50)".

◆ add() [9/9]

TCriteria & TCriteria::add ( LogicalOperator  op,
const TCriteria criteria 
)
protected

Adds a WHERE clause of the criteria parameter with the op operator.

◆ addOr() [1/8]

TCriteria & TCriteria::addOr ( const TCriteria criteria)

Adds a WHERE clause of the criteria parameter with the OR operator.

◆ addOr() [2/8]

TCriteria & TCriteria::addOr ( int  property,
const QVariant &  val 
)

Adds a WHERE clause with OR operator to which a property of ORM object with the index property equals the value val.

◆ addOr() [3/8]

TCriteria & TCriteria::addOr ( int  property,
TMongo::ComparisonOperator  op 
)

◆ addOr() [4/8]

TCriteria & TCriteria::addOr ( int  property,
TMongo::ComparisonOperator  op,
const QVariant &  val 
)

◆ addOr() [5/8]

TCriteria & TCriteria::addOr ( int  property,
TSql::ComparisonOperator  op 
)

Adds a WHERE clause with OR operator to which a property of ORM object with the index property is NULL value or NOT NULL value.

The op parameter must be TSql::IsNull or TSql::IsNotNull.

◆ addOr() [6/8]

TCriteria & TCriteria::addOr ( int  property,
TSql::ComparisonOperator  op,
const QVariant &  val 
)

Adds a WHERE clause with OR operator to which a property of ORM object with the index property is compared with the val value by a means of the op parameter.

◆ addOr() [7/8]

TCriteria & TCriteria::addOr ( int  property,
TSql::ComparisonOperator  op,
const QVariant &  val1,
const QVariant &  val2 
)

Adds a WHERE clause with OR operator to which a property of ORM object with the index property is compared with the val1 value and the val2 value by a means of the op parameter.

The op parameter must be one of the following constants:
TSql::LikeEscape, TSql::NotLikeEscape, TSql::ILikeEscape, TSql::NotILikeEscape, TSql::Between, TSql::NotBetween.

◆ addOr() [8/8]

TCriteria & TCriteria::addOr ( int  property,
TSql::ComparisonOperator  op1,
TSql::ComparisonOperator  op2,
const QVariant &  val 
)

Adds a WHERE clause with OR operator to which a property of ORM object with the index property is compared with the val value by a means of the op1 and op2 parameter.

This function is used with TSql::Any or TSql::All constant as the op2 parameter to generate a WHERE clause such as "column >= any (10, 20, 50)".

◆ clear()

void TCriteria::clear ( )

Clears the criteria and makes it empty.

◆ first()

const QVariant & TCriteria::first ( ) const
inlineprotected

This function is for internal use only.

◆ isEmpty()

bool TCriteria::isEmpty ( ) const

Returns true if the criteria has no data; otherwise returns false.

◆ logicalOperator()

LogicalOperator TCriteria::logicalOperator ( ) const
inlineprotected

This function is for internal use only.

◆ operator!()

const TCriteria TCriteria::operator! ( ) const

Returns a WHERE clause that negated this criteria.

◆ operator&&()

const TCriteria TCriteria::operator&& ( const TCriteria criteria) const

Adds a WHERE clause of the criteria parameter with the AND operator.

See also
TCriteria &TCriteria::add(const TCriteria &criteria)

◆ operator=()

TCriteria & TCriteria::operator= ( const TCriteria other)

Assignment operator.

◆ operator||()

const TCriteria TCriteria::operator|| ( const TCriteria criteria) const

Adds a WHERE clause of the criteria parameter with the OR operator.

See also
TCriteria &TCriteria::addOr(const TCriteria &criteria)

◆ second()

const QVariant & TCriteria::second ( ) const
inlineprotected

This function is for internal use only.

Friends And Related Function Documentation

◆ TCriteriaConverter

template<class T >
friend class TCriteriaConverter
friend

◆ TCriteriaMongoConverter

template<class T >
friend class TCriteriaMongoConverter
friend

The documentation for this class was generated from the following files: