Skip to content

Commit c77e049

Browse files
committed
Merge branch 'development'
2 parents 3fa62c9 + be757bb commit c77e049

3 files changed

Lines changed: 30 additions & 7 deletions

File tree

SQLParser/Translators/BaseTranslator.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,11 @@ public virtual FlowDocument GetFlowDocument(string text) {
297297
return document;
298298
}
299299

300+
/// <summary>
301+
/// formats the final text to a Paragraph of FlowDocument with colors and styles
302+
/// </summary>
303+
/// <param name="text"></param>
304+
/// <returns></returns>
300305
private Paragraph Format(string text) {
301306
Paragraph paragraph = new Paragraph();
302307

@@ -1500,6 +1505,9 @@ public virtual string BinaryExpressionParse(BinaryExpression expression, object
15001505
else if (expression.FirstExpression is CastCall castCall1) {
15011506
firstExpression = CastCallParse(castCall1);
15021507
}
1508+
else if (expression.FirstExpression is FunctionCall functionCall1) {
1509+
firstExpression = FunctionCallParse(functionCall1);
1510+
}
15031511
else {
15041512
firstExpression = "~UNKNOWN ScalarExpression~";
15051513
}
@@ -1528,6 +1536,9 @@ public virtual string BinaryExpressionParse(BinaryExpression expression, object
15281536
else if (expression.SecondExpression is CastCall castCall2) {
15291537
secondExpression = CastCallParse(castCall2);
15301538
}
1539+
else if (expression.SecondExpression is FunctionCall functionCall2) {
1540+
secondExpression = FunctionCallParse(functionCall2);
1541+
}
15311542
else {
15321543
secondExpression = "~UNKNOWN ScalarExpression~";
15331544
}

SQLParser/Translators/SqlOMTranslator.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,11 @@ public virtual FlowDocument GetFlowDocument(string text) {
193193
return document;
194194
}
195195

196+
/// <summary>
197+
/// formats the final text to a Paragraph of FlowDocument with colors and styles
198+
/// </summary>
199+
/// <param name="text"></param>
200+
/// <returns></returns>
196201
public virtual Paragraph Format(string text, ref bool isText) {
197202
Paragraph paragraph = new Paragraph();
198203

SQLTailor/MainWindow.xaml.cs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,9 @@ private void Window_Loaded(object sender, RoutedEventArgs e) {
481481

482482
private void AnalyzeSql(object sender, RoutedEventArgs e) {
483483

484-
if (string.IsNullOrWhiteSpace(sqlSource)) {
485-
return;
486-
}
484+
//if (string.IsNullOrWhiteSpace(sqlSource)) {
485+
// return;
486+
//}
487487

488488
try {
489489
Mouse.OverrideCursor = Cursors.Wait;
@@ -585,7 +585,10 @@ private void ClearEditor(object sender, RoutedEventArgs e) {
585585
}
586586

587587
private void CopyFromEditor(object sender, RoutedEventArgs e) {
588-
Copy(sqlSource);
588+
589+
FlowDocument document = SQLSourceEditor.Document;
590+
string source = new TextRange(document.ContentStart, document.ContentEnd).Text;
591+
Copy(source);
589592
}
590593

591594
private void CopyMicrosoftTSQL(object sender, RoutedEventArgs e) {
@@ -1006,7 +1009,7 @@ private void FillParserQueryParametersFromList() {
10061009
/// </summary>
10071010
/// <param name="text"></param>
10081011
private void Copy(string text) {
1009-
Clipboard.SetText(sqlSource);
1012+
Clipboard.SetText(text);
10101013
Message = "query copied";
10111014
}
10121015

@@ -1015,6 +1018,11 @@ private void Copy(string text) {
10151018
/// </summary>
10161019
/// <param name="document"></param>
10171020
private void Copy(FlowDocument document) {
1021+
1022+
if (document == null) {
1023+
document = new FlowDocument();
1024+
}
1025+
10181026
TextRange range = new TextRange(document.ContentStart, document.ContentEnd);
10191027

10201028
using (Stream stream = new MemoryStream()) {
@@ -1024,9 +1032,8 @@ private void Copy(FlowDocument document) {
10241032
Message = "query copied";
10251033
}
10261034

1027-
10281035
#endregion
10291036

1030-
1037+
10311038
}
10321039
}

0 commit comments

Comments
 (0)