Table of Contents

Class SqlUpdateStatement

Namespace
Utils.Data.Sql
Assembly
Utils.Data.dll

Represents a parsed UPDATE statement.

public sealed class SqlUpdateStatement : SqlStatement
Inheritance
SqlUpdateStatement
Inherited Members
Extension Methods

Constructors

SqlUpdateStatement(SqlSegment, SqlSegment, SqlSegment?, SqlSegment?, SqlSegment?, SqlSegment?, WithClause?)

Initializes a new instance of the SqlUpdateStatement class.

public SqlUpdateStatement(SqlSegment target, SqlSegment set, SqlSegment? from, SqlSegment? where, SqlSegment? output, SqlSegment? returning, WithClause? withClause)

Parameters

target SqlSegment

The target segment describing the updated entity.

set SqlSegment

The SET segment.

from SqlSegment

The FROM segment when joins are used.

where SqlSegment

The WHERE segment.

output SqlSegment

The OUTPUT segment.

returning SqlSegment

The RETURNING segment.

withClause WithClause

Optional CTE definitions.

Properties

From

Gets the FROM segment when present.

public SqlSegment? From { get; }

Property Value

SqlSegment

FromPart

Gets the FROM clause represented as a typed part when present.

public FromPart? FromPart { get; }

Property Value

FromPart

Output

Gets the OUTPUT segment when present.

public SqlSegment? Output { get; }

Property Value

SqlSegment

Returning

Gets the RETURNING segment when present.

public SqlSegment? Returning { get; }

Property Value

SqlSegment

Set

Gets the SET segment describing the assignments.

public SqlSegment Set { get; }

Property Value

SqlSegment

Target

Gets the target segment describing what is being updated.

public SqlSegment Target { get; }

Property Value

SqlSegment

UpdatePart

Gets the UPDATE clause represented as a typed part.

public UpdatePart UpdatePart { get; }

Property Value

UpdatePart

Where

Gets the WHERE segment when present.

public SqlSegment? Where { get; }

Property Value

SqlSegment

WherePart

Gets the WHERE clause represented as a typed part when present.

public WherePart? WherePart { get; }

Property Value

WherePart

Methods

BuildSql()

Builds the canonical inline SQL representation of the statement.

protected override string BuildSql()

Returns

string

The inline SQL string representing the statement.

EnsureFromSegment()

Ensures the FROM segment exists and returns it.

public SqlSegment EnsureFromSegment()

Returns

SqlSegment

The existing or newly created FROM segment.

EnsureOutputSegment()

Ensures the OUTPUT segment exists and returns it.

public SqlSegment EnsureOutputSegment()

Returns

SqlSegment

The existing or newly created OUTPUT segment.

EnsureReturningSegment()

Ensures the RETURNING segment exists and returns it.

public SqlSegment EnsureReturningSegment()

Returns

SqlSegment

The existing or newly created RETURNING segment.

EnsureWhereSegment()

Ensures the WHERE segment exists and returns it.

public SqlSegment EnsureWhereSegment()

Returns

SqlSegment

The existing or newly created WHERE segment.