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
DeleteStatementThe 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
InsertStatementThe InsertStatement containing the INSERT statement configuration.
Returns
- string
A SQL INSERT statement string for PostgreSQL.
Exceptions
- ArgumentNullException
Thrown if
insertStatement
isnull
.- 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
UpdateStatementThe 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
LimitExpressionThe 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
stringThe 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
stringThe 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
TableExpressionThe TableExpression(TableExpression) representing the table.
Returns
- string
A SQL table expression string for PostgreSQL.
Exceptions
- ArgumentNullException
Thrown if
tableExpression
isnull
.
WhereExpression(WhereExpression)
Builds a SQL WHERE expression for PostgreSQL, handling various filter operators and parameterization.
public override string WhereExpression(WhereExpression whereExpression)
Parameters
whereExpression
WhereExpressionThe WhereExpression(WhereExpression) representing the condition.
Returns
- string
A SQL WHERE expression string for PostgreSQL.
Exceptions
- ArgumentNullException
Thrown if
whereExpression
isnull
.- ArgumentException
Thrown if required properties are not specified.