Esempio n. 1
0
 public SqlUpdateEntry And(SqlCondition condition)
 {
     if (WhereCondition is not null)
     {
         WhereCondition = WhereCondition && condition;
     }
     else
     {
         throw new InvalidOperationException();
     }
     return(this);
 }
Esempio n. 2
0
 public SqlDeleteEntry Or(SqlCondition condition)
 {
     if (WhereCondition is not null)
     {
         WhereCondition = WhereCondition || condition;
     }
     else
     {
         throw new InvalidOperationException();
     }
     return(this);
 }
Esempio n. 3
0
 public SqlJoin(SqlJoinType type, SqlTable table, SqlCondition where)
 {
     Type           = type;
     Table          = table;
     WhereCondition = where;
 }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
 public SqlUpdateEntry Where(SqlCondition condition)
 {
     WhereCondition = condition;
     return(this);
 }
Esempio n. 6
0
 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));
     }
Esempio n. 7
0
 private SqlCondition(SqlCondition condition1, SqlConjunctionOperator booleanOperator, SqlCondition condition2)
 {
     Condition1      = condition1;
     BooleanOperator = booleanOperator;
     Condition2      = condition2;
 }