Sdílet prostřednictvím


Scripts.GetStoredProcedureQueryIterator Method

Definition

Overloads

GetStoredProcedureQueryIterator<T>(QueryDefinition, String, QueryRequestOptions)

This method creates a query for stored procedures 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.

GetStoredProcedureQueryIterator<T>(String, String, QueryRequestOptions)

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

GetStoredProcedureQueryIterator<T>(QueryDefinition, String, QueryRequestOptions)

Source:
Scripts.cs

This method creates a query for stored procedures 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<T> GetStoredProcedureQueryIterator<T> (Microsoft.Azure.Cosmos.QueryDefinition queryDefinition, string continuationToken = default, Microsoft.Azure.Cosmos.QueryRequestOptions requestOptions = default);
abstract member GetStoredProcedureQueryIterator : Microsoft.Azure.Cosmos.QueryDefinition * string * Microsoft.Azure.Cosmos.QueryRequestOptions -> Microsoft.Azure.Cosmos.FeedIterator<'T>
Public MustOverride Function GetStoredProcedureQueryIterator(Of T) (queryDefinition As QueryDefinition, Optional continuationToken As String = Nothing, Optional requestOptions As QueryRequestOptions = Nothing) As FeedIterator(Of T)

Type Parameters

T

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 type feed iterator for sproc with queryDefinition as input.

Scripts scripts = this.container.Scripts;
string queryText = "SELECT * FROM s where s.id like @testId";
QueryDefinition queryDefinition = new QueryDefinition(queryText);
queryDefinition.WithParameter("@testId", "testSprocId");
using (FeedIterator<StoredProcedureProperties> feedIterator = scripts.GetStoredProcedureQueryIterator<StoredProcedureProperties>(queryDefinition))
{
    while (feedIterator.HasMoreResults)
    {
        foreach (StoredProcedureProperties storedProcedure in await feedIterator.ReadNextAsync())
        {
            Console.WriteLine(storedProcedure.Id);
        }
    }
}

Applies to

GetStoredProcedureQueryIterator<T>(String, String, QueryRequestOptions)

Source:
Scripts.cs

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

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

Type Parameters

T

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 type feed iterator for sproc with queryText as input.

Scripts scripts = this.container.Scripts;
using (FeedIterator<StoredProcedureProperties> feedIterator = this.scripts.GetStoredProcedureQueryIterator<StoredProcedureProperties>(
    "SELECT * FROM u where u.id like '%testId%'"))
{
    while (feedIterator.HasMoreResults)
    {
        foreach (StoredProcedureProperties properties in await feedIterator.ReadNextAsync())
        {
            Console.WriteLine(properties.Id);
        }
    }
}

Applies to