Skip to content

Structure

SQLExcludedColumn

An expression appearing on the right side of a column assignment which, when the assignment list is part of an upsert’s update acion, refers to the value which was originally to be inserted for the given column.
struct SQLExcludedColumn

Overview

Note

If the serializer’s dialect does not support upserts, this expression silently evaluates to nothing at all.

Warning

At the time of this writing, MySQL 8.0’s recommended “table alias” syntax for excluded columns is not implemented, due to there currently being no way for a SQLDialect to vary its contents based on the database server version (for that matter, we don’t even have support for retrieving the version from MySQLNIO). For now, the deprecated VALUES() function is used unconditionally, which will throw warnings starting from MySQL 8.0.20. If this affects your usage, use a raw query or manually construct the necessary expressions to specify and use the alias for now.

Topics

Initializers

  • init(_:)
    Create an excluded column specifier.

Instance Properties

  • name
    The excluded column’s name.

Instance Methods

  • serialize(to:)
    Invoked when a request is made to serialize the expression to raw SQL.

Relationships

Conforms To

See Also

Clause Expressions

  • SQLAlterColumnDefinitionType
    A clause specifying a new data type to be applied to an existing column.
  • SQLColumnAssignment
    Encapsulates a column_name=value expression in the context of an UPDATE query’s value assignment list. This is distinct from an SQLBinaryExpression using the .equal operator in that the left side must be an unqualified column name, the operator must be =, and the right side may use SQLExcludedColumn when the assignment appears in the assignments list of a SQLConflictAction.update(assignments:predicate:) specification.
  • SQLColumnConstraintAlgorithm
    Column-level data constraints.
  • SQLColumnDefinition
    A clause expressing a column definition, for use when creating and altering tables.
  • SQLConflictAction
    An action to take when an INSERT query encounters a unique constraint violation.
  • SQLConflictResolutionStrategy
    Specifies a conflict resolution strategy and associated conditions for an INSERT query. An INSERT with a conflict strategy is often refered to as an UPSERT (“insert or update”). Databases are not required to support any given subset of upsert functionality, or any at all.
  • SQLDropBehavior
    Specifies a behavior when performing a DROP operation on a database object which is referenced by other objects.
  • SQLEnumDataType
    Represents a data type which specifies an enumeration in the database.
  • SQLForeignKey
    A complete FOREIGN KEY constraint specification.
  • SQLInsertModifier
    Simple helper for working around MySQL’s refusal to implement standard SQL. Only emits SQL when needed.
  • SQLJoin
    Encapsulates a single SQL JOIN, specifying the join type, the right-side table, and condition.
  • SQLJoinMethod
    The method used by a table join clause.
  • SQLLockingClause
    An SQL locking clause.
  • SQLOrderBy
    A pair of expressions, one describing a query sort key and the other a directionality for that key.
  • SQLReturning
    A clause describing a list of values to be returned from a data-modifying query.