Projekt

Allgemein

Profil

Herunterladen als
Herunterladen (1,89 KB) Statistiken
| Zweig: | Revision:
/*
* 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/>.
*/
#ifndef QUERYINTERPRETER_H
#define QUERYINTERPRETER_H

#include <QSqlQuery>
#include <QSharedPointer>
#include <QRegularExpressionMatchIterator>
namespace CuteEntityManager {
class Query;
class QueryBuilder;
class Join;
class OrderBy;
class Expression;
class QueryInterpreter {
public:
QueryInterpreter(QueryBuilder *builder);
QSqlQuery build(Query &q);

protected:
QString buildSelect(Query &q, const QList<Expression> &columns,
const bool &distinct = false,
const QString &selectOption = "") const;
QString buildFrom(const QStringList &from) const;
QString buildJoin(const QList<Join> &joins) const;
QString buildWhere(Query &q, const QList<Expression> &conditions) const;
QString buildGroupBy(const QStringList &groupBy) const;
QString buildHaving(Query &q, const QList<Expression> &conditions) const;
QString buildOrderByAndLimit(QString sql, const QList<OrderBy> &orderBy,
const quint64 &limit, const quint64 &offset) const;
QString buildOrderBy(const QList<OrderBy> &columns) const;
QString buildCondition(Query &q, const QList<Expression> &conditions) const;

private:
QueryBuilder *builder;

};

}

#endif // QUERYINTERPRETER_H
(30-30/39)