Class SqlUpdateStatement
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
targetSqlSegmentThe target segment describing the updated entity.
setSqlSegmentThe SET segment.
fromSqlSegmentThe FROM segment when joins are used.
whereSqlSegmentThe WHERE segment.
outputSqlSegmentThe OUTPUT segment.
returningSqlSegmentThe RETURNING segment.
withClauseWithClauseOptional CTE definitions.
Properties
From
Gets the FROM segment when present.
public SqlSegment? From { get; }
Property Value
FromPart
Gets the FROM clause represented as a typed part when present.
public FromPart? FromPart { get; }
Property Value
Output
Gets the OUTPUT segment when present.
public SqlSegment? Output { get; }
Property Value
Returning
Gets the RETURNING segment when present.
public SqlSegment? Returning { get; }
Property Value
Set
Gets the SET segment describing the assignments.
public SqlSegment Set { get; }
Property Value
Target
Gets the target segment describing what is being updated.
public SqlSegment Target { get; }
Property Value
UpdatePart
Gets the UPDATE clause represented as a typed part.
public UpdatePart UpdatePart { get; }
Property Value
Where
Gets the WHERE segment when present.
public SqlSegment? Where { get; }
Property Value
WherePart
Gets the WHERE clause represented as a typed part when present.
public WherePart? WherePart { get; }
Property Value
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.