Class SqlParameterCollector

Assembly: redb.Core.Pro.dll

Parameter collector for safe SQL query generation.
Prevents SQL injection, enables PostgreSQL/MSSQL query plan caching.
Database-agnostic: uses ISqlDialect for parameter formatting.

public class SqlParameterCollector

Inheritance

Object→SqlParameterCollector

Properties

BatchPrefix

Statements the batch runs before the statement these parameters belong to, each ending with ';'. Empty unless a

public string BatchPrefix { get; }

Count

Number of added parameters.

public int Count { get; }

Methods

AddBatchPrefix(string)

Adds statements to .

public void AddBatchPrefix(string statements)

AddParameter(object?)

Adds parameter and returns placeholder via dialect.

public string AddParameter(object? value)

AddParameterWithOffset(object?, int)

Adds parameter with specified index offset.

public string AddParameterWithOffset(object? value, int offset)

GetDebugComment()

Generates debug comment with parameters (like EF Core), followed by .

public string GetDebugComment()

NextTempTableName(string)

A name for a temporary table of this batch, unique within it.

public string NextTempTableName(string stem)

SetSchemeId(long)

Sets SchemeId for debug output.

public void SetSchemeId(long schemeId)

ToArray()

Returns parameter array for FromSqlRaw/SqlQueryRaw.

public object?[] ToArray()

WithBatchPrefix(string)

The text to execute: , then sql.

public string WithBatchPrefix(string sql)

Constructors