다음을 통해 공유


Scripts.GetUserDefinedFunctionQueryStreamIterator Method

Definition

Overloads

GetUserDefinedFunctionQueryStreamIterator(QueryDefinition, String, QueryRequestOptions)

This method creates a query for user defined functions 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.

GetUserDefinedFunctionQueryStreamIterator(String, String, QueryRequestOptions)

This method creates a query for user defined functions under a container using a SQL statement. It returns a FeedIterator.

GetUserDefinedFunctionQueryStreamIterator(QueryDefinition, String, QueryRequestOptions)

Source:
Scripts.cs

This method creates a query for user defined functions 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 GetUserDefinedFunctionQueryStreamIterator (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);
abstract member GetUserDefinedFunctionQueryStreamIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator
Public MustOverride Function GetUserDefinedFunctionQueryStreamIterator (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 UDF with queryDefinition as input.

Scripts scripts = this.container.Scripts;
QueryDefinition queryDefinition = new QueryDefinition("SELECT * FROM u where u.id like @testId")
  .WithParameter("@testId", "testUdfId");
using (FeedIterator feedIterator = this.scripts.GetUserDefinedFunctionQueryStreamIterator(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

GetUserDefinedFunctionQueryStreamIterator(String, String, QueryRequestOptions)

Source:
Scripts.cs

This method creates a query for user defined functions under a container using a SQL statement. It returns a FeedIterator.

public abstract Microsoft.Azure.Cosmos.FeedIterator GetUserDefinedFunctionQueryStreamIterator (string queryText = default, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);
abstract member GetUserDefinedFunctionQueryStreamIterator : string * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator
Public MustOverride Function GetUserDefinedFunctionQueryStreamIterator (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 UDF with queryText as input.

Scripts scripts = this.container.Scripts;
using (FeedIterator feedIterator = this.scripts.GetUserDefinedFunctionQueryStreamIterator(
    "SELECT * FROM u where u.id like '%testId%'")
{
    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