Herunterladen als
root/src/queryinterpreter.h @ 77dbed04
38838b5b | Christian Ehringfeld | /*
|
|
* Copyright (C) 2015 Christian Ehringfeld <c.ehringfeld@t-online.de>
|
|||
*
|
|||
* This program is free software; you can redistribute it and/or modify it
|
|||
* under the terms of the GNU Lesser General Public License as published by
|
|||
* the Free Software Foundation.
|
|||
*
|
|||
* This program is distributed in the hope that it will be useful, but
|
|||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|||
* for more details.
|
|||
*
|
|||
* You should have received a copy of the GNU Lesser General Public License
|
|||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|||
*/
|
|||
2ee5022f | Christian Ehringfeld | #ifndef QUERYINTERPRETER_H
|
|
#define QUERYINTERPRETER_H
|
|||
#include <QSqlQuery>
|
|||
#include <QSharedPointer>
|
|||
3160499c | Christian Ehringfeld | #include <QRegularExpressionMatchIterator>
|
|
2ee5022f | Christian Ehringfeld | namespace CuteEntityManager {
|
|
class Query;
|
|||
class QueryBuilder;
|
|||
3160499c | Christian Ehringfeld | class Join;
|
|
class OrderBy;
|
|||
class Expression;
|
|||
2ee5022f | Christian Ehringfeld | class QueryInterpreter {
|
|
public:
|
|||
57d6da31 | Christian Ehringfeld | QueryInterpreter(QueryBuilder *builder);
|
|
1b167b6c | Christian Ehringfeld | QSqlQuery build(Query &q);
|
|
3160499c | Christian Ehringfeld | ||
protected:
|
|||
1b167b6c | Christian Ehringfeld | QString buildSelect(Query &q, const QList<Expression> &columns,
|
|
506067a2 | Christian Ehringfeld | const bool &distinct = false,
|
|
3160499c | Christian Ehringfeld | const QString &selectOption = "") const;
|
|
QString buildFrom(const QStringList &from) const;
|
|||
QString buildJoin(const QList<Join> &joins) const;
|
|||
1b167b6c | Christian Ehringfeld | QString buildWhere(Query &q, const QList<Expression> &conditions) const;
|
|
3160499c | Christian Ehringfeld | QString buildGroupBy(const QStringList &groupBy) const;
|
|
1b167b6c | Christian Ehringfeld | QString buildHaving(Query &q, const QList<Expression> &conditions) const;
|
|
3160499c | Christian Ehringfeld | QString buildOrderByAndLimit(QString sql, const QList<OrderBy> &orderBy,
|
|
const quint64 &limit, const quint64 &offset) const;
|
|||
QString buildOrderBy(const QList<OrderBy> &columns) const;
|
|||
1b167b6c | Christian Ehringfeld | QString buildCondition(Query &q, const QList<Expression> &conditions) const;
|
|
3160499c | Christian Ehringfeld | ||
2ee5022f | Christian Ehringfeld | private:
|
|
57d6da31 | Christian Ehringfeld | QueryBuilder *builder;
|
|
3160499c | Christian Ehringfeld | ||
2ee5022f | Christian Ehringfeld | };
|
|
3160499c | Christian Ehringfeld | ||
2ee5022f | Christian Ehringfeld | }
|
|
#endif // QUERYINTERPRETER_H
|