Skip to content

Structure

SQLBinaryExpression

A fundamental syntactical expression - a left and right operand joined by an infix operator.
struct SQLBinaryExpression

Overview

This construct forms the basis of most comparisons, conditionals, and compounds which can be represented by an expression.

For example, the expression foo = 1 AND bar <> 'baz' OR bop - 5 NOT IN (1, 3) can be represented in terms of nested SQLBinaryExpressions (note that there is more than one “correct” way to nest this particular example):

let expr = SQLBinaryExpression(
    SQLBinaryExpression(SQLColumn("foo"), .equal, SQLLiteral.numeric("1")),
    .and,
    SQLBinaryExpression(
        SQLBinaryExpression(SQLColumn("bar"), .notEqual, SQLLiteral.string("baz")),
        .or,
        SQLBinaryExpression(
            SQLBinaryExpression(SQLColumn("bop"), .subtract, SQLLiteral.numeric("5")),
            .notIn,
            SQLGroupExpression(SQLLiteral.numeric("1"), SQLLiteral.numeric("3"))
        )
    )
)

Topics

Initializers

Instance Properties

Instance Methods

Relationships

Conforms To

See Also

Syntactic Expressions

  • enum SQLBinaryOperator
    SQL binary expression operators.
  • struct SQLBind
    A parameterizied value bound to the SQL query.
  • struct SQLFunction
    A call to a function available in SQL, expressed as a name and a (possibly empty) list of arguments.
  • struct SQLGroupExpression
    A fundamental syntactical expression - an arbitrary expression or list of expressions, surroudned by parenthesis.
  • struct SQLIdentifier
    A fundamental syntactical expression - a quoted identifier (also often referred to as a “name” or “object name”).
  • struct SQLList
    A fundamental syntactical expression - a list of subexpresions with a specified “separator” subexpression.
  • enum SQLLiteral
    A fundamental syntactical expression - one of several various kinds of literal SQL expressions.
  • struct SQLRaw
    A fundamental syntactical expression - an arbitrary string of raw SQL with no escaping or formating of any kind.