ISphinxQLExecutorExecuteNonQueryAsync(String, CancellationToken, Object) Method

Asynchronously executes a non-query command.

Definition

Namespace: SphinxConnector.FluentApi
Assembly: SphinxConnector (in SphinxConnector.dll) Version: 6.1.0
C#
Task<int> ExecuteNonQueryAsync(
	string commandText,
	CancellationToken cancellationToken,
	Object parameters = null
)

Parameters

commandText  String
The command to execute.
cancellationToken  CancellationToken
The token to monitor for cancellation requests.
parameters  Object  (Optional)
Optional parameters for the command.

Return Value

TaskInt32
The number of rows affected by the statement.

Example

C#
using (IFulltextSession fulltextSession = fulltextStore.StartSession())
{
    ISphinxQLExecutor sphinxQLExecutor = fulltextSession.Advanced.CreateSphinxQLExecutor();

    CancellationTokenSource cts = new CancellationTokenSource();    

    int rowsAffected = await sphinxQLExecutor.ExecuteNonQueryAsync("DELETE FROM index WHERE id IN @ids", cts.Token, new { ids = new [] { 1, 2, 3 } });
}

See Also