QDjango: QDjangoWhere Class Reference

QDjango

Public Types | Public Member Functions | Friends | List of all members
QDjangoWhere Class Reference
Database

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

`#include <QDjangoWhere.h>`

## Public Types
enum | Operation { None, Equals, NotEquals, GreaterThan, LessThan, GreaterOrEquals, LessOrEquals, StartsWith, EndsWith, Contains, IsIn, IsNull, IEquals, INotEquals, IStartsWith, IEndsWith, IContains }
enum | AggregateType { AVG, COUNT, SUM, MIN, MAX }

## Public Member Functions
| QDjangoWhere ()
| QDjangoWhere (const QDjangoWhere &other)
| QDjangoWhere (const QString &key, QDjangoWhere::Operation operation, QVariant value)
| ~QDjangoWhere ()
QDjangoWhere & | operator= (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
QString | toString () 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

## ◆ Operation

enum QDjangoWhere::Operation

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.
IEquals | Returns true if the column value is equal to the given value (case-insensitive)
INotEquals | Returns true if the column value is not equal to the given value (case-insensitive).
IStartsWith | Returns true if the column value starts with the given value (strings only, case-insensitive).
IEndsWith | Returns true if the column value ends with the given value (strings only, case-insensitive).
IContains | Returns true if the column value contains the given value (strings only, case-insensitive).

## Constructor & Destructor Documentation

## ◆ QDjangoWhere() [1/3]

QDjangoWhere::QDjangoWhere | ( |  | ) |

Constructs an empty QDjangoWhere, which expresses no constraint.

## ◆ QDjangoWhere() [2/3]

QDjangoWhere::QDjangoWhere | ( | const QDjangoWhere & | other | ) |

Constructs a copy of other.

## ◆ QDjangoWhere() [3/3]

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

Constructs a QDjangoWhere expressing a constraint on a database column.

Parameters

  key |
  operation |
  value |

## ◆ ~QDjangoWhere()

QDjangoWhere::~QDjangoWhere | ( |  | ) |

Destroys a QDjangoWhere.

## Member Function Documentation

## ◆ bindValues()

void QDjangoWhere::bindValues | ( | QDjangoQuery & | query | ) | const

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

Parameters

  query |

## ◆ isAll()

bool QDjangoWhere::isAll | ( |  | ) | const

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

## ◆ isNone()

bool QDjangoWhere::isNone | ( |  | ) | const

Returns true if the current QDjangoWhere expressed an impossible constraint.

## ◆ operator!()

QDjangoWhere QDjangoWhere::operator! | ( |  | ) | const

Negates the current QDjangoWhere.

## ◆ operator&&()

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

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

Parameters

  other |

## ◆ operator=()

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

Assigns other to this QDjangoWhere.

## ◆ operator||()

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

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

Parameters

  other |

## ◆ sql()

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:

- QDjangoWhere.h
- QDjangoWhere.cpp