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
QDjangoWhere::StartsWith
@ StartsWith
Definition: QDjangoWhere.h:52
QDjangoWhere::EndsWith
@ EndsWith
Definition: QDjangoWhere.h:53
QDjangoWhere::IEquals
@ IEquals
Definition: QDjangoWhere.h:57
QDjangoWhere::LessThan
@ LessThan
Definition: QDjangoWhere.h:49
QDjangoWhere::IStartsWith
@ IStartsWith
Definition: QDjangoWhere.h:59
QDjangoWhere
The QDjangoWhere class expresses an SQL constraint.
Definition: QDjangoWhere.h:40
QDjangoWhere::LessOrEquals
@ LessOrEquals
Definition: QDjangoWhere.h:51
QDjangoWhere::Equals
@ Equals
Definition: QDjangoWhere.h:46
QDjangoWhere::INotEquals
@ INotEquals
Definition: QDjangoWhere.h:58
QDjangoMetaModel
The QDjangoMetaModel class holds the database schema for a model.
Definition: QDjangoMetaModel.h:64
QDjangoWhere::Operation
Operation
Definition: QDjangoWhere.h:43
QDjangoWhere::None
@ None
Definition: QDjangoWhere.h:45
QDjangoWhere::NotEquals
@ NotEquals
Definition: QDjangoWhere.h:47
QDjangoWhere::Contains
@ Contains
Definition: QDjangoWhere.h:54
QDjangoWhere::IsIn
@ IsIn
Definition: QDjangoWhere.h:55
QDjangoWhere::GreaterOrEquals
@ GreaterOrEquals
Definition: QDjangoWhere.h:50
QDjangoWhere::IsNull
@ IsNull
Definition: QDjangoWhere.h:56
QDjangoWhere::IEndsWith
@ IEndsWith
Definition: QDjangoWhere.h:60
QDjangoWhere::GreaterThan
@ GreaterThan
Definition: QDjangoWhere.h:48