internal override string ToSql() { var sb = new StringBuilder(PreviousClause.ToSql() + " "); for (int i = 0; i < OrderBys.Count; i++) { KeyValuePair <string, SortOrder?> kvp = OrderBys.ElementAt(i); sb.AppendIf(i == 0, "ORDER BY "); sb.Append($"{kvp.Key}"); sb.AppendIf(kvp.Value.HasValue, $" {(kvp.Value == SortOrder.Descending ? "DESC" : "ASC")}"); sb.AppendIf(i < OrderBys.Count - 1, ", "); } return(sb.ToString()); }
internal override string ToSql() { var sb = new StringBuilder(); sb.Append(PreviousClause.ToSql() + " "); sb.Append("WHERE "); for (int i = 0; i < whereClauses.Count; i++) { sb.Append(whereClauses[i].ToSql()); if (i < whereClauses.Count - 1) { sb.Append(" "); } } return(sb.ToString()); }
internal override string ToSql() { return($"{PreviousClause.ToSql()} FETCH NEXT {RowCount} ROWS ONLY"); }
internal override string ToSql() { return($"{PreviousClause.ToSql()} OFFSET {Number}{(SqlDialect == Dialect.SqlServer ? " ROWS" : "")}"); }
internal override string ToSql() { return($"{PreviousClause.ToSql()} LIMIT {Count}"); }
internal override string ToSql() { return($"{PreviousClause.ToSql()} HAVING {Text}");; }
internal override string ToSql() { return($"{PreviousClause.ToSql()} GROUP BY {string.Join(", ", GroupBys)}"); }
internal override string ToSql() { return($"{PreviousClause.ToSql()} ON {Column1} = {Column2}"); }
internal override string ToSql() { return($"{PreviousClause.ToSql()} {JoinType.ToSqlString()} {Name}{(Alias.NotNullOrWhiteSpace() ? " " + Alias : "")}"); }
internal override string ToSql() { return(PreviousClause != null ? $"{PreviousClause.ToSql()} FROM {Name}{(Alias.NotNullOrWhiteSpace() ? " " + Alias : "")}" : $"FROM {Name}{(Alias.NotNullOrWhiteSpace() ? " " + Alias : "")}"); }
internal override string ToSql() { return(PreviousClause != null ? $"{PreviousClause.ToSql()} TOP {Count}" : $"TOP {Count}"); }