CosmosClient.GetDatabaseQueryStreamIterator メソッド

定義

オーバーロード

GetDatabaseQueryStreamIterator(QueryDefinition, String, QueryRequestOptions)

このメソッドは、パラメーター化された値を持つ SQL ステートメントを使用して、Cosmos DB アカウントの下にデータベースのクエリを作成します。 FeedIterator を返します。 パラメーター化された値を使用した SQL ステートメントの準備の詳細については、 を参照してください QueryDefinition

GetDatabaseQueryStreamIterator(String, String, QueryRequestOptions)

このメソッドは、SQL ステートメントを使用して、Cosmos DB アカウントの下にデータベースのクエリを作成します。 FeedIterator を返します。

GetDatabaseQueryStreamIterator(QueryDefinition, String, QueryRequestOptions)

ソース:
CosmosClient.cs

このメソッドは、パラメーター化された値を持つ SQL ステートメントを使用して、Cosmos DB アカウントの下にデータベースのクエリを作成します。 FeedIterator を返します。 パラメーター化された値を使用した SQL ステートメントの準備の詳細については、 を参照してください QueryDefinition

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

パラメーター

queryDefinition
QueryDefinition

Cosmos SQL クエリ定義。

continuationToken
String

Azure Cosmos DB サービスの継続トークン。

requestOptions
QueryRequestOptions

(省略可能)クエリ要求のオプション。

戻り値

データベースを通過する反復子

クエリ結果を完全にドレインする方法の例。

QueryDefinition queryDefinition = new QueryDefinition("select * From c where c._rid = @rid")
              .WithParameter("@rid", "TheRidValue");
using (FeedIterator feedIterator = this.CosmosClient.GetDatabaseQueryStreamIterator(
    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
            }
        }
    }
}

注釈

構文と例については、 https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started を参照してください。

ReadStreamAsync(RequestOptions, CancellationToken) は、単一データベースの検索に推奨されます。

適用対象

GetDatabaseQueryStreamIterator(String, String, QueryRequestOptions)

ソース:
CosmosClient.cs

このメソッドは、SQL ステートメントを使用して、Cosmos DB アカウントの下にデータベースのクエリを作成します。 FeedIterator を返します。

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

パラメーター

queryText
String

Cosmos SQL クエリ テキスト。

continuationToken
String

Azure Cosmos DB サービスの継続トークン。

requestOptions
QueryRequestOptions

(省略可能)クエリ要求のオプション。

戻り値

データベースを通過する反復子

クエリ結果を完全にドレインする方法の例。

using (FeedIterator feedIterator = this.CosmosClient.GetDatabaseQueryStreamIterator(
    ("select * From c where c._rid = 'TheRidValue'")
{
    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
            }
        }
    }
}

注釈

構文と例については、 https://docs.microsoft.com/azure/cosmos-db/sql-query-getting-started を参照してください。

ReadStreamAsync(RequestOptions, CancellationToken) は、単一データベースの検索に推奨されます。

適用対象