| OLD | NEW |
| (Empty) |
| 1 ' Emb.vbs. | |
| 2 ' Argument(0) is the name of the storage. | |
| 3 ' Argument(1) is the original database. | |
| 4 ' Argument(2) is the path to the transform file. | |
| 5 ' This was changed from the original to work around a gyp defect involved that r
ewrites whole command lines rather than just path-containing variables. | |
| 6 | |
| 7 Option Explicit | |
| 8 | |
| 9 ' Check arguments | |
| 10 If WScript.Arguments.Count < 2 Then | |
| 11 WScript.Echo "Usage is emb.vbs [storage name] [original database] [transform]" | |
| 12 WScript.Quit(1) | |
| 13 End If | |
| 14 | |
| 15 ' Connect to Windows Installer object | |
| 16 On Error Resume Next | |
| 17 Dim installer : Set installer = Nothing | |
| 18 Set installer = Wscript.CreateObject("WindowsInstaller.Installer") | |
| 19 | |
| 20 ' Evaluate command-line arguments and set open and update modes | |
| 21 Dim databasePath: databasePath = Wscript.Arguments(1) | |
| 22 Dim importPath : importPath = Wscript.Arguments(2) | |
| 23 Dim storageName : storageName = Wscript.Arguments(0) | |
| 24 | |
| 25 ' Open database and create a view on the _Storages table | |
| 26 Dim sqlQuery : sqlQuery = "SELECT `Name`,`Data` FROM _Storages" | |
| 27 Dim database : Set database = installer.OpenDatabase(databasePath, 1) | |
| 28 Dim view : Set view = database.OpenView(sqlQuery) | |
| 29 | |
| 30 'Create and Insert the row. | |
| 31 Dim record : Set record = installer.CreateRecord(2) | |
| 32 record.StringData(1) = storageName | |
| 33 view.Execute record | |
| 34 | |
| 35 'Insert storage - copy data into stream | |
| 36 record.SetStream 2, importPath | |
| 37 view.Modify 3, record | |
| 38 database.Commit | |
| 39 Set view = Nothing | |
| 40 Set database = Nothing | |
| OLD | NEW |