Exemple #1
0
 public override void VisitAfter(BinaryOpPredicate predicate)
 {
     if (IsPlaceHolderExpr(predicate.Left))
     {
         predicate.Left = Place((PlaceHolderExpr)predicate.Left);
     }
     if (IsPlaceHolderExpr(predicate.Right))
     {
         predicate.Right = Place((PlaceHolderExpr)predicate.Right);
     }
 }
Exemple #2
0
        private static SqlPredicate CreateEqualExpr(Column column, SqlExpr sqlExpr)
        {
            var value = sqlExpr.Value;

            if (value.IsDefault)
            {
                throw new ApplicationException("一致条件の被演算子にDEFAULTキーワードは指定できません");
            }
            var equalPredicate = new BinaryOpPredicate(column, PredicateOperator.Equal, (Expr)value);

            return(new SqlPredicate(equalPredicate));
        }
Exemple #3
0
 virtual public void Visit(BinaryOpPredicate predicate)
 {
 }
 // Predicates
 public override void VisitAfter(BinaryOpPredicate predicate)
 {
 }
Exemple #5
0
 public override void VisitAfter(BinaryOpPredicate predicate)
 {
     --_predicateLevel;
 }
Exemple #6
0
 public override void VisitBefore(BinaryOpPredicate predicate)
 {
     ++_predicateLevel;
 }
 public void Visit(BinaryOpPredicate predicate)
 {
     _visitor.Visit(predicate);
 }
 // Predicates
 public void VisitBefore(BinaryOpPredicate predicate)
 {
     _visitor.VisitBefore(predicate);
 }
Exemple #9
0
        public override void VisitAfter(BinaryOpPredicate predicate)
        {
            if (this.IsNotInMainResultsSource())
            {
                return;
            }

            // OR又はNOTの被演算子ではない、かつ"="演算子の場合に一致条件として抽出する
            if ((predicate.Operator != PredicateOperator.Equal && predicate.Operator != PredicateOperator.Equal2) ||
                _orNestLevel > 0 || _notNestLevel > 0)
            {
                return;
            }

            //
            // 一致条件の抽出
            //

            if (predicate.Left.GetType() == typeof(Column) && predicate.Right.GetType() == typeof(Column))
            {
                Column lColumn = (Column)predicate.Left;
                Column rColumn = (Column)predicate.Right;

                var bothColumnsReferCurrentSources = false;
                if (this.GetSourcesOf(lColumn, _stack.Peek()) == null)
                {
                    if (this.GetSourcesOf(rColumn, _stack.Peek()) == null)
                    {
                        // サブクエリの抽出元テーブルが被演算子になっていない一致条件は無視する
                        return;
                    }
                    else
                    {
                        // サブクエリの抽出元テーブルがあればlColumnにこれを格納する
                        var tmp = lColumn;
                        lColumn = rColumn;
                        lColumn = tmp;
                    }
                }
                else
                {
                    if (this.GetSourcesOf(rColumn, _stack.Peek()) == null)
                    {
                    }
                    else
                    {
                        // 両方のColumnが現在のサブクエリの抽出元テーブルを参照する
                        bothColumnsReferCurrentSources = true;
                    }
                }

                foreach (var lSource in this.GetSourcesOf(lColumn))
                {
                    foreach (var rSource in this.GetSourcesOf(rColumn))
                    {
                        // JOIINの場合は双方向
                        if (bothColumnsReferCurrentSources || this.CurrentSubQueryIsNot(SubQueryType.Exists))
                        {
                            _cnfSet.Add(lSource, rSource);
                        }
                        if (bothColumnsReferCurrentSources || this.CurrentSubQueryIsNot(SubQueryType.InResults))
                        {
                            _cnfSet.Add(rSource, lSource);
                        }
                    }
                }
            }
            else
            {
                Column  column;
                Literal literal;

                if (predicate.Left.GetType() == typeof(Column) && predicate.Right is Literal)
                {
                    column  = (Column)predicate.Left;
                    literal = (Literal)predicate.Right;
                }
                else if (predicate.Left is Literal && predicate.Right.GetType() == typeof(Column))
                {
                    column  = (Column)predicate.Right;
                    literal = (Literal)predicate.Left;
                }
                else
                {
                    return;
                } // if

                // サブクエリの抽出元テーブルが被演算子になっていない一致条件は無視する
                if (this.GetSourcesOf(column, _stack.Peek()) == null)
                {
                    return;
                }

                foreach (var source in this.GetSourcesOf(column))
                {
                    _cnfSet.Add(source, literal);
                }
            } // if
        }