Exemplo n.º 1
0
        private bool ContextHasPredicate(TSqlParser.Search_conditionContext context)
        {
            var predicate = context.predicate();

            if (predicate != null)
            {
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        private d.Predicate GetDrumPredicate(TSqlParser.Search_conditionContext context)
        {
            var predicate = context.predicate();

            if (predicate is not null)
            {
                var predicateInterval = predicate.SourceInterval;
                var bucketInterval    = new Interval {
                    A = predicateInterval.a, B = predicateInterval.b
                };

                var newPredicate = new d.Predicate(GetNextPredicateId());
                newPredicate.SetInterval(bucketInterval);
                newPredicate.Text = GetWhiteSpaceFromCurrentContext(predicate);

                return(newPredicate);
            }

            return(null);
        }
Exemplo n.º 3
0
        public override void EnterSearch_condition([NotNull] TSqlParser.Search_conditionContext context)
        {
            string debug    = context.GetText();
            var    interval = context.SourceInterval;

            Console.WriteLine("EnterSearch_condition:");
            Console.WriteLine($"Text: {debug}");
            Console.WriteLine($"Interval: {interval.ToString()}");

            var predicate = context.predicate();

            if (predicate != null)
            {
                string predicateText     = predicate.GetText();
                var    predicateInterval = predicate.SourceInterval;
                var    bucketInterval    = new Interval {
                    A = predicateInterval.a, B = predicateInterval.b
                };

                d.Predicate newPredicate = null;

                if (!HasPredicate(bucketInterval))
                {
                    if (PredicateHasBool(context))
                    {
                        // we need to determine if we need to add a boolean predicate
                        // or regular predicate
                        WalkTree(context);
                    }
                    else
                    {
                        // just add the predicate
                        newPredicate = new d.Predicate(GetNextPredicateId());
                        newPredicate.SetInterval(bucketInterval);
                        AddPredicate(newPredicate);
                    }
                }
            }
        }