BaseUri() public méthode

Bases the URI.
public BaseUri ( Uri baseUri ) : IQueryRequest
baseUri System.Uri The base URI.
Résultat IQueryRequest
Exemple #1
0
        /// <summary>
        /// Prepare an ad-hoc N1QL statement for later execution against a Couchbase Server.
        /// </summary>
        /// <param name="toPrepare">The <see cref="IQueryRequest" /> containing a N1QL statement to be prepared.</param>
        /// <returns>
        /// A <see cref="IQueryResult{T}" /> containing  the <see cref="IQueryPlan" /> representing the reusable
        /// and cachable execution plan for the statement.
        /// </returns>
        /// <remarks>
        /// Most parameters in the IQueryRequest will be ignored, appart from the Statement and the BaseUri.
        /// </remarks>
        public IQueryResult <IQueryPlan> Prepare(IQueryRequest toPrepare)
        {
            string statement = toPrepare.GetStatement();

            if (!statement.ToUpper().StartsWith("PREPARE "))
            {
                statement = string.Concat("PREPARE ", statement);
            }
            QueryRequest query = new QueryRequest(statement);

            query.BaseUri(toPrepare.GetBaseUri());
            IQueryResult <dynamic>    planResult = Query <dynamic>(query);
            IQueryResult <IQueryPlan> result     = new QueryResult <IQueryPlan>()
            {
                Message         = planResult.Message,
                ClientContextId = planResult.ClientContextId,
                Errors          = planResult.Errors,
                Exception       = planResult.Exception,
                Metrics         = planResult.Metrics,
                RequestId       = planResult.RequestId,
                Signature       = planResult.Signature,
                Status          = planResult.Status,
                Rows            = new List <IQueryPlan>(1),
                Success         = planResult.Success
            };

            if (planResult.Success)
            {
                var    rawPlan     = planResult.Rows.First();
                string encodedPlan = EncodeParameter(rawPlan);
                result.Rows.Add(new QueryPlan(encodedPlan));
            }
            return(result);
        }
 /// <summary>
 /// Prepare an ad-hoc N1QL statement for later execution against a Couchbase Server asynchronously
 /// </summary>
 /// <param name="toPrepare">The <see cref="IQueryRequest" /> containing a N1QL statement to be prepared.</param>
 /// <param name="cancellationToken">Token which can cancel the query.</param>
 /// <returns>
 /// A <see cref="IQueryResult{T}" /> containing  the <see cref="QueryPlan" /> representing the reusable
 /// and cachable execution plan for the statement.
 /// </returns>
 /// <remarks>
 /// Most parameters in the IQueryRequest will be ignored, appart from the Statement and the BaseUri.
 /// </remarks>
 public async Task<IQueryResult<QueryPlan>> PrepareAsync(IQueryRequest toPrepare, CancellationToken cancellationToken)
 {
     var statement = toPrepare.GetOriginalStatement();
     if (!statement.ToUpper().StartsWith("PREPARE "))
     {
         statement = string.Concat("PREPARE ", statement);
     }
     var query = new QueryRequest(statement);
     query.BaseUri(toPrepare.GetBaseUri());
     return await ExecuteQueryAsync<QueryPlan>(query, cancellationToken).ContinueOnAnyContext();
 }
 /// <summary>
 /// Prepare an ad-hoc N1QL statement for later execution against a Couchbase Server.
 /// </summary>
 /// <param name="toPrepare">The <see cref="IQueryRequest" /> containing a N1QL statement to be prepared.</param>
 /// <returns>
 /// A <see cref="IQueryResult{T}" /> containing  the <see cref="QueryPlan" /> representing the reusable
 /// and cachable execution plan for the statement.
 /// </returns>
 /// <remarks>
 /// Most parameters in the IQueryRequest will be ignored, appart from the Statement and the BaseUri.
 /// </remarks>
 public IQueryResult<QueryPlan> Prepare(IQueryRequest toPrepare)
 {
     var statement = toPrepare.GetOriginalStatement();
     if (!statement.ToUpper().StartsWith("PREPARE "))
     {
         statement = string.Concat("PREPARE ", statement);
     }
     var query = new QueryRequest(statement);
     query.BaseUri(toPrepare.GetBaseUri());
     return ExecuteQuery<QueryPlan>(query);
 }
Exemple #4
0
        /// <summary>
        /// Prepare an ad-hoc N1QL statement for later execution against a Couchbase Server asynchronously
        /// </summary>
        /// <param name="toPrepare">The <see cref="IQueryRequest" /> containing a N1QL statement to be prepared.</param>
        /// <returns>
        /// A <see cref="IQueryResult{T}" /> containing  the <see cref="QueryPlan" /> representing the reusable
        /// and cachable execution plan for the statement.
        /// </returns>
        /// <remarks>
        /// Most parameters in the IQueryRequest will be ignored, appart from the Statement and the BaseUri.
        /// </remarks>
        public async Task <IQueryResult <QueryPlan> > PrepareAsync(IQueryRequest toPrepare)
        {
            var statement = toPrepare.GetStatement();

            if (!statement.ToUpper().StartsWith("PREPARE "))
            {
                statement = string.Concat("PREPARE ", statement);
            }
            var query = new QueryRequest(statement);

            query.BaseUri(toPrepare.GetBaseUri());
            return(await ExecuteQueryAsync <QueryPlan>(query));
        }