Class AdbExecuteNonQueryWorker
A worker that executes a query in an SQL database without returning any result set (i.e. INSERT, UPDATE, DELETE and DML statements). The RecordsAffected property is however set when the query finishes.
Also see SQL Database Access, as well as AdbTableNonQueryWorker and AdbExecuteScalarWorker<TResult>.
Note: This worker does participate in any transaction currently active on the connection.
Inheritance
Implements
Inherited Members
Namespace: actionETL.Adb
Assembly: actionETL.dll
Syntax
public class AdbExecuteNonQueryWorker : WorkerBase<AdbExecuteNonQueryWorker>, IDisposeOnFinished
Constructors
AdbExecuteNonQueryWorker(WorkerParent, String, AdbCommandBuilder)
Initializes a new instance of the AdbExecuteNonQueryWorker worker. It executes a query in an SQL database without returning any result set (i.e. INSERT, UPDATE, DELETE and DML statements).
Declaration
public AdbExecuteNonQueryWorker(WorkerParent workerParent, string workerName, AdbCommandBuilder commandBuilder)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| AdbCommandBuilder | commandBuilder | A builder for the database command. Can be |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
AdbExecuteNonQueryWorker(WorkerParent, String, IAdbConnectionBuilder, String)
Initializes a new instance of the AdbExecuteNonQueryWorker worker. It executes a query in an SQL database without returning any result set SQL database without returning any result set (i.e. INSERT, UPDATE, DELETE and DML statements).
Declaration
public AdbExecuteNonQueryWorker(WorkerParent workerParent, string workerName, IAdbConnectionBuilder connectionBuilder, string queryText)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| IAdbConnectionBuilder | connectionBuilder | The connection builder, must not be |
| String | queryText | The query text, must not be |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
AdbExecuteNonQueryWorker(WorkerParent, String, IAdbConnectionBuilder, String, CommandType)
Initializes a new instance of the AdbExecuteNonQueryWorker worker. It executes a query in an SQL database without returning any result set (i.e. INSERT, UPDATE, DELETE and DML statements).
Declaration
public AdbExecuteNonQueryWorker(WorkerParent workerParent, string workerName, IAdbConnectionBuilder connectionBuilder, string queryText, CommandType commandType)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| IAdbConnectionBuilder | connectionBuilder | The connection builder, must not be |
| String | queryText | The query text, must not be |
| CommandType | commandType | Type of the command. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
AdbExecuteNonQueryWorker(WorkerParent, String, Func<Boolean>, AdbCommandBuilder)
Initializes a new instance of the AdbExecuteNonQueryWorker worker. It executes a query in an SQL database without returning any result set (i.e. INSERT, UPDATE, DELETE and DML statements).
Declaration
public AdbExecuteNonQueryWorker(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, AdbCommandBuilder commandBuilder)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| Func<Boolean> | isStartableFunc | Function to calculate the worker start constraint; it should return |
| AdbCommandBuilder | commandBuilder | A builder for the database command. Can be |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
AdbExecuteNonQueryWorker(WorkerParent, String, Func<Boolean>, IAdbConnectionBuilder, String)
Initializes a new instance of the AdbExecuteNonQueryWorker worker. It executes a query in an SQL database without returning any result set SQL database without returning any result set (i.e. INSERT, UPDATE, DELETE and DML statements).
Declaration
public AdbExecuteNonQueryWorker(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, IAdbConnectionBuilder connectionBuilder, string queryText)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| Func<Boolean> | isStartableFunc | Function to calculate the worker start constraint; it should return |
| IAdbConnectionBuilder | connectionBuilder | The connection builder, must not be |
| String | queryText | The query text, must not be |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
AdbExecuteNonQueryWorker(WorkerParent, String, Func<Boolean>, IAdbConnectionBuilder, String, CommandType)
Initializes a new instance of the AdbExecuteNonQueryWorker worker. It executes a query in an SQL database without returning any result set (i.e. INSERT, UPDATE, DELETE and DML statements).
Declaration
public AdbExecuteNonQueryWorker(WorkerParent workerParent, string workerName, Func<bool> isStartableFunc, IAdbConnectionBuilder connectionBuilder, string queryText, CommandType commandType)
Parameters
| Type | Name | Description |
|---|---|---|
| WorkerParent | workerParent | The parent worker or worker system that the new child worker will be added to. Cannot be |
| String | workerName | Name of the worker.
Set to a prefix plus a trailing
While less useful, set to
The name cannot otherwise contain |
| Func<Boolean> | isStartableFunc | Function to calculate the worker start constraint; it should return |
| IAdbConnectionBuilder | connectionBuilder | The connection builder, must not be |
| String | queryText | The query text, must not be |
| CommandType | commandType | Type of the command. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
| ArgumentException |
|
| ArgumentNullException |
|
| InvalidOperationException |
|
Properties
CommandBuilder
Gets or sets the builder for the database command. Can only be set before the worker starts running.
Note: This property is thread-safe.
Declaration
public AdbCommandBuilder CommandBuilder { get; set; }
Property Value
| Type | Description |
|---|---|
| AdbCommandBuilder |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException | Cannot set the value after the worker has started running. |
RecordsAffected
Gets the number of records affected by an UPDATE, INSERT, or DELETE query. For all other types of statements, the return value is -1. Only available after the worker has completed successfully.
Note: This property is thread-safe.
Declaration
public int RecordsAffected { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
Exceptions
| Type | Condition |
|---|---|
| InvalidOperationException |
|
Methods
RunAsync()
This method can be overridden to add custom functionality to the derived worker that runs before
and after the row processing. In this case, the base class base.RunAsync() must
be called for the worker to function correctly.
Typically, this worker is used without overriding this method.
Declaration
protected override async Task<OutcomeStatus> RunAsync()
Returns
| Type | Description |
|---|---|
| Task<OutcomeStatus> | A |