예제 #1
0
        protected override Expression VisitIf(IFCommand ifx)
        {
            var test =
                Expression.Condition(
                    ifx.Check,
                    ifx.IfTrue,
                    ifx.IfFalse != null
                        ? ifx.IfFalse
                        : ifx.IfTrue.Type == typeof(int)
                            ? (Expression)Expression.Property(this.executor, "RowsAffected")
                            : (Expression)Expression.Constant(TypeHelper.GetDefault(ifx.IfTrue.Type), ifx.IfTrue.Type));

            return(this.Visit(test));
        }
예제 #2
0
 protected override Expression VisitIf(IFCommand ifx)
 {
     if (!this.Language.AllowsMultipleCommands)
     {
         return(base.VisitIf(ifx));
     }
     this.Write("IF ");
     this.Visit(ifx.Check);
     this.WriteLine(Indentation.Same);
     this.Write("BEGIN");
     this.WriteLine(Indentation.Inner);
     this.VisitStatement(ifx.IfTrue);
     this.WriteLine(Indentation.Outer);
     if (ifx.IfFalse != null)
     {
         this.Write("END ELSE BEGIN");
         this.WriteLine(Indentation.Inner);
         this.VisitStatement(ifx.IfFalse);
         this.WriteLine(Indentation.Outer);
     }
     this.Write("END");
     return(ifx);
 }
예제 #3
0
 protected override Expression VisitIf(IFCommand ifx)
 {
     if (!this.Dialect.SupportMultipleCommands)
     {
         return(base.VisitIf(ifx));
     }
     this.Append("IF ");
     this.Visit(ifx.Check);
     this.AppendLine(Indentation.Same);
     this.Append("BEGIN");
     this.AppendLine(Indentation.Inner);
     this.VisitStatement(ifx.IfTrue);
     this.AppendLine(Indentation.Outer);
     if (ifx.IfFalse != null)
     {
         this.Append("END ELSE BEGIN");
         this.AppendLine(Indentation.Inner);
         this.VisitStatement(ifx.IfFalse);
         this.AppendLine(Indentation.Outer);
     }
     this.Append("END");
     return(ifx);
 }
예제 #4
0
 protected override Expression VisitIf(IFCommand ifx)
 {
     throw new NotSupportedException();
 }
예제 #5
0
 protected override Expression VisitIf(IFCommand ifx)
 {
     if (!this.Language.AllowsMultipleCommands)
     {
         return base.VisitIf(ifx);
     }
     this.Write("IF ");
     this.Visit(ifx.Check);
     this.WriteLine(Indentation.Same);
     this.Write("THEN BEGIN");
     this.WriteLine(Indentation.Inner);
     this.VisitStatement(ifx.IfTrue);
     this.WriteLine(Indentation.Outer);
     if (ifx.IfFalse != null)
     {
         this.Write("ELSE BEGIN");
         this.WriteLine(Indentation.Inner);
         this.VisitStatement(ifx.IfFalse);
         this.WriteLine(Indentation.Outer);
     }
     this.Write("END IF;");
     return ifx;
 }
예제 #6
0
 protected override Expression VisitIf(IFCommand ifx)
 {
     if (!this.Dialect.SupportMultipleCommands)
     {
         return base.VisitIf(ifx);
     }
     this.Append("IF ");
     this.Visit(ifx.Check);
     this.AppendLine(Indentation.Same);
     this.Append("BEGIN");
     this.AppendLine(Indentation.Inner);
     this.VisitStatement(ifx.IfTrue);
     this.AppendLine(Indentation.Outer);
     if (ifx.IfFalse != null)
     {
         this.Append("END ELSE BEGIN");
         this.AppendLine(Indentation.Inner);
         this.VisitStatement(ifx.IfFalse);
         this.AppendLine(Indentation.Outer);
     }
     this.Append("END");
     return ifx;
 }
 protected virtual bool CompareIf(IFCommand x, IFCommand y)
 {
     return this.Compare(x.Check, y.Check) && this.Compare(x.IfTrue, y.IfTrue) && this.Compare(x.IfFalse, y.IfFalse);
 }
예제 #8
0
 protected virtual Expression VisitIf(IFCommand ifx)
 {
     var check = this.Visit(ifx.Check);
     var ifTrue = this.Visit(ifx.IfTrue);
     var ifFalse = this.Visit(ifx.IfFalse);
     return this.UpdateIf(ifx, check, ifTrue, ifFalse);
 }
예제 #9
0
 protected IFCommand UpdateIf(IFCommand ifx, Expression check, Expression ifTrue, Expression ifFalse)
 {
     if (check != ifx.Check || ifTrue != ifx.IfTrue || ifFalse != ifx.IfFalse)
     {
         return new IFCommand(check, ifTrue, ifFalse);
     }
     return ifx;
 }
		private bool CompareIf(IFCommand x, IFCommand y)
		{
			return this.Compare(x.Check, y.Check) && this.Compare(x.IfTrue, y.IfTrue) && this.Compare(x.IfFalse, y.IfFalse);
		}
예제 #11
0
 /// <summary>
 /// Visits if.
 /// </summary>
 /// <param name="ifx">The ifx.</param>
 /// <returns></returns>
 protected override Expression VisitIf(IFCommand ifx)
 {
     throw new NotSupportedException();
 }