-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathSqlScriptGeneratorVisitor.TSqlScript.cs
More file actions
42 lines (38 loc) · 1.37 KB
/
SqlScriptGeneratorVisitor.TSqlScript.cs
File metadata and controls
42 lines (38 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//------------------------------------------------------------------------------
// <copyright file="SqlScriptGeneratorVisitor.TSqlScript.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
using Microsoft.SqlServer.TransactSql.ScriptDom;
using System;
namespace Microsoft.SqlServer.TransactSql.ScriptDom.ScriptGenerator
{
partial class SqlScriptGeneratorVisitor
{
public override void ExplicitVisit(TSqlScript node)
{
// Initialize token stream for comment preservation
if (_options.PreserveComments && node.ScriptTokenStream != null)
{
SetTokenStreamForComments(node.ScriptTokenStream);
}
Boolean firstItem = true;
foreach (var item in node.Batches)
{
if (firstItem)
{
firstItem = false;
}
else
{
NewLine();
GenerateKeyword(TSqlTokenType.Go);
NewLine();
}
GenerateFragmentIfNotNull(item);
}
// Emit any remaining comments at end of script (after the last statement)
EmitRemainingComments();
}
}
}