Example #1
0
        public QueryResultWithIncludes Query(string index, IndexQuery query, CancellationToken externalCancellationToken)
        {
            QueryResultWithIncludes result = null;

            using (var cts = CancellationTokenSource.CreateLinkedTokenSource(externalCancellationToken, WorkContext.CancellationToken))
            {
                var cancellationToken = cts.Token;

                TransactionalStorage.Batch(
                    accessor =>
                {
                    using (var op = new DatabaseQueryOperation(Database, index, query, accessor, cancellationToken)
                    {
                        ShouldSkipDuplicateChecking = query.SkipDuplicateChecking
                    })
                    {
                        var list = new List <RavenJObject>();
                        op.Init();
                        op.Execute(list.Add);
                        op.Result.Results = list;
                        result            = op.Result;
                    }
                });
            }

            return(result);
        }
Example #2
0
        public QueryResultWithIncludes Query(string index, IndexQuery query, CancellationToken externalCancellationToken)
        {
            DateTime?showTimingByDefaultUntil = WorkContext.ShowTimingByDefaultUntil;

            if (showTimingByDefaultUntil != null)
            {
                if (showTimingByDefaultUntil < SystemTime.UtcNow)                 // expired, reset
                {
                    WorkContext.ShowTimingByDefaultUntil = null;
                }
                else
                {
                    query.ShowTimings = true;
                }
            }

            QueryResultWithIncludes result = null;

            using (var cts = CancellationTokenSource.CreateLinkedTokenSource(externalCancellationToken, WorkContext.CancellationToken))
            {
                TransactionalStorage.Batch(
                    accessor =>
                {
                    using (var op = new DatabaseQueryOperation(Database, index, query, accessor, cts)
                    {
                        ShouldSkipDuplicateChecking = query.SkipDuplicateChecking
                    })
                    {
                        var list = new List <RavenJObject>();
                        op.Init();
                        op.Execute(list.Add);
                        op.Result.Results = list;
                        result            = op.Result;
                    }
                });
            }

            return(result);
        }
Example #3
0
		public QueryResultWithIncludes Query(string index, IndexQuery query, CancellationToken externalCancellationToken)
		{
			DateTime? showTimingByDefaultUntil = WorkContext.ShowTimingByDefaultUntil;
			if (showTimingByDefaultUntil != null)
			{
				if (showTimingByDefaultUntil < SystemTime.UtcNow) // expired, reset
				{
					WorkContext.ShowTimingByDefaultUntil = null;
				}
				else
				{
					query.ShowTimings = true;
				}
			}

			QueryResultWithIncludes result = null;
			using (var cts = CancellationTokenSource.CreateLinkedTokenSource(externalCancellationToken, WorkContext.CancellationToken))
			{
				TransactionalStorage.Batch(
					accessor =>
					{
						using (var op = new DatabaseQueryOperation(Database, index, query, accessor, cts)
						{
							ShouldSkipDuplicateChecking = query.SkipDuplicateChecking
						})
						{
							var list = new List<RavenJObject>();
							op.Init();
							op.Execute(list.Add);
							op.Result.Results = list;
							result = op.Result;
						}
					});
			}

			return result;
		}
Example #4
0
        public QueryResultWithIncludes Query(string index, IndexQuery query, CancellationToken externalCancellationToken)
        {
            QueryResultWithIncludes result = null;
            using (var cts = CancellationTokenSource.CreateLinkedTokenSource(externalCancellationToken, WorkContext.CancellationToken))
            {
                TransactionalStorage.Batch(
                    accessor =>
                    {
                        using (var op = new DatabaseQueryOperation(Database, index, query, accessor, cts)
                        {
                            ShouldSkipDuplicateChecking = query.SkipDuplicateChecking
                        })
                        {
                            var list = new List<RavenJObject>();
                            op.Init();
                            op.Execute(list.Add);
                            op.Result.Results = list;
                            result = op.Result;
                        }
                    });
            }

            return result;
        }