GreaterThan() public method

public GreaterThan ( HqlExpression lhs, HqlExpression rhs ) : HqlGreaterThan
lhs HqlExpression
rhs HqlExpression
return HqlGreaterThan
Esempio n. 1
0
 public override NHibernate.Hql.Ast.HqlTreeNode BuildHql(System.Reflection.MethodInfo method, System.Linq.Expressions.Expression targetObject, System.Collections.ObjectModel.ReadOnlyCollection <System.Linq.Expressions.Expression> arguments, NHibernate.Hql.Ast.HqlTreeBuilder treeBuilder, NHibernate.Linq.Visitors.IHqlExpressionVisitor visitor)
 {
     //return treeBuilder.Constant(0);
     return(treeBuilder.Case(new HqlWhen[] {
         treeBuilder.When(
             treeBuilder.LessThan(visitor.Visit(arguments[0]).AsExpression(), visitor.Visit(arguments[1]).AsExpression()),
             treeBuilder.Constant(-1)),
         treeBuilder.When(
             treeBuilder.GreaterThan(visitor.Visit(arguments[0]).AsExpression(), visitor.Visit(arguments[1]).AsExpression()),
             treeBuilder.Constant(1))
     },
                             treeBuilder.Constant(0)));
 }
Esempio n. 2
0
		public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)
		{
			// Instance CompareTo() or static string.Compare()?
			Expression lhs = arguments.Count == 1 ? targetObject : arguments[0];
			Expression rhs = arguments.Count == 1 ? arguments[0] : arguments[1];

			HqlExpression lhs1 = visitor.Visit(lhs).AsExpression();
			HqlExpression rhs1 = visitor.Visit(rhs).AsExpression();
			HqlExpression lhs2 = visitor.Visit(lhs).AsExpression();
			HqlExpression rhs2 = visitor.Visit(rhs).AsExpression();

			// CASE WHEN (table.[Name] = N'Foo') THEN 0
			//      WHEN (table.[Name] > N'Foo') THEN 1
			//      ELSE -1 END

			return treeBuilder.Case(
				new[]
					{
						treeBuilder.When(treeBuilder.Equality(lhs1, rhs1), treeBuilder.Constant(0)),
						treeBuilder.When(treeBuilder.GreaterThan(lhs2, rhs2), treeBuilder.Constant(1))
					},
				treeBuilder.Constant(-1));
		}
 public override HqlTreeNode BuildHql(System.Reflection.MethodInfo method, Expression targetObject, System.Collections.ObjectModel.ReadOnlyCollection<Expression> arguments,
    HqlTreeBuilder treeBuilder,IHqlExpressionVisitor visitor)
 {
     return treeBuilder.GreaterThan(
       visitor.Visit(arguments[0]).AsExpression(),
     visitor.Visit(arguments[1]).AsExpression());
 }