示例#1
0
 public IQueryResponse ExecuteReader(IQueryOperation operation)
 {
     if (Authorize(operation, false))
     {
         return(_nodeContext.TopologyImpl.ExecuteReader(operation));
     }
     return(null);
 }
示例#2
0
        public IQueryResponse ExecuteReader(IQueryOperation operation)
        {
            DatabaseExists(operation.Database);

            IStore database = _databases[operation.Database];

            return(database.ExecuteReader(operation));
        }
 public virtual void VisitQueryOperation(IQueryOperation value)
 {
     if (value is ISelectOperation operation)
     {
         VisitSelectOperation(operation);
     }
     else if (value is IGroupOperation groupOperation)
     {
         VisitGroupOperation(groupOperation);
     }
     else
     {
         throw new NotSupportedException();
     }
 }
示例#4
0
        public Query Bind(IQueryOperation operation)
        {
            var newOperationSet = new List <IQueryOperation>(_operations)
            {
                operation
            };

            var newResults = operation
                             .Apply(Results)
                             .ToArray();

            return(new Query(newResults)
            {
                _operations = newOperationSet
            });
        }
示例#5
0
        public QueryBaseForm(IQueryOperation queryOperation)
        {
            InitializeComponent();

            this._queryOperation           = queryOperation;
            this._queryOperation.QueryForm = this;

            Control control = this._queryOperation as Control;

            if (control != null)
            {
                control.Dock = DockStyle.Fill;
                this.panel1.Controls.Add(control);
            }
            else
            {
                if (!this.DesignMode)
                {
                    throw new ApplicationException("所传入的_queryOperation不是控件类型!");
                }
            }
        }
示例#6
0
        internal QueryBlock(string tag, TInput stackInput, TState state, IStackEvents <TOperationEvent> stackEvents, IQueryOperation <TOperationEvent, TResult> queryOperation)
            : base(tag, stackInput, state, stackEvents)
        {
            if (queryOperation.SupportsAsync && queryOperation.PreferAsync)
            {
                executor = () => {
                    IQueryResult <TOperationEvent, TResult> r;
                    if (queryOperation is IQueryOperationWithState <TState, TOperationEvent, TResult> queryOperationWithState)
                    {
                        r = queryOperationWithState.Execute(state);
                    }
                    else
                    {
                        r = queryOperation.Execute();
                    }

                    this.Append(r);
                    return(resultDispatcher.Return(r.Result.Value));
                }
            }
            ;
            else
            {
                executorAsync = async() => {
                    IQueryResult <TOperationEvent, TResult> r;
                    if (queryOperation is IQueryOperationWithState <TState, TOperationEvent, TResult> queryOperationWithState)
                    {
                        r = await queryOperationWithState.ExecuteAsync(state).ConfigureAwait(false);
                    }
                    else
                    {
                        r = await queryOperation.ExecuteAsync().ConfigureAwait(false);
                    }

                    this.Append(r);
                    return(resultDispatcher.Return(r.Result.Value));
                }
            };
        }

        IQueryResultProxy <T, TState> IQuery <TInput, TState, TOperationEvent> .DefineResult <T>()
        {
            return(new QueryResultProxy <T, TState>());
        }

        IQueryResultProxy <T, TState> IQuery <TInput, TState, TOperationEvent> .DefineResult <T>(T result)
        {
            return(new QueryResultProxy <T, TState>()
            {
                Result = result
            });
        }

        IQueryResultProxy <T, TState> IQuery <TInput, TState, TOperationEvent> .DefineResult <T>(Expression <Func <T> > expression)
        {
            return(new QueryResultProxy <T, TState>());
        }

        BlockResult <T> IResultDispatcher <TState> .Fail <T>()
        {
            return(new ResultDispatcher <T, TState>().Fail());
        }

        BlockResult <T> IResultDispatcher <TState> .Fail <T>(OperationEvent error)
        {
            return(new ResultDispatcher <T, TState>().Fail(error));
        }

        BlockResult <T> IResultDispatcher <TState> .Complete <T>()
        {
            return(new ResultDispatcher <T, TState>().Complete());
        }

        BlockResult <T> IResultDispatcher <TState> .Complete <T>(object overrideResult)
        {
            return(new ResultDispatcher <T, TState>().Complete(overrideResult));
        }

        BlockResult <T> IResultDispatcher <TState> .Reset <T>()
        {
            return(new ResultDispatcher <T, TState>().Reset());
        }

        BlockResult <T> IResultDispatcher <TState> .Reset <T>(TState state)
        {
            return(new ResultDispatcher <T, TState>().Reset(state));
        }

        BlockResult <T> IResultDispatcher <TState> .Restart <T>()
        {
            return(new ResultDispatcher <T, TState>().Restart());
        }

        BlockResult <T> IResultDispatcher <TState> .Return <T>(T result)
        {
            return(new ResultDispatcher <T, TState>().Return(result));
        }

        BlockResult <T> IResultDispatcher <TState> .Goto <T>(string tag)
        {
            return(new ResultDispatcher <T, TState>().Goto(tag));
        }

        BlockResult <T> IResultDispatcher <TState> .Goto <T>(string tag, object overrideInput)
        {
            return(new ResultDispatcher <T, TState>().Goto(tag, overrideInput));
        }

        BlockResult <T> IResultDispatcher <TState> .Goto <T>(int index)
        {
            return(new ResultDispatcher <T, TState>().Goto(index));
        }

        BlockResult <T> IResultDispatcher <TState> .Goto <T>(int index, object overrideInput)
        {
            return(new ResultDispatcher <T, TState>().Goto(index, overrideInput));
        }

        BlockResult <T> IResultDispatcher <TState> .Skip <T>(int i)
        {
            return(new ResultDispatcher <T, TState>().Skip(i));
        }

        BlockResult <T> IResultDispatcher <TState> .Skip <T>(int i, object overrideInput)
        {
            return(new ResultDispatcher <T, TState>().Skip(i, overrideInput));
        }

        BlockResult <T> IResultDispatcher <TState> .Retry <T>()
        {
            return(new ResultDispatcher <T, TState>().Retry());
        }

        BlockResult <T> IResultDispatcher <TState> .Retry <T>(object overrideInput)
        {
            return(new ResultDispatcher <T, TState>().Retry(overrideInput));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Return(TResult result)
        {
            return(resultDispatcher.Return(result));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Complete()
        {
            return(resultDispatcher.Complete());
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Complete(object overrideResult)
        {
            return(resultDispatcher.Complete(overrideResult));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Fail()
        {
            return(resultDispatcher.Fail());
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Fail(OperationEvent error)
        {
            return(resultDispatcher.Fail(error));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Reset()
        {
            return(resultDispatcher.Reset());
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Reset(TState state)
        {
            return(resultDispatcher.Reset(state));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Restart()
        {
            return(resultDispatcher.Restart());
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Goto(string tag)
        {
            return(resultDispatcher.Goto(tag));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Goto(string tag, object overrideInput)
        {
            return(resultDispatcher.Goto(tag, overrideInput));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Goto(int index)
        {
            return(resultDispatcher.Goto(index));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Goto(int index, object overrideInput)
        {
            return(resultDispatcher.Goto(index, overrideInput));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Skip(int i)
        {
            return(resultDispatcher.Skip(i));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Skip(int i, object overrideInput)
        {
            return(resultDispatcher.Skip(i, overrideInput));
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Retry()
        {
            return(resultDispatcher.Retry());
        }

        BlockResult <TResult> IResultDispatcher <TResult, TState> .Retry(object overrideInput)
        {
            return(resultDispatcher.Retry(overrideInput));
        }
    }
示例#7
0
 public object ExecuteScalar(IQueryOperation operation)
 {
     throw new NotImplementedException();
 }
示例#8
0
 public QueryResult(IQueryOperation operation, IAsyncResult asyncResult)
     : base(operation, asyncResult)
 {
     RowList = null;
 }
 public StackBlockSpecBase <TInput, TState, TOperationEvent> BuildQuery <Tin, TResult>(string tag, int index, IQueryOperation <TOperationEvent, TResult> operation)
 {
     tag = HandleOperationTagName(tag, index);
     return(new StackBlockSpecOperation <TInput, TState, TOperationEvent, Tin>(tag, index, (TInput stackInput, TState state, IStackEvents <TOperationEvent> stackEvents, IEmptyable input)
                                                                               => new QueryBlock <TInput, TState, TOperationEvent, Tin, TResult>(tag, stackInput, state, stackEvents, input.ConvertTo <Tin>(), operation), BlockSpecTypes.Operation));
 }
            private void WriteQueryOperation(IQueryOperation value, IFormatter formatter)
            {
                if (value is ISelectOperation)
                {
                    this.WriteSelectOperation(value as ISelectOperation, formatter);
                    return;
                }

                if (value is IGroupOperation)
                {
                    this.WriteGroupOperation(value as IGroupOperation, formatter);
                    return;
                }

                throw new NotSupportedException();
            }
示例#11
0
        public virtual void VisitQueryOperation(IQueryOperation value)
        {
            if (value is ISelectOperation)
            {
                this.VisitSelectOperation(value as ISelectOperation);
                return;
            }

            if (value is IGroupOperation)
            {
                this.VisitGroupOperation(value as IGroupOperation);
                return;
            }

            throw new NotSupportedException();
        }
        public virtual IQueryOperation TransformQueryOperation(IQueryOperation value)
        {
            if (value is ISelectOperation)
            {
                return this.TransformSelectOperation(value as ISelectOperation);
            }

            if (value is IGroupOperation)
            {
                return this.TransformGroupOperation(value as IGroupOperation);
            }

            throw new NotSupportedException();
        }