PostgreSqlContext

Classes > Nimblesite.Lql.Postgres > PostgreSqlContext

Context for building PostgreSQL queries with proper table aliases and structure

public sealed class PostgreSqlContext : SelectContextBase, ISqlContext

Constructors

PostgreSqlContext

public PostgreSqlContext(IFunctionMappingProvider? functionMappingProvider = null)

Initializes a new instance of the PostgreSqlContext class

Parameter Type Description
functionMappingProvider IFunctionMappingProvider The function mapping provider (defaults to PostgreSQL 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

GenerateSQL()

public override string GenerateSQL()

Generates the final SQL query

Returns: String - The SQL query string

ToPostgreSqlSql(SelectStatement)

public static string ToPostgreSqlSql(SelectStatement statement)

Generates PostgreSQL SQL from an already-built statement.

Parameters:

Name Type Description
statement SelectStatement The SQL statement to generate from

Returns: String - The PostgreSQL SQL string