QDjango
Public Types | Public Member Functions | Friends
QDjangoWhere Class Reference

The QDjangoWhere class expresses an SQL constraint. More...

#include <QDjangoWhere.h>

List of all members.

Public Types

enum  Operation {
  None, Equals, NotEquals, GreaterThan,
  LessThan, GreaterOrEquals, LessOrEquals, StartsWith,
  EndsWith, Contains, IsIn, IsNull
}

Public Member Functions

 QDjangoWhere ()
 QDjangoWhere (const QDjangoWhere &other)
 QDjangoWhere (const QString &key, QDjangoWhere::Operation operation, QVariant value)
 ~QDjangoWhere ()
QDjangoWhereoperator= (const QDjangoWhere &other)
QDjangoWhere operator! () const
QDjangoWhere operator&& (const QDjangoWhere &other) const
QDjangoWhere operator|| (const QDjangoWhere &other) const
void bindValues (QDjangoQuery &query) const
bool isAll () const
bool isNone () const
QString sql (const QSqlDatabase &db) const

Friends

class QDjangoCompiler

Detailed Description

The QDjangoWhere class expresses an SQL constraint.

The QDjangoWhere class is used to build SQL WHERE statements. In its simplest form a QDjangoWhere expresses a constraint on a column value.

QDjangoWhere instances can be negated using the "!" unary operator or combined using the "&&" and "||" boolean operators.


Member Enumeration Documentation

A comparison operation on a database column value.

Enumerator:
None 

No comparison, always returns true.

Equals 

Returns true if the column value is equal to the given value.

NotEquals 

Returns true if the column value is not equal to the given value.

GreaterThan 

Returns true if the column value is greater than the given value.

LessThan 

Returns true if the column value is less than the given value.

GreaterOrEquals 

Returns true if the column value is greater or equal to the given value.

LessOrEquals 

Returns true if the column value is less or equal to the given value.

StartsWith 

Returns true if the column value starts with the given value (strings only).

EndsWith 

Returns true if the column value ends with the given value (strings only).

Contains 

Returns true if the column value contains the given value (strings only).

IsIn 

Returns true if the column value is one of the given values.

IsNull 

Returns true if the column value is null.


Constructor & Destructor Documentation

Constructs an empty QDjangoWhere, which expresses no constraint.

Constructs a copy of other.

QDjangoWhere::QDjangoWhere ( const QString &  key,
QDjangoWhere::Operation  operation,
QVariant  value 
)

Constructs a QDjangoWhere expressing a constraint on a database column.

Parameters:
key
operation
value

Destroys a QDjangoWhere.


Member Function Documentation

void QDjangoWhere::bindValues ( QDjangoQuery &  query) const

Bind the values associated with this QDjangoWhere to the given query.

Parameters:
query
bool QDjangoWhere::isAll ( ) const

Returns true if the current QDjangoWhere does not express any constraint.

bool QDjangoWhere::isNone ( ) const

Returns true if the current QDjangoWhere expressed an impossible constraint.

Negates the current QDjangoWhere.

QDjangoWhere QDjangoWhere::operator&& ( const QDjangoWhere other) const

Combines the current QDjangoWhere with the other QDjangoWhere using a logical AND.

Parameters:
other
QDjangoWhere & QDjangoWhere::operator= ( const QDjangoWhere other)

Assigns other to this QDjangoWhere.

QDjangoWhere QDjangoWhere::operator|| ( const QDjangoWhere other) const

Combines the current QDjangoWhere with the other QDjangoWhere using a logical OR.

Parameters:
other
QString QDjangoWhere::sql ( const QSqlDatabase &  db) const

Returns the SQL code corresponding for the current QDjangoWhere.


The documentation for this class was generated from the following files:
 All Classes Functions Typedefs Enumerations Enumerator Properties