共用方式為


Scripts.GetTriggerQueryStreamIterator Method

Definition

Overloads

GetTriggerQueryStreamIterator(QueryDefinition, String, QueryRequestOptions)

This method creates a query for triggers under a container using a SQL statement with parameterized values. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

GetTriggerQueryStreamIterator(String, String, QueryRequestOptions)

This method creates a query for triggers under a container using a SQL statement. It returns a FeedIterator.

GetTriggerQueryStreamIterator(QueryDefinition, String, QueryRequestOptions)

Source:
Scripts.cs

This method creates a query for triggers under a container using a SQL statement with parameterized values. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

public abstract Microsoft.Azure.Cosmos.FeedIterator GetTriggerQueryStreamIterator (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);
abstract member GetTriggerQueryStreamIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator
Public MustOverride Function GetTriggerQueryStreamIterator (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator

Parameters

queryDefinition
QueryDefinition

The cosmos SQL query definition.

continuationToken
String

(Optional) The continuation token in the Azure Cosmos DB service.

requestOptions
QueryRequestOptions

(Optional) The options for the item query request.

Returns

An iterator to read through the existing stored procedures.

Examples

This create the stream feed iterator for Trigger with queryDefinition as input.

Scripts scripts = this.container.Scripts;\
QueryDefinition queryDefinition = new QueryDefinition("SELECT * FROM t where t.id like @testId")
 .WithParameter("@testId", "testTriggerId");
using (FeedIterator feedIterator = this.scripts.GetTriggerQueryStreamIterator(queryDefinition)
{
    while (feedIterator.HasMoreResults)
    {
        // Stream iterator returns a response with status for errors
        using(ResponseMessage response = await feedIterator.ReadNextAsync())
        {
            // Handle failure scenario. 
            if(!response.IsSuccessStatusCode)
            {
                // Log the response.Diagnostics and handle the error
            }

            // Process the response.Content Stream
        }
    }
}

Applies to

GetTriggerQueryStreamIterator(String, String, QueryRequestOptions)

Source:
Scripts.cs

This method creates a query for triggers under a container using a SQL statement. It returns a FeedIterator.

public abstract Microsoft.Azure.Cosmos.FeedIterator GetTriggerQueryStreamIterator (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);
abstract member GetTriggerQueryStreamIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator
Public MustOverride Function GetTriggerQueryStreamIterator (Optional queryText As String = Nothing, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator

Parameters

queryText
String

The cosmos SQL query text.

continuationToken
String

(Optional) The continuation token in the Azure Cosmos DB service.

requestOptions
QueryRequestOptions

(Optional) The options for the item query request.

Returns

An iterator to read through the existing stored procedures.

Examples

This create the stream feed iterator for Trigger with queryText as input.

Scripts scripts = this.container.Scripts;
string queryText = "SELECT * FROM t where t.id like '%testId%'";
using (FeedIterator iter = this.scripts.GetTriggerQueryStreamIterator(queryText)
{
}

Applies to