QDjango
Loading...
Searching...
No Matches
QDjangoWhere.h
1/*
2 * Copyright (C) 2010-2015 Jeremy Lainé
3 * Contact: https://github.com/jlaine/qdjango
4 *
5 * This file is part of the QDjango Library.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 */
17
18#ifndef QDJANGO_WHERE_H
19#define QDJANGO_WHERE_H
20
21#include <QSharedDataPointer>
22#include <QVariant>
23
24#include "QDjango_p.h"
25
27class QDjangoQuery;
28class QDjangoWherePrivate;
29
40class QDJANGO_DB_EXPORT QDjangoWhere
41{
42public:
63
65 QDjangoWhere(const QDjangoWhere &other);
66 QDjangoWhere(const QString &key, QDjangoWhere::Operation operation, QVariant value);
68
69 QDjangoWhere& operator=(const QDjangoWhere &other);
70 QDjangoWhere operator!() const;
71 QDjangoWhere operator&&(const QDjangoWhere &other) const;
72 QDjangoWhere operator||(const QDjangoWhere &other) const;
73
74 void bindValues(QDjangoQuery &query) const;
75 bool isAll() const;
76 bool isNone() const;
77 QString sql(const QSqlDatabase &db) const;
78 QString toString() const;
79
80private:
81 QSharedDataPointer<QDjangoWherePrivate> d;
82 friend class QDjangoCompiler;
83};
84
85#endif
The QDjangoMetaModel class holds the database schema for a model.
Definition QDjangoMetaModel.h:65
The QDjangoWhere class expresses an SQL constraint.
Definition QDjangoWhere.h:41
Operation
A comparison operation on a database column value.
Definition QDjangoWhere.h:44
@ Contains
Returns true if the column value contains the given value (strings only).
Definition QDjangoWhere.h:54
@ GreaterOrEquals
Returns true if the column value is greater or equal to the given value.
Definition QDjangoWhere.h:50
@ StartsWith
Returns true if the column value starts with the given value (strings only).
Definition QDjangoWhere.h:52
@ INotEquals
Returns true if the column value is not equal to the given value (case-insensitive).
Definition QDjangoWhere.h:58
@ LessThan
Returns true if the column value is less than the given value.
Definition QDjangoWhere.h:49
@ EndsWith
Returns true if the column value ends with the given value (strings only).
Definition QDjangoWhere.h:53
@ GreaterThan
Returns true if the column value is greater than the given value.
Definition QDjangoWhere.h:48
@ NotEquals
Returns true if the column value is not equal to the given value.
Definition QDjangoWhere.h:47
@ IStartsWith
Returns true if the column value starts with the given value (strings only, case-insensitive).
Definition QDjangoWhere.h:59
@ IEquals
Returns true if the column value is equal to the given value (case-insensitive)
Definition QDjangoWhere.h:57
@ IsIn
Returns true if the column value is one of the given values.
Definition QDjangoWhere.h:55
@ Equals
Returns true if the column value is equal to the given value.
Definition QDjangoWhere.h:46
@ LessOrEquals
Returns true if the column value is less or equal to the given value.
Definition QDjangoWhere.h:51
@ IEndsWith
Returns true if the column value ends with the given value (strings only, case-insensitive).
Definition QDjangoWhere.h:60
@ None
No comparison, always returns true.
Definition QDjangoWhere.h:45
@ IsNull
Returns true if the column value is null.
Definition QDjangoWhere.h:56