Skip to content

Structure

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.
struct SQLConflictResolutionStrategy

Overview

Unfortunately, in MySQL the “no action” strategy must use INSERT IGNORE, which appears in a completely different place in the query than the update strategy. For now, this is implemented by providing an additional expression that SQLInsert has to embed at the appropriate point if provided, which is gated on both the dialect’s syntax and the conflict action. There hasn’t been a need to deal with this particular kind of syntax issue before, so this method of handling it is something of an experiment.

Topics

Initializers

Instance Properties

  • var action: SQLConflictAction
    An action to take to resolve a conflict in the unique index.
  • var targetColumns: [any SQLExpression]
    The column or columns which comprise the uniquness constraint to which the strategy should apply. The exact rules for how a matching constraint is found when an exact match is not found vary between databases. Not all database implement conflict targets.

Instance Methods

Relationships

Conforms To

See Also

Clause Expressions