diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-12-07 14:19:05 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-12-07 14:19:05 -0800 |
| commit | 49f1209035aac1fcfad5dbbe25f7b2306d3be86c (patch) | |
| tree | 6ce5921493eb751b6d89c3faf0ebdf64110cbb65 /src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs | |
| parent | b1e662bd480241ea914f0f3d6bd174d9ffd03f5f (diff) | |
| download | wix-49f1209035aac1fcfad5dbbe25f7b2306d3be86c.tar.gz wix-49f1209035aac1fcfad5dbbe25f7b2306d3be86c.tar.bz2 wix-49f1209035aac1fcfad5dbbe25f7b2306d3be86c.zip | |
Support MSI backends creating custom tables and remove WixToolset.Data.WindowsInstaller
Diffstat (limited to 'src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs')
| -rw-r--r-- | src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs | 55 |
1 files changed, 51 insertions, 4 deletions
diff --git a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs index a3d3ecf7..e4e66559 100644 --- a/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs +++ b/src/WixToolset.Core.WindowsInstaller/Bind/GenerateDatabaseCommand.cs | |||
| @@ -12,6 +12,7 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 12 | using WixToolset.Extensibility; | 12 | using WixToolset.Extensibility; |
| 13 | using WixToolset.Msi; | 13 | using WixToolset.Msi; |
| 14 | using WixToolset.Core.Native; | 14 | using WixToolset.Core.Native; |
| 15 | using WixToolset.Data.WindowsInstaller; | ||
| 15 | 16 | ||
| 16 | internal class GenerateDatabaseCommand | 17 | internal class GenerateDatabaseCommand |
| 17 | { | 18 | { |
| @@ -44,14 +45,56 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 44 | // Add the _Validation rows. | 45 | // Add the _Validation rows. |
| 45 | if (!this.SuppressAddingValidationRows) | 46 | if (!this.SuppressAddingValidationRows) |
| 46 | { | 47 | { |
| 47 | Table validationTable = this.Output.EnsureTable(this.TableDefinitions["_Validation"]); | 48 | var validationTable = this.Output.EnsureTable(this.TableDefinitions["_Validation"]); |
| 48 | 49 | ||
| 49 | foreach (Table table in this.Output.Tables) | 50 | foreach (var table in this.Output.Tables) |
| 50 | { | 51 | { |
| 51 | if (!table.Definition.Unreal) | 52 | if (!table.Definition.Unreal) |
| 52 | { | 53 | { |
| 53 | // Add the validation rows for this table. | 54 | // Add the validation rows for this table. |
| 54 | table.Definition.AddValidationRows(validationTable); | 55 | foreach (ColumnDefinition columnDef in table.Definition.Columns) |
| 56 | { | ||
| 57 | var row = validationTable.CreateRow(null); | ||
| 58 | |||
| 59 | row[0] = table.Name; | ||
| 60 | |||
| 61 | row[1] = columnDef.Name; | ||
| 62 | |||
| 63 | if (columnDef.Nullable) | ||
| 64 | { | ||
| 65 | row[2] = "Y"; | ||
| 66 | } | ||
| 67 | else | ||
| 68 | { | ||
| 69 | row[2] = "N"; | ||
| 70 | } | ||
| 71 | |||
| 72 | if (columnDef.MinValue.HasValue) | ||
| 73 | { | ||
| 74 | row[3] = columnDef.MinValue.Value; | ||
| 75 | } | ||
| 76 | |||
| 77 | if (columnDef.MaxValue.HasValue) | ||
| 78 | { | ||
| 79 | row[4] = columnDef.MaxValue.Value; | ||
| 80 | } | ||
| 81 | |||
| 82 | row[5] = columnDef.KeyTable; | ||
| 83 | |||
| 84 | if (columnDef.KeyColumn.HasValue) | ||
| 85 | { | ||
| 86 | row[6] = columnDef.KeyColumn.Value; | ||
| 87 | } | ||
| 88 | |||
| 89 | if (ColumnCategory.Unknown != columnDef.Category) | ||
| 90 | { | ||
| 91 | row[7] = columnDef.Category.ToString(); | ||
| 92 | } | ||
| 93 | |||
| 94 | row[8] = columnDef.Possibilities; | ||
| 95 | |||
| 96 | row[9] = columnDef.Description; | ||
| 97 | } | ||
| 55 | } | 98 | } |
| 56 | } | 99 | } |
| 57 | } | 100 | } |
| @@ -133,7 +176,11 @@ namespace WixToolset.Core.WindowsInstaller.Bind | |||
| 133 | { | 176 | { |
| 134 | try | 177 | try |
| 135 | { | 178 | { |
| 136 | db.ImportTable(this.Output.Codepage, importTable, baseDirectory, this.KeepAddedColumns); | 179 | //db.ImportTable(this.Output.Codepage, importTable, baseDirectory, this.KeepAddedColumns); |
| 180 | var command = new CreateIdtFileCommand(importTable, this.Output.Codepage, baseDirectory, this.KeepAddedColumns); | ||
| 181 | command.Execute(); | ||
| 182 | |||
| 183 | db.Import(command.IdtPath); | ||
| 137 | } | 184 | } |
| 138 | catch (WixInvalidIdtException) | 185 | catch (WixInvalidIdtException) |
| 139 | { | 186 | { |
