public static string Select(this ISqlDialect d, IDataDescriptor descriptor, string table, string schema, List <string> columns, List <string> keys, List <string> parameters) { return(StringBuilderPool.Scoped(sb => { if (descriptor != null && !d.BeforeSelect(descriptor, sb)) { return; } sb.Append("SELECT "); if (!d.BeforeSelectColumns(descriptor, sb, columns)) { return; } for (var i = 0; i < columns.Count; i++) { sb.AppendName(d, columns[i]); if (i < columns.Count - 1) { sb.Append(", "); } } sb.Append(" FROM ").AppendTable(d, table, schema); sb.AppendWhereClause(descriptor, d, keys, parameters); })); }
public static string Count(this ISqlDialect d, IDataDescriptor descriptor, string table, string schema, List <string> keys, List <string> parameters) { return(Pooling.StringBuilderPool.Scoped(sb => { if (descriptor != null && !d.BeforeSelect(descriptor, sb)) { return; } sb.Append("SELECT "); sb.Append(d.Count); sb.Append(" FROM ").AppendTable(d, table, schema); if (keys?.Count > 0) { sb.AppendWhereClause(descriptor, d, keys, parameters); } d.AfterCount(descriptor, sb, keys?.Count > 0); })); }