public ExpressionClip SubString(int start, int length) { ExpressionClip expr = ExpressionFactory.CreateCloneExpression(this); expr.Sql = ColumnFormatter.SubString(this.Sql, start, length); return(expr); }
public static ExpressionClip operator %(ExpressionClip left, ExpressionClip right) { ExpressionClip expr = ExpressionFactory.CreateCloneExpression(left); ExpressionFactory.AppendExpression(expr, QueryOperator.Modulo, right); expr.dbType = DbType.Int32; return(expr); }
public static ExpressionClip operator /(ExpressionClip left, object right) { ExpressionClip expr = ExpressionFactory.CreateCloneExpression(left); ExpressionFactory.AppendExpression(expr, QueryOperator.Divide, ExpressionFactory.CreateParameterExpression(left.dbType, right)); return(expr); }
public ExpressionClip Avg() { ExpressionClip expr = ExpressionFactory.CreateCloneExpression(this); expr.Sql = ColumnFormatter.Avg(this.Sql); return(expr); }
public ExpressionClip BitwiseAnd(ExpressionClip right) { ExpressionClip expr = ExpressionFactory.CreateCloneExpression(this); ExpressionFactory.AppendExpression(expr, QueryOperator.BitwiseAND, right); return(expr); }
public ExpressionClip Count(bool isDistinct) { ExpressionClip expr = ExpressionFactory.CreateCloneExpression(this); expr.Sql = ColumnFormatter.Count(this.Sql, isDistinct); expr.dbType = DbType.Int32; return(expr); }
public ExpressionClip GetDay() { ExpressionClip expr = ExpressionFactory.CreateCloneExpression(this); expr.Sql = ColumnFormatter.DatePart(this.Sql, ColumnFormatter.DatePartType.Day); expr.dbType = DbType.Int32; return(expr); }
public ExpressionClip BitwiseAnd(object right) { Check.Require(right != null, "right could not be null!"); ExpressionClip expr = ExpressionFactory.CreateCloneExpression(this); ExpressionFactory.AppendExpression(expr, QueryOperator.BitwiseAND, ExpressionFactory.CreateParameterExpression(this.dbType, right)); return(expr); }
public ExpressionClip SubString(int start) { Check.Require(start >= 0, "start must >= 0!"); ExpressionClip expr = ExpressionFactory.CreateCloneExpression(this); ExpressionClip cloneExpr = ExpressionFactory.CreateCloneExpression(this); StringBuilder sb = new StringBuilder("SUBSTRING("); SqlQueryUtils.AppendColumnName(sb, this.Sql); sb.Append(','); sb.Append(start + 1); sb.Append(",LEN("); SqlQueryUtils.AppendColumnName(sb, cloneExpr.Sql); sb.Append(')'); sb.Append(')'); expr.sql = sb; SqlQueryUtils.AddParameters(expr.parameters, cloneExpr); return(expr); }
public ExpressionClip IndexOf(string subString) { Check.Require(!string.IsNullOrEmpty(subString), "subString could not be null or empty!"); ExpressionClip expr = ExpressionFactory.CreateCloneExpression(this); StringBuilder sb = new StringBuilder(); sb.Append("CHARINDEX("); string paramName = MakeUniqueParamNameWithoutPrefixToken(); sb.Append(paramName); sb.Append(','); SqlQueryUtils.AppendColumnName(sb, this.Sql); sb.Append(')'); sb.Append("-1"); expr.sql = sb; expr.dbType = DbType.Int32; expr.parameters.Add(paramName, new KeyValuePair <DbType, object>(this.dbType, subString)); return(expr); }