TreeFrogFramework  1.18
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

Enumerator
None 
And 
Or 
Not 

Constructor & Destructor Documentation

TCriteria::TCriteria ( )

Constructor.

TCriteria::TCriteria ( const TCriteria other)

Copy constructor.

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::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::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::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::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::TCriteria ( int  property,
TMongo::ComparisonOperator  op 
)
TCriteria::TCriteria ( int  property,
TMongo::ComparisonOperator  op,
const QVariant &  val 
)
TCriteria::~TCriteria ( )
inline

Member Function Documentation

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.

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.

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.

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.

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)".

TCriteria & TCriteria::add ( const TCriteria criteria)

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

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

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

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.

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.

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.

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.

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)".

TCriteria & TCriteria::addOr ( const TCriteria criteria)

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

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

Clears the criteria and makes it empty.

const QVariant & TCriteria::first ( ) const
inlineprotected

This function is for internal use only.

bool TCriteria::isEmpty ( ) const

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

LogicalOperator TCriteria::logicalOperator ( ) const
inlineprotected

This function is for internal use only.

const TCriteria TCriteria::operator! ( ) const

Returns a WHERE clause that negated this criteria.

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)
TCriteria & TCriteria::operator= ( const TCriteria other)

Assignment 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)
const QVariant & TCriteria::second ( ) const
inlineprotected

This function is for internal use only.

Friends And Related Function Documentation

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

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