public override void WriteToStream(IndentStream stream) { stream.Write("DELETE"); if (TopExpr != null) { stream.Write(" "); TopExpr.WriteToStream(stream); } stream.Write(" FROM "); Table.WriteToStream(stream); if (WithOptions != null && WithOptions.Count > 0) { stream.Write(" WITH("); WithOptions.WriteToStreamWithComma(stream); stream.Write(")"); } if (OutputList != null && OutputList.Count > 0) { stream.WriteLine(); stream.Write("OUTPUT "); OutputList.WriteToStreamWithComma(stream); } if (IntoTableExpr != null) { stream.WriteLine(); IntoTableExpr.WriteToStream(stream); } if (OutputList1 != null && OutputList1.Count > 0) { stream.WriteLine(); stream.Write("OUTPUT "); OutputList.WriteToStreamWithComma(stream); } if (FromSourceList != null && FromSourceList.Count > 0) { stream.WriteLine(); stream.Write("FROM "); FromSourceList.WriteToStreamWithComma(stream); } if (WhereExpr != null) { stream.WriteLine(); stream.Write("WHERE "); WhereExpr.WriteToStream(stream); } if (OptionExpr != null) { stream.WriteLine(); OptionExpr.WriteToStream(stream); } }
public override void WriteToStream(IndentStream stream) { stream.Write("CREATE"); if (IsUnique) { stream.Write(" UNIQUE"); } stream.Write(" NONCLUSTERED INDEX "); IndexName.WriteToStream(stream); stream.Write(" ON "); TableName.WriteToStream(stream); stream.Write("("); ColumnList.WriteToStreamWithComma(stream); stream.Write(")"); if (WhereExpr != null) { stream.Write(" WHERE ("); WhereExpr.WriteToStream(stream); stream.Write(")"); } if (WithExpr != null) { stream.Write(" "); WithExpr.WriteToStream(stream); } if (OnPrimary != null) { stream.Write(" "); OnPrimary.WriteToStream(stream); } if (IsSemicolon) { stream.Write(" ;"); } }
public override void WriteToStream(IndentStream stream) { stream.Write("SELECT"); if (TopCount != null) { stream.Write(" "); TopCount.WriteToStream(stream); } stream.Write(" "); foreach (var column in Columns.Select((value, idx) => new { value, idx })) { if (column.idx != 0) { stream.Write(", "); } column.value.WriteToStream(stream); } if (IntoTable != null) { stream.WriteLine(); stream.Write("INTO "); IntoTable.WriteToStream(stream); } if (FromSourceList.Count > 0) { stream.WriteLine(); stream.Write("FROM "); stream.Indent++; for (int i = 0; i < FromSourceList.Count; i++) { if (i != 0) { stream.WriteLine(", "); } var fromSource = FromSourceList[i]; fromSource.WriteToStream(stream); } stream.Indent--; } if (ForXmlExpr != null) { stream.WriteLine(); ForXmlExpr.WriteToStream(stream); } if (PivotExpr != null) { stream.WriteLine(); PivotExpr.WriteToStream(stream); } if (WhereExpr != null) { stream.WriteLine(); stream.Write("WHERE "); WhereExpr.WriteToStream(stream); } if (GroupByList.Count > 0) { stream.WriteLine(); stream.Write("GROUP BY "); GroupByList.WriteToStreamWithComma(stream); } if (Having != null) { stream.WriteLine(); Having.WriteToStream(stream); } if (OrderByList.Count > 0) { stream.WriteLine(); stream.Write("ORDER BY "); OrderByList.WriteToStreamWithComma(stream); } if (OptionExpr != null) { stream.WriteLine(); OptionExpr.WriteToStream(stream); } if (UnionSelectList != null && UnionSelectList.Count > 0) { stream.WriteLine(); UnionSelectList.WriteToStream(stream); } if (IsSemicolon) { stream.Write(" ;"); } }