Skip to content

Protocol

SQLSubqueryClauseBuilder

A builder which can construct - but not execute - a complete SELECT query. Useful for building CTEs, CREATE TABLE ... SELECT clauses, etc., not to mention actual SELECT queries.

Overview

Due to unfortunate naming choices which this API is now stuck with until a major version bump, this protocol is very easily confused with SQLSubqueryBuilder. For clarification, this protocol provides methods common to the construction of SELECT subqueries, whereas SQLSubqueryBuilder is a concrete type which conforms to this protocol and provides support for embedding SQLSubquery expressions in other queries.

Important

Despite the use of the term “subquery”, this builder does not provide methods for specifying subquery operators (e.g. ANY, SOME), nor does it enclose its result in grouping parenthesis, as all of these formations are context-specific and are the purview of builders that conform to this protocol.

Note

The primary motivation for the existence of this protocol is to make it easier to construct SELECT queries without specifying a database or providing the SQLQueryBuilder and SQLQueryFetcher methods in inappropriate contexts.

Topics

Instance Properties

Instance Methods

  • distinct()
    Adds a DISTINCT clause to the query.
  • distinct(on:)
    Adds a DISTINCT clause to the select statement and explicitly specifies columns to select, overwriting any previously specified columns.
  • distinct(on:_:)
    Adds a DISTINCT clause to the select statement and explicitly specifies columns to select, overwriting any previously specified columns.
  • for(_:)
    Adds a locking clause to this query. If called more than once, the last call wins.
  • from(_:)
    Include the given table in the list of those used by the query, without performing an explicit join.
  • from(_:as:)
    Include the given table and an alias for it in the list of those used by the query, without performing an explicit join.
  • groupBy(_:)
    Adds a GROUP BY clause to the query with the specified column.
  • lockingClause(_:)
    Adds a locking clause to this query. If called more than once, the last call wins.

Relationships

Inherits From

Conforming Types

See Also

Builder Protocols