Example #1
0
 protected virtual string CompileCondition(WhereCondition condition, SqlCompilerContext context)
 {
     return(condition switch
     {
         CompareColumnsCondition compareColumnsCondition => CompileCondition(compareColumnsCondition, context),
         CompareCondition compareCondition => CompileCondition(compareCondition, context),
         InCondition inCondition => CompileCondition(inCondition, context),
         NestedCondition nestedCondition => CompileCondition(nestedCondition, context),
         RawCondition rawCondition => CompileCondition(rawCondition, context),
         _ => throw new ArgumentOutOfRangeException(nameof(condition))
     });
        protected virtual string CompileNestedCondition <Q>(NestedCondition <Q> x) where Q : BaseQuery <Q>
        {
            if (!x.Query.HasComponent("where", EngineCode))
            {
                return(null);
            }

            var sql = CompileConditions(x.Query.GetComponents <AbstractCondition>("where", EngineCode));
            var op  = x.IsNot ? "NOT " : "";

            return($"{op}({sql})");
        }
Example #3
0
        protected virtual string CompileNestedCondition <Q>(SqlResult ctx, NestedCondition <Q> x) where Q : BaseQuery <Q>
        {
            if (!x.Query.HasComponent("where", EngineCode))
            {
                return(null);
            }

            var clauses = x.Query.GetComponents <AbstractCondition>("where", EngineCode);

            var sql = CompileConditions(ctx, clauses);

            return(x.IsNot ? $"NOT ({sql})" : $"({sql})");
        }
Example #4
0
    private void Start()
    {
        SetStartupPosition();
        targetFov = option.DefaultFov;
        direction = -1;

        swipeConditions             = new NestedCondition();
        swipeConditions.Conditions += delegate
        {
            return(CrossInput.CurrentState == CrossInput.PointerState.Swipe &&
                   !EventSystem.IsPointerDownOverUI);
        };
    }
        protected virtual string CompileNestedCondition <Q>(SqlResult ctx, NestedCondition <Q> x) where Q : BaseQuery <Q>
        {
            if (!x.Query.HasComponent("where", EngineCode))
            {
                return(null);
            }

            var sql = CompileConditions(ctx, x.Query.GetComponents <AbstractCondition>("where", EngineCode));
            var op  = x.IsNot ? "NOT " : "";

            return(string.IsNullOrEmpty(sql)
                ? ""
                : $"{op}({sql})");
        }
Example #6
0
        public Query BuildFrom(string query, Query from)
        {
            var build = this.Build(query);

            var nested = new NestedCondition <Query>
            {
                Component = "where",
                Query     = new Query()
            };

            nested.Query.Clauses.AddRange(build.Clauses);

            from.Clauses.Add(nested);
            return(from);
        }
Example #7
0
        public Query Parenthesize(Query expression)
        {
            var nested = new NestedCondition <Query>
            {
                Component = "where",
                Query     = new Query()
            };

            nested.Query.Clauses.AddRange(expression.Clauses);

            var q = new Query();

            q.Clauses.Add(nested);

            return(q);
        }
Example #8
0
        public WhereBuilder Grouped(Action <WhereBuilder> where)
        {
            if (where == null)
            {
                throw new ArgumentNullException(nameof(where));
            }

            var conditions      = new List <WhereCondition>();
            var nestedCondition = new NestedCondition(conditions);
            var nestedBuilder   = new WhereBuilder(Table, conditions);

            AddCondition(nestedCondition);

            where (nestedBuilder);

            return(this);
        }
Example #9
0
    private void Awake()
    {
        selectConditions             = new NestedCondition();
        selectConditions.Conditions +=
            delegate
        {
            return(CrossInput.IsTouch && !EventSystem.IsPointerDownOverUI);
        };
        selectConditions.Conditions +=
            delegate
        {
            return(CameraController.Gesture == EnumCollect.CameraGesture.None);
        };

        SelectedCallback += UpdateCursor;
        SelectedCallback += DetermineSelectedOnRSS;
    }
Example #10
0
    private void InitSelectCondition()
    {
        selectCondition             = new NestedCondition();
        selectCondition.Conditions += delegate
        {
            return(CrossInput.IsPointerUp);
        };
        selectCondition.Conditions += delegate
        {
            return(Window.activeInHierarchy);
        };

        selectCondition.Conditions += delegate
        {
            return(openAtFrame != Time.frameCount);
        };
    }