QEloquent 1.1.0
Qt most flexible ORM.
Loading...
Searching...
No Matches
QEloquent::Query Class Reference

Fluent SQL query builder. More...

Public Member Functions

 Query ()
 Constructs an empty query.
 
 Query (const Query &)
 Copy constructor.
 
 Query (Query &&)
 Move constructor.
 
Queryoperator= (const Query &)
 Copy assignment operator.
 
Queryoperator= (Query &&)
 Move assignment operator.
 
 ~Query ()
 Destructor.
 
QString tableName () const
 Returns the table name configured for this query.
 
Querytable (const QString &tableName)
 Configures the table name for the query.
 
QueryandWhere (const QString &field, const QString &op, const QVariant &value)
 Adds an AND WHERE clause with a custom operator.
 
QueryandWhere (const QString &expression)
 Adds a raw AND WHERE expression.
 
QueryorWhere (const QString &field, const QString &op, const QVariant &value)
 Adds an OR WHERE clause with a custom operator.
 
QueryorWhere (const QString &expression)
 Adds a raw OR WHERE expression.
 
Queryjoin (const QString &table, const QString &first, const QString &op, const QString &second, const QString &type="INNER")
 Adds a JOIN clause.
 
QuerygroupBy (const QString &field)
 Adds a GROUP BY clause.
 
QueryorderBy (const QString &field, Qt::SortOrder order=Qt::DescendingOrder)
 Adds an ORDER BY clause.
 
Querypage (int page, int countPerPage=20)
 Configures pagination (LIMIT/OFFSET).
 
Querylimit (int limit)
 Adds a LIMIT clause.
 
Queryoffset (int offset)
 Adds an OFFSET clause.
 
Querywith (const QString &relation)
 Adds a relationship for eager loading.
 
Querywith (const QStringList &relations)
 Adds multiple relationships for eager loading.
 
Connection connection () const
 Returns the connection used by this query.
 
QString connectionName () const
 Returns the name of the connection.
 
Queryconnection (const QString &connectionName)
 Configures the connection name for the query.
 
bool hasWhere () const
 Returns true if the query has WHERE clauses.
 
QString whereClause () const
 Returns the generated WHERE clause string.
 
QString whereClause (const Driver *driver) const
 Returns the generated WHERE clause string for a specific driver.
 
bool hasGroupBy () const
 Returns true if the query has GROUP BY clauses.
 
QString groupByClause () const
 Returns the generated GROUP BY clause string.
 
QString groupByClause (const Driver *driver) const
 Returns the generated GROUP BY clause string for a specific driver.
 
bool hasOrderBy () const
 Returns true if the query has ORDER BY clauses.
 
QString orderByClause () const
 Returns the generated ORDER BY clause string.
 
QString orderByClause (const Driver *driver) const
 Returns the generated ORDER BY clause string for a specific driver.
 
QString limitClause () const
 Returns the generated LIMIT clause string.
 
QString offsetClause () const
 Returns the generated OFFSET clause string.
 
QString toString () const
 Returns the full SQL statement (SELECT).
 
QString toString (const Driver *driver) const
 Returns the full SQL statement for a specific driver.
 
QStringList relations () const
 Returns the list of relations to be eager loaded.
 

Detailed Description

Fluent SQL query builder.

Query provides a chainable API to build SELECT, INSERT, UPDATE, and DELETE statements without writing raw SQL.

Note
Query use field names instead of property names.

The documentation for this class was generated from the following files: