Skip to content

Commit 6a507f0

Browse files
committed
Fix finish handler + newline handling
1 parent 1908f5e commit 6a507f0

4 files changed

Lines changed: 17 additions & 12 deletions

File tree

sql_profiler/Code/Lexer/YukonLexer.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public string StandardSql(string sql)
7676
public string SyntaxHighlight(OutputWriter sb, string value)
7777
{
7878
Line = value;
79-
79+
8080
System.Collections.Generic.List<TokenKind> lsTokenTypeHistory =
8181
new System.Collections.Generic.List<TokenKind>();
8282

@@ -137,9 +137,10 @@ public string SyntaxHighlight(OutputWriter sb, string value)
137137
}
138138
Next();
139139
}
140-
140+
141141
sb.AppendLine();
142-
142+
sb.AppendLine();
143+
143144
lsTokenTypeHistory.Clear();
144145
lsTokenTypeHistory = null;
145146

sql_profiler/Code/OutputWriter/ConsoleOutputWriter.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,17 @@ public override System.Drawing.Color BackColor
7777
{
7878
// if (!s_colorDict.ContainsKey(value)) System.Console.WriteLine(value);
7979
System.Console.BackgroundColor = s_colorDict[value];
80-
System.Console.WriteLine(new string(' ', System.Console.BufferWidth));
80+
this.AppendLine();
81+
//System.Console.WriteLine(new string(' ', System.Console.BufferWidth));
8182
}
8283
}
8384

8485

8586
public override void AppendLine()
8687
{
87-
System.Console.WriteLine();
88+
// Finish the line with empty color
89+
System.Console.Write(new string(' ', System.Console.BufferWidth - System.Console.CursorLeft));
90+
// System.Console.WriteLine();
8891
}
8992

9093

sql_profiler/Code/SqlServerProfiler.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,7 @@ protected void NewEventArrived(ProfilerEvent evt, bool last)
395395
string caption = GetEventCaption(evt);
396396
System.Console.Write(caption);
397397
System.Console.Write(new string(' ', System.Console.BufferWidth - System.Console.CursorLeft));
398-
System.Console.WriteLine();
399398

400-
401-
402-
System.Console.WriteLine();
403399
string td = evt.GetFormattedData(ProfilerEventColumns.TextData, null);
404400
// System.Console.WriteLine(td);
405401

sql_profiler/Program.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ static void MainTest(string[] args)
288288
{
289289
string instance = GetPlatformDefaultInstance();
290290
// dotnet run --server localhost --username MY_USER --password MY_PASSWORD --db MY_DB
291-
string ar = $"--server {instance} --username WebAppWebServices --password TOP_SECRET /Db COR_Basic_Demo_V4";
291+
// string ar = $"--server {instance} --username WebAppWebServices --password TOP_SECRET --Db COR_Basic_Demo_V4";
292+
string ar = $"--server {instance} /db \"SwissRe_Test_V4\"";
292293
DoProfiling(ar.Split(' '));
293294
} // End Sub Main
294295

@@ -355,8 +356,12 @@ static void DoProfiling(string[] args)
355356
s_profiler.StartProfiling();
356357

357358

358-
System.Console.WriteLine("--- Press any key to stop profiling --- ");
359-
System.Console.ReadKey();
359+
// System.Console.WriteLine("--- Press any key to stop profiling --- ");
360+
//System.Console.ReadKey();
361+
362+
System.Console.WriteLine("--- Press ENTER to stop profiling --- ");
363+
System.Console.ReadLine();
364+
360365
OnExit();
361366
} // End Sub Test
362367

0 commit comments

Comments
 (0)