diff options
Diffstat (limited to 'src/WixBuildTools.TestSupport/Builder.cs')
-rw-r--r-- | src/WixBuildTools.TestSupport/Builder.cs | 50 |
1 files changed, 2 insertions, 48 deletions
diff --git a/src/WixBuildTools.TestSupport/Builder.cs b/src/WixBuildTools.TestSupport/Builder.cs index 62439ff7..aae9681a 100644 --- a/src/WixBuildTools.TestSupport/Builder.cs +++ b/src/WixBuildTools.TestSupport/Builder.cs | |||
@@ -1,12 +1,10 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. |
2 | 2 | ||
3 | namespace WixBuildTools.TestSupport | 3 | namespace WixBuildTools.TestSupport |
4 | { | 4 | { |
5 | using System; | 5 | using System; |
6 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
7 | using System.IO; | 7 | using System.IO; |
8 | using System.Text; | ||
9 | using WixToolset.Dtf.WindowsInstaller; | ||
10 | 8 | ||
11 | public class Builder | 9 | public class Builder |
12 | { | 10 | { |
@@ -62,52 +60,8 @@ namespace WixBuildTools.TestSupport | |||
62 | 60 | ||
63 | buildFunc(args.ToArray()); | 61 | buildFunc(args.ToArray()); |
64 | 62 | ||
65 | return this.Query(outputPath, tables); | 63 | return Query.QueryDatabase(outputPath, tables); |
66 | } | 64 | } |
67 | } | 65 | } |
68 | |||
69 | private string[] Query(string path, string[] tables) | ||
70 | { | ||
71 | var results = new List<string>(); | ||
72 | |||
73 | if (tables?.Length > 0) | ||
74 | { | ||
75 | var sb = new StringBuilder(); | ||
76 | using (var db = new Database(path)) | ||
77 | { | ||
78 | foreach (var table in tables) | ||
79 | { | ||
80 | using (var view = db.OpenView($"SELECT * FROM `{table}`")) | ||
81 | { | ||
82 | view.Execute(); | ||
83 | |||
84 | Record record; | ||
85 | while ((record = view.Fetch()) != null) | ||
86 | { | ||
87 | sb.Clear(); | ||
88 | sb.AppendFormat("{0}:", table); | ||
89 | |||
90 | using (record) | ||
91 | { | ||
92 | for (var i = 0; i < record.FieldCount; ++i) | ||
93 | { | ||
94 | if (i > 0) | ||
95 | { | ||
96 | sb.Append("\t"); | ||
97 | } | ||
98 | |||
99 | sb.Append(record[i + 1]?.ToString()); | ||
100 | } | ||
101 | } | ||
102 | |||
103 | results.Add(sb.ToString()); | ||
104 | } | ||
105 | } | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | |||
110 | return results.ToArray(); | ||
111 | } | ||
112 | } | 66 | } |
113 | } | 67 | } |