public static string FormatWherePart(WherePart wherePart)
 {
     return $"{QuoteDottedIdentifier(wherePart.Column.QualifiedName)} {wherePart.Operator} @{wherePart.Parameter.Name}";
 }
 public static string FormatUpdate(UpdateStatement update, WherePart wherePart)
 {
     var setClause = string.Join(", ", update.Columns.Zip(update.Values, (c, p) => $"{c} = @{p.Name}"));
     return $@"UPDATE {QuoteDottedIdentifier(update.Table.QualifiedName)} SET {setClause} WHERE {FormatWherePart(wherePart)} RETURNING *";
 }
Example #3
0
 protected override string FormatSql(QueryCommand command, WherePart wherePart)
 {
     var limit = command.Single ? Limit1 : string.Empty;
     return $"SELECT * FROM {QuoteHelper.Quote(command.Table.QualifiedName)} WHERE {SqlFormatter.FormatWherePart(wherePart)} {limit}";
 }
Example #4
0
 protected override string FormatSql(UpdateStatement update, WherePart wherePart)
 {
     return SqlFormatter.FormatUpdate(update, wherePart);
 }
 protected abstract string FormatSql(UpdateStatement command, WherePart wherePart);
Example #6
0
 protected override string FormatSql(QueryCommand command, WherePart wherePart)
 {
     return $"SELECT {(command.Single ? Top1 : string.Empty)} * FROM {QuoteHelper.Quote(command.Table.QualifiedName)} WHERE {SqlFormatter.FormatWherePart(wherePart)}";
 }
 protected abstract string FormatSql(QueryCommand command, WherePart wherePart);