/// <summary> /// Creates a select statement from a statement part. /// </summary> /// <param name="part">The part.</param> /// <returns>The select statement.</returns> public static SelectStatement From(StatementPart part) { return(new SelectStatement() { Source = part }); }
private void AddValue(object value) { if (value == null) { this.Value = new ConstantPart(null); return; } //if (value is IEnumerable && !(value is string)) //{ // foreach (object subval in (IEnumerable)value) // { // if (subval is StatementPart) // { // this.Value.Add((StatementPart)subval); // } // else // { // this.Value.Add(new ConstantPart(subval)); // } // } //} //else //{ if (value is StatementPart) { this.Value = (StatementPart)value; } else { this.Value = new ConstantPart(value); } //} }
public SetValue(Column column, object value) { this.Column = column; if (value is StatementPart statementPartValue) { this.Value = statementPartValue; } else { this.Value = new ConstantPart(value); } }
private void VisitDatePartField(StatementPart datePart) { if (datePart.PartType == StatementPartType.ConstantPart) { var constantPart = (ConstantPart)datePart; // HACK: Not 100% sure it will always be convertible to an int? var value = Convert.ToInt32(constantPart.Value).ToString("D2"); this.VisitField(new ConstantPart(value)); } else { this.VisitField(datePart); } }
/// <summary> /// Initializes a new instance of the <see cref="UnaryOperation" /> class. /// </summary> /// <param name="op">The operator.</param> /// <param name="expression">The expression.</param> public UnaryOperation(UnaryOperator op, StatementPart expression) { this.Operator = op; this.Expression = expression; }
public Join(JoinType joinType, StatementPart right, ConditionExpression condition) { this.JoinType = joinType; this.Table = right; this.Conditions.Add(condition); }
public SetValue(Column column, object value) { this.Column = column; this.Value = new ConstantPart(value); }