Add() public method

public Add ( HqlExpression lhs, HqlExpression rhs ) : HqlAdd
lhs HqlExpression
rhs HqlExpression
return HqlAdd
Ejemplo n.º 1
0
		public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)
		{
			var stringExpr = visitor.Visit(targetObject).AsExpression();
			var start = treeBuilder.Add(visitor.Visit(arguments[0]).AsExpression(), treeBuilder.Constant(1));

			if (arguments.Count == 1)
				return treeBuilder.MethodCall("substring", stringExpr, start);

			var length = visitor.Visit(arguments[1]).AsExpression();
			return treeBuilder.MethodCall("substring", stringExpr, start, length);
		}
Ejemplo n.º 2
0
		public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)
		{
			HqlMethodCall locate;
			if (arguments.Count == 1)
			{
				locate = treeBuilder.MethodCall("locate",
					visitor.Visit(arguments[0]).AsExpression(),
					visitor.Visit(targetObject).AsExpression()); //,
				//treeBuilder.Constant(0));
			}
			else
			{
				var start = treeBuilder.Add(visitor.Visit(arguments[1]).AsExpression(), treeBuilder.Constant(1));
				locate = treeBuilder.MethodCall("locate",
							visitor.Visit(arguments[0]).AsExpression(),
							visitor.Visit(targetObject).AsExpression(),
							start);
			}
			return treeBuilder.Subtract(locate,treeBuilder.Constant(1));
		}
Ejemplo n.º 3
0
			public override HqlTreeNode BuildHql(MethodInfo method, Expression targetObject, ReadOnlyCollection<Expression> arguments, HqlTreeBuilder treeBuilder, IHqlExpressionVisitor visitor)
			{
				var length = arguments.Count == 1
								? treeBuilder.Subtract(treeBuilder.MethodCall("length", visitor.Visit(targetObject).AsExpression()), visitor.Visit(arguments[0]).AsExpression())
								: visitor.Visit(arguments[1]).AsExpression();

				return treeBuilder.MethodCall("substring", visitor.Visit(targetObject).AsExpression(),
												treeBuilder.Add(visitor.Visit(arguments[0]).AsExpression(), treeBuilder.Constant(1)),
												length);
			}