Table of Contents

Class PostgreSqlGenerator

Namespace
FluentCommand.Query.Generators
Assembly
FluentCommand.dll

Provides a SQL generator for PostgreSQL, implementing SQL statement and expression generation with PostgreSQL-specific syntax and conventions.

public class PostgreSqlGenerator : SqlServerGenerator, IQueryGenerator
Inheritance
PostgreSqlGenerator
Implements
Inherited Members

Constructors

PostgreSqlGenerator()

public PostgreSqlGenerator()

Methods

BuildDelete(DeleteStatement)

Builds a SQL DELETE statement for PostgreSQL, including support for FROM, JOIN, WHERE, RETURNING, and comments.

public override string BuildDelete(DeleteStatement deleteStatement)

Parameters

deleteStatement DeleteStatement

The DeleteStatement containing the DELETE statement configuration.

Returns

string

A SQL DELETE statement string for PostgreSQL.

Exceptions

ArgumentException

Thrown if the table is not specified.

BuildInsert(InsertStatement)

Builds a SQL INSERT statement for PostgreSQL, including support for RETURNING and comments.

public override string BuildInsert(InsertStatement insertStatement)

Parameters

insertStatement InsertStatement

The InsertStatement containing the INSERT statement configuration.

Returns

string

A SQL INSERT statement string for PostgreSQL.

Exceptions

ArgumentNullException

Thrown if insertStatement is null.

ArgumentException

Thrown if the table or values are not specified.

BuildUpdate(UpdateStatement)

Builds a SQL UPDATE statement for PostgreSQL, including support for FROM, JOIN, WHERE, RETURNING, and comments.

public override string BuildUpdate(UpdateStatement updateStatement)

Parameters

updateStatement UpdateStatement

The UpdateStatement containing the UPDATE statement configuration.

Returns

string

A SQL UPDATE statement string for PostgreSQL.

Exceptions

ArgumentException

Thrown if the table or update values are not specified.

LimitExpression(LimitExpression)

Builds a SQL LIMIT/OFFSET expression for PostgreSQL.

public override string LimitExpression(LimitExpression limitExpression)

Parameters

limitExpression LimitExpression

The LimitExpression(LimitExpression) representing the limit and offset.

Returns

string

A SQL LIMIT/OFFSET expression string for PostgreSQL, or an empty string if not applicable.

ParseIdentifier(string)

Parses a quoted identifier and returns the unquoted name for PostgreSQL.

public override string ParseIdentifier(string name)

Parameters

name string

The quoted identifier.

Returns

string

The unquoted identifier name.

QuoteIdentifier(string)

Quotes an identifier (such as a table or column name) for PostgreSQL, using double quotes.

public override string QuoteIdentifier(string name)

Parameters

name string

The identifier to quote.

Returns

string

The quoted identifier, or the original name if quoting is not required.

TableExpression(TableExpression)

Builds a SQL table expression for PostgreSQL, omitting schema (PostgreSQL does not support schema in the same way as SQL Server).

public override string TableExpression(TableExpression tableExpression)

Parameters

tableExpression TableExpression

The TableExpression(TableExpression) representing the table.

Returns

string

A SQL table expression string for PostgreSQL.

Exceptions

ArgumentNullException

Thrown if tableExpression is null.

WhereExpression(WhereExpression)

Builds a SQL WHERE expression for PostgreSQL, handling various filter operators and parameterization.

public override string WhereExpression(WhereExpression whereExpression)

Parameters

whereExpression WhereExpression

The WhereExpression(WhereExpression) representing the condition.

Returns

string

A SQL WHERE expression string for PostgreSQL.

Exceptions

ArgumentNullException

Thrown if whereExpression is null.

ArgumentException

Thrown if required properties are not specified.