QDjango
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 
26 class QDjangoMetaModel;
27 class QDjangoQuery;
28 class QDjangoWherePrivate;
29 
40 class QDJANGO_DB_EXPORT QDjangoWhere
41 {
42 public:
43  enum Operation
44  {
61  IContains
62  };
63 
64  QDjangoWhere();
65  QDjangoWhere(const QDjangoWhere &other);
66  QDjangoWhere(const QString &key, QDjangoWhere::Operation operation, QVariant value);
67  ~QDjangoWhere();
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 
80 private:
81  QSharedDataPointer<QDjangoWherePrivate> d;
82  friend class QDjangoCompiler;
83 };
84 
85 #endif
Returns true if the column value is greater than the given value.
Definition: QDjangoWhere.h:48
The QDjangoWhere class expresses an SQL constraint.
Definition: QDjangoWhere.h:40
Returns true if the column value starts with the given value (strings only).
Definition: QDjangoWhere.h:52
Returns true if the column value is null.
Definition: QDjangoWhere.h:56
Returns true if the column value contains the given value (strings only).
Definition: QDjangoWhere.h:54
Returns true if the column value is less than the given value.
Definition: QDjangoWhere.h:49
Operation
A comparison operation on a database column value.
Definition: QDjangoWhere.h:43
The QDjangoMetaModel class holds the database schema for a model.
Definition: QDjangoMetaModel.h:64
Returns true if the column value ends with the given value (strings only).
Definition: QDjangoWhere.h:53
No comparison, always returns true.
Definition: QDjangoWhere.h:45
Returns true if the column value is greater or equal to the given value.
Definition: QDjangoWhere.h:50
Returns true if the column value is not equal to the given value (case-insensitive).
Definition: QDjangoWhere.h:58
Returns true if the column value is equal to the given value.
Definition: QDjangoWhere.h:46
Returns true if the column value is less or equal to the given value.
Definition: QDjangoWhere.h:51
Returns true if the column value is equal to the given value (case-insensitive)
Definition: QDjangoWhere.h:57
Returns true if the column value is not equal to the given value.
Definition: QDjangoWhere.h:47
Returns true if the column value starts with the given value (strings only, case-insensitive).
Definition: QDjangoWhere.h:59
Returns true if the column value is one of the given values.
Definition: QDjangoWhere.h:55
Returns true if the column value ends with the given value (strings only, case-insensitive).
Definition: QDjangoWhere.h:60