I am facing problem: while adding entries to MsiAssembly and MsiAssemblyName Table of msi database using MsiOpenDatabaseView() method it is justing failing with the error code - 1615. This is the case with only these two tables. At First I thought It would be due to the reason that I dint change the Application Type to .NET. but after changing that also it is not working. Then I tried updating _Validation table for the entries of MsiAssembly and MsiAssemblyName tables. It too dint work out. Probably I am missing some dependency which is hindering the records to be entered in MsiAssembly and MsiAssembly Tables. can u give me some clue or hint about this problem?????? thanks.
1 Answers
Error 1615 is "SQL query syntax invalid or unsupported". Without seeing your query, my first guesses would be that the table is not present in the .msi file you are trying to edit, or you are trying to do something that the Windows Installer SQL syntax does not properly support. (For complicated queries I prefer using record-based updates through MsiVewModify()
wherever possible.)
For the insert in your error message you can verify the table exists by verifying
MsiDatabaseIsTablePersistent(hDatabase, TEXT("MsiAssembly")) == MSICONDITION_TRUE
If it does not, you can add it, either though a call to MsiDatabaseImport (pass it a file created from MsiDatabaseExport), or through the correct CREATE TABLE ...
SQL query.
Then I would prefer insert code along the lines of the following (error checking elided for clarity). It can provide error information at several steps along the way instead of lumped all into the MsiViewExecute call of the raw SQL approach.
PMSIHANDLE hView, hRec;
MsiDatabaseOpenView(hDatabase, TEXT("SELECT * FROM `MsiAssembly`"), &hView);
MsiViewExecute(hView, NULL);
hRec = MsiCreateRecord(5);
MsiRecordSetString(hRec, 1, TEXT("Abc.dll"));
MsiRecordSetString(hRec, 2, TEXT("MainApp"));
MsiRecordSetString(hRec, 3, TEXT("Abc"));
MsiRecordSetString(hRec, 4, TEXT(""));
MsiRecordSetInteger(hRec, 5, 0);
// note: if modifying during installation, use MSIMODIFY_INSERT_TEMPORARY instead
MsiViewModify(hView, MSIMODIFY_INSERT, hRec);

- 15,737
- 2
- 28
- 44
-
Calling MsiGetLastErrorRecord for additional details and passing the resulting handle to MsiFormatRecord results in the following: 1: 2228 2: F:\Source\Mymsi.msi 3: MsiAssembly 4: INSERT INTO `MsiAssembly` (`MsiAssembly`.`Component_`, `MsiAssembly`.`Feature_`, `MsiAssembly`.`File_Manifest`, `MsiAssembly`.`File_Application`, `MsiAssembly`.`Attributes`) VALUES ('Abc.dll','MainApp','Abc','', 0) 2228: stands for unknown table but table is present in msi DB. – dev May 04 '12 at 05:53
-
I have got the reason for this error. In msi database if some tables are not initialized (empty) and we try to insert records in them we get error message: 2228 - the table is unknown or does not exist. but if somehow (by using wise for windows installer, wix etc.) we put a dummy record in the table. The issue will be solved. I don't know the reason for this. but it is case most of the times. If somebody explains this it would be quite helpful. – dev May 08 '12 at 05:17
-
Sounds like you confirmed my hunch - the table doesn't actually exist in your built MSI. (Perhaps wise removes empty tables.) – Michael Urman May 08 '12 at 11:56
-
you are right before inserting any records in msi tables we should first confirm whether the table exists or not. but the question is why this is the case with only few msi tables? also can u tell me any Installer function or any technique which initializes an empty msi table ? – dev May 09 '12 at 11:23
-
There are two ways to add a table. One is through MsiDatabaseImport; the other is through SQL and MsiDatabaseOpenView and MsiViewExecute. – Michael Urman May 09 '12 at 11:42