public Sql Append(Sql sql) { if (_rhs != null) _rhs.Append(sql); else _rhs = sql; return this; }
private void Build(StringBuilder sb, List<object> args, Sql lhs) { if (!String.IsNullOrEmpty(_sql)) { // 添加SQL到字符串中 if (sb.Length > 0) { sb.Append("\n"); } var sql = Database.ProcessParams(_sql, _args, args); if (Is(lhs, "WHERE ") && Is(this, "WHERE "))//最上层sql对象的lhs为空,所以失败 sql = "AND " + sql.Substring(6); if (Is(lhs, "ORDER BY ") && Is(this, "ORDER BY ")) sql = ", " + sql.Substring(9); sb.Append(sql); } if (_rhs != null) _rhs.Build(sb, args, this); }
public SqlJoinClause(Sql sql) { _sql = sql; }
static bool Is(Sql sql, string sqltype) { return sql != null && sql._sql != null && sql._sql.StartsWith(sqltype, StringComparison.InvariantCultureIgnoreCase); }