public SqlUpdateEntry And(SqlCondition condition) { if (WhereCondition is not null) { WhereCondition = WhereCondition && condition; } else { throw new InvalidOperationException(); } return(this); }
public SqlDeleteEntry Or(SqlCondition condition) { if (WhereCondition is not null) { WhereCondition = WhereCondition || condition; } else { throw new InvalidOperationException(); } return(this); }
public SqlJoin(SqlJoinType type, SqlTable table, SqlCondition where) { Type = type; Table = table; WhereCondition = where; }
public override string FormatSelectLimit(SqlTable table, SqlColumn[] columns, SqlJoin[] joins, SqlCondition where, SqlOrder order, int limit, SqlSelectOptions options) { SqlStatement s = "select"; if (options.HasFlag(SqlSelectOptions.Distinct)) { s += "distinct"; } s += $"top {limit} {FormatColumn(columns)}"; s += FormatFrom(table); s += FormatJoin(joins); s += FormatWhere(where); s += FormatOrder(order); return(s); }
public SqlUpdateEntry Where(SqlCondition condition) { WhereCondition = condition; return(this); }
private static SqlCondition Conjunction(SqlCondition condition1, SqlConjunctionOperator conjunction, SqlCondition condition2) { if (condition1 is not null && condition2 is not null) { return(new SqlCondition(condition1, conjunction, condition2)); }
private SqlCondition(SqlCondition condition1, SqlConjunctionOperator booleanOperator, SqlCondition condition2) { Condition1 = condition1; BooleanOperator = booleanOperator; Condition2 = condition2; }