Method ExecuteAdminWithCompletionAsync
ExecuteAdminWithCompletionAsync(Char[], AdminOptions, CancellationToken)
Declaration
public Task<AdminResult> ExecuteAdminWithCompletionAsync(char[] statement, AdminOptions options = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
Char[] | statement | The statement. |
AdminOptions | options | (Optional) Options for admin DDL operation.
If not specified or null , appropriate defaults
will be used. See AdminOptions. |
CancellationToken | cancellationToken | (Optional) Cancellation token. |
Returns
Type | Description |
---|---|
Task<AdminResult> | Task returning AdminResult. |
Remarks
This method is equivalent to calling ExecuteAdminAsync(Char[], AdminOptions, CancellationToken) and then calling WaitForCompletionAsync(Nullable<TimeSpan>, Nullable<TimeSpan>, CancellationToken) on the returned AdminResult object. If the operation is successful, the state in the resulting AdminResult object should be Complete.
For this operation, Timeout covers the total time interval including waiting for the admin operation completion. If not specified, separate default timeouts are used for issuing the admin operation and waiting for its completion, with values of AdminTimeout and AdminPollTimeout correspondingly (the latter defaults to no timeout if AdminPollTimeout is not set). Note that as with WaitForCompletionAsync(Nullable<TimeSpan>, Nullable<TimeSpan>, CancellationToken) you may specify the poll delay as PollDelay which otherwise defaults to AdminPollDelay.
Exceptions
Type | Condition |
---|---|
ArgumentException | If
statement is null or invalid
or options contains invalid values. |
TimeoutException | Operation has timed out. |
InvalidOperationException | The system is not in a valid state to perform this operation. |
NoSQLException | NoSQLException or one of its subclasses is thrown if operation cannot be performed for any other reason. See documentation for corresponding subclass of NoSQLException. |
See Also
ExecuteAdminWithCompletionAsync(String, AdminOptions, CancellationToken)
Declaration
public Task<AdminResult> ExecuteAdminWithCompletionAsync(string statement, AdminOptions options = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
String | statement | The statement. |
AdminOptions | options | (Optional) Options for admin DDL operation.
If not specified or null , appropriate defaults
will be used. See AdminOptions. |
CancellationToken | cancellationToken | (Optional) Cancellation token. |
Returns
Type | Description |
---|---|
Task<AdminResult> | Task returning AdminResult. |
Remarks
statement
as a string
and
thus can be used if the statement does not contain sensitive
information.
Examples
Create a namespace. We can ignore the return value since the result would represent the final state of successful operation (or an exception will be thrown).try
{
await client.ExecuteAdminWithCompletionAsync(
"CREATE NAMESPACE my_namespace");
Console.WriteLine("Namespace created.");
}
catch(Exception e)
{
Console.WriteLine($"Got exception: {e.Message}");
}
Exceptions
Type | Condition |
---|---|
ArgumentException | If
statement is null or invalid
or options contains invalid values. |
TimeoutException | Operation has timed out. |
InvalidOperationException | The system is not in a valid state to perform this operation. |
NoSQLException | NoSQLException or one of its subclasses is thrown if operation cannot be performed for any other reason. See documentation for corresponding subclass of NoSQLException. |