SqlServerContext

Classes > Nimblesite.Lql.SqlServer > SqlServerContext

SQL Server context implementation for generating SQL Server-specific SQL

public sealed class SqlServerContext : SelectContextBase, ISqlContext

Constructors

SqlServerContext

public SqlServerContext(IFunctionMappingProvider? functionMappingProvider = null)

Initializes a new instance of the SqlServerContext class

Parameter Type Description
functionMappingProvider IFunctionMappingProvider The function mapping provider (defaults to SQL Server provider)

Methods

SetBaseTable(string)

public override void SetBaseTable(string tableName)

Sets the base table for the query

Parameters:

Name Type Description
tableName String The base table name

AddJoin(string, string, string?)

public override void AddJoin(string joinType, string tableName, string? condition)

Adds a JOIN to the query

Parameters:

Name Type Description
joinType String The type of join (INNER JOIN, LEFT JOIN, etc.)
tableName String The table to join
condition String The join condition

AddHaving(string)

public override void AddHaving(string condition)

Rejects a null HAVING condition before recording it.

Parameters:

Name Type Description
condition String The having condition

GenerateSQL()

public override string GenerateSQL()

Generates the final SQL query

Returns: String - The SQL Server query string

ToSqlServerSql(SelectStatement)

public static string ToSqlServerSql(SelectStatement statement)

Generates SQL Server SQL directly from a SelectStatement. Implements [DP-SQL-MODEL-DIALECTS].

Parameters:

Name Type Description
statement SelectStatement The SQL statement to generate from

Returns: String - The SQL Server SQL string