Table of Contents

Class SqlSegment

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

Represents a section of a SQL statement, such as SELECT columns or a WHERE clause.

public sealed class SqlSegment
Inheritance
SqlSegment
Inherited Members
Extension Methods

Properties

IsEmpty

Gets a value indicating whether the segment contains any parts.

public bool IsEmpty { get; }

Property Value

bool

Name

Gets the name of the segment.

public string Name { get; }

Property Value

string

Subqueries

Gets the subqueries found in the segment.

public IEnumerable<SqlStatement> Subqueries { get; }

Property Value

IEnumerable<SqlStatement>

Methods

AddCommaSeparatedElement(string)

Appends a comma-separated element to the segment, inserting a comma when required.

public void AddCommaSeparatedElement(string sql)

Parameters

sql string

The SQL snippet representing the new element.

AddConjunction(string, string)

Appends a logical conjunction to the segment followed by an expression.

public void AddConjunction(string conjunction, string expression)

Parameters

conjunction string

The conjunction keyword such as AND or OR.

expression string

The expression to append.

AddRaw(string)

Appends raw SQL tokens to the segment.

public void AddRaw(string sql)

Parameters

sql string

The SQL snippet to append.

ToSql()

Builds the SQL text represented by the segment.

public string ToSql()

Returns

string

The SQL string representing the segment.