public WhereClip Or(WhereClip where) { if (WhereClip.IsNullOrEmpty(where) || where.Sql.Length == 0) { return(this); } if (sql.Length > 0) { sql.Append(" OR "); } if (where.isNot && where.sql.Length > 0) { sql.Append("NOT "); } if (where.sql.Length > 0) { sql.Append('('); sql.Append(where.sql); sql.Append(')'); } SqlQueryUtils.AddParameters(parameters, where); return(this); }
internal protected ExpressionClip Append(QueryOperator op, ExpressionClip right) { this.sql.Append(SqlQueryUtils.ToString(op)); this.sql.Append(SqlQueryUtils.ToString(right)); SqlQueryUtils.AddParameters(this.parameters, right); return(this); }
internal protected WhereClip Or(ExpressionClip left, QueryOperator op, ExpressionClip right) { if (this.sql.Length > 0) { this.sql.Append(" OR "); } this.sql.Append(SqlQueryUtils.ToString(left)); this.sql.Append(SqlQueryUtils.ToString(op)); this.sql.Append(SqlQueryUtils.ToString(right)); SqlQueryUtils.AddParameters(this.parameters, left); SqlQueryUtils.AddParameters(this.parameters, right); return(this); }
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); }