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
ParameterBinderSqlParameterBinderUnderlying parameter binder.
SqlstringBound SQL statement.
Properties
ParameterBinder
Underlying parameter binder.
public SqlParameterBinder ParameterBinder { get; init; }
Property Value
Sql
Bound SQL statement.
public string Sql { get; init; }
Property Value
Methods
Execute(IDbCommand, IEnumerable<SqlParameter>?)
Executes the Sql statement with the given parameters.
public int Execute(IDbCommand command, IEnumerable<SqlParameter>? parameters)
Parameters
commandIDbCommandCommand to execute the statement with.
parametersIEnumerable<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
commandIDbCommandCommand to execute the statement with.
parametersIEnumerable<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
commandIDbCommandCommand to execute the statement with.
parametersIEnumerable<SqlParameter>Source of parameters to bind.
cancellationTokenCancellationTokenOptional 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
commandIDbCommandCommand to execute the statement with.
parametersIEnumerable<IEnumerable<SqlParameter>>Collection of sources of parameters to bind.
cancellationTokenCancellationTokenOptional 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
commandIDbCommandSource command.
parametersIEnumerable<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
commandIDbCommandSource command.
parametersIEnumerable<SqlParameter>Source of parameters to bind.
cancellationTokenCancellationTokenOptional CancellationToken.
Returns
- ValueTask<SqlAsyncMultiDataReader>
ValueTask<TResult> that returns a new SqlAsyncMultiDataReader instance.