Table of Contents

Struct SqlParameterizedStatementExecutor

Namespace
LfrlAnvil.Sql.Statements
Assembly
LfrlAnvil.Sql.Core.dll

Represents an SqlParameterBinder bound to a specific SQL statement.

public readonly record struct SqlParameterizedStatementExecutor : IEquatable<SqlParameterizedStatementExecutor>
Implements
Inherited Members

Constructors

SqlParameterizedStatementExecutor(SqlParameterBinder, string)

Represents an SqlParameterBinder bound to a specific SQL statement.

public SqlParameterizedStatementExecutor(SqlParameterBinder ParameterBinder, string Sql)

Parameters

ParameterBinder SqlParameterBinder

Underlying parameter binder.

Sql string

Bound SQL statement.

Properties

ParameterBinder

Underlying parameter binder.

public SqlParameterBinder ParameterBinder { get; init; }

Property Value

SqlParameterBinder

Sql

Bound SQL statement.

public string Sql { get; init; }

Property Value

string

Methods

Execute(IDbCommand, IEnumerable<SqlParameter>?)

Executes the Sql statement with the given parameters.

public int Execute(IDbCommand command, IEnumerable<SqlParameter>? parameters)

Parameters

command IDbCommand

Command to execute the statement with.

parameters IEnumerable<SqlParameter>

Source of parameters to bind.

Returns

int

The number of rows affected.

Execute(IDbCommand, IEnumerable<IEnumerable<SqlParameter>?>)

Executes the Sql statement for each parameter source in the parameters collection.

public long Execute(IDbCommand command, IEnumerable<IEnumerable<SqlParameter>?> parameters)

Parameters

command IDbCommand

Command to execute the statement with.

parameters IEnumerable<IEnumerable<SqlParameter>>

Collection of sources of parameters to bind.

Returns

long

The number of rows affected.

ExecuteAsync(IDbCommand, IEnumerable<SqlParameter>?, CancellationToken)

Asynchronously executes the Sql statement with the given parameters.

public ValueTask<int> ExecuteAsync(IDbCommand command, IEnumerable<SqlParameter>? parameters, CancellationToken cancellationToken = default)

Parameters

command IDbCommand

Command to execute the statement with.

parameters IEnumerable<SqlParameter>

Source of parameters to bind.

cancellationToken CancellationToken

Optional CancellationToken.

Returns

ValueTask<int>

ValueTask<TResult> that returns the number of rows affected.

ExecuteAsync(IDbCommand, IEnumerable<IEnumerable<SqlParameter>?>, CancellationToken)

Asynchronously executes the Sql statement for each parameter source in the parameters collection.

public ValueTask<long> ExecuteAsync(IDbCommand command, IEnumerable<IEnumerable<SqlParameter>?> parameters, CancellationToken cancellationToken = default)

Parameters

command IDbCommand

Command to execute the statement with.

parameters IEnumerable<IEnumerable<SqlParameter>>

Collection of sources of parameters to bind.

cancellationToken CancellationToken

Optional CancellationToken.

Returns

ValueTask<long>

ValueTask<TResult> that returns the number of rows affected.

MultiQuery(IDbCommand, IEnumerable<SqlParameter>?)

Creates a new parameterized SqlMultiDataReader instance.

public SqlMultiDataReader MultiQuery(IDbCommand command, IEnumerable<SqlParameter>? parameters)

Parameters

command IDbCommand

Source command.

parameters IEnumerable<SqlParameter>

Source of parameters to bind.

Returns

SqlMultiDataReader

New SqlMultiDataReader instance.

MultiQueryAsync(IDbCommand, IEnumerable<SqlParameter>?, CancellationToken)

Asynchronously creates a new parameterized SqlAsyncMultiDataReader instance.

public ValueTask<SqlAsyncMultiDataReader> MultiQueryAsync(IDbCommand command, IEnumerable<SqlParameter>? parameters, CancellationToken cancellationToken = default)

Parameters

command IDbCommand

Source command.

parameters IEnumerable<SqlParameter>

Source of parameters to bind.

cancellationToken CancellationToken

Optional CancellationToken.

Returns

ValueTask<SqlAsyncMultiDataReader>

ValueTask<TResult> that returns a new SqlAsyncMultiDataReader instance.