This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Steps for inserting a record into a msi database?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 21, 2007
09:45 AM
Steps for inserting a record into a msi database?
Basic Installshield project using Installscript:
Hi Im trying to insert a row into a custom table of another msi database, all functions succeed and I use a SetupDumpView to ensure the records have been written to the table. However when I open the MSI with the proposed changes they have not been committed.
Here is the sequence of code I use - note no params included.
MsiOpenDatabase - using MSIDBOPEN_TRANSACT flag - another msi database
MsiDatabaseOpenView
MsiViewExecute
MsiViewClose
MsiDatabaseCommit
MsiCloseHandle - Database
MsiCloseHandle - View
Am I missing something?
Hi Im trying to insert a row into a custom table of another msi database, all functions succeed and I use a SetupDumpView to ensure the records have been written to the table. However when I open the MSI with the proposed changes they have not been committed.
Here is the sequence of code I use - note no params included.
MsiOpenDatabase - using MSIDBOPEN_TRANSACT flag - another msi database
MsiDatabaseOpenView
MsiViewExecute
MsiViewClose
MsiDatabaseCommit
MsiCloseHandle - Database
MsiCloseHandle - View
Am I missing something?
(9) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 21, 2007
09:52 AM
The MSI help topic "Functions Not for Use in Custom Actions" mentions MsiOpenDatabase, so that might have a bearing on the issue...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 21, 2007
10:05 AM
Hi Robert, yes just checked that.
Im using a custom action which in turn calls another function which calls those functions.
How else am I supposed to call them, if I cant call them from a custom action and why are they there then?
EDIT:
I dont think that is strictly true because I have used a sample project before to peform a replace/update on a different database using the MSIMODIFY_REPLACE flag. Only difference this time is my query is an INSERT instead of a SELECT???
Im using a custom action which in turn calls another function which calls those functions.
How else am I supposed to call them, if I cant call them from a custom action and why are they there then?
EDIT:
I dont think that is strictly true because I have used a sample project before to peform a replace/update on a different database using the MSIMODIFY_REPLACE flag. Only difference this time is my query is an INSERT instead of a SELECT???
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 21, 2007
10:12 AM
Perhaps if I use the WindowsInstaller COM interface that may work? Cant see why if the COM interface works why the API's wont??
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 21, 2007
11:11 AM
From memory, I can't speak to why the COM methods would work where the C-callable APIs wouldn't, but the reason the functions exist at all is that MSI authoring-type tools (including InstallShield) need those APIs to construct and populate an MSI database...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 22, 2007
07:51 AM
So how do I get round the problem then?
Any ideas
Any ideas
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 23, 2007
11:10 AM
Are you using InstallShield 2008? What is the specific InstallScript code (and SQL query) that fails?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 24, 2007
03:28 AM
Hi Robert
Yes Installshield 2008.
I got the functionality working before but it was bascially and find and replace e.g. an update (not an UPDATE SQL squery).
Im trying to use an INSERT SQL query. The newly inserted record appears when I dump the table contents to the console using a function called setupdumpview.
The code doesnt fail!! It just doesnt save/commit the record to the target msi database.
These are the steps :
- MsiOpenDatabase
- MsiDatabaseOpenView - using the SQL INSERT statement
- MsiViewExecute -
- MsiDatabaseCommit
The close all relevant handles and views.
Yes Installshield 2008.
I got the functionality working before but it was bascially and find and replace e.g. an update (not an UPDATE SQL squery).
Im trying to use an INSERT SQL query. The newly inserted record appears when I dump the table contents to the console using a function called setupdumpview.
The code doesnt fail!! It just doesnt save/commit the record to the target msi database.
These are the steps :
- MsiOpenDatabase
- MsiDatabaseOpenView - using the SQL INSERT statement
- MsiViewExecute -
- MsiDatabaseCommit
The close all relevant handles and views.
Not applicable
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 24, 2007
08:11 AM
What is the return value of MsiDatabaseCommit and all the other APIs?
Also, are you verifying that the handle you're using is greater than 0? You may want to ensure that.
Also, are you verifying that the handle you're using is greater than 0? You may want to ensure that.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Sep 24, 2007
08:56 AM
Hi Bryan
MsiDatabaseCommit I check for ERROR_SUCCESS else raise the approriate error.
Something Ive just noticed that may shed a clue.
I have managed to get the COM (WindowsInstaller.Installer) interface to work 9using INSERT SQL statement) and NOT the MSI API's, however when I ran the code on a VMWARE it could only open the cached database in ready only mode, but on my physical machine I could open it in read/write mode. Is there a Windows security setting to prevent modication of the cached MSI database? This is obviously an additional problem.
I thought if the COM interface works then so should the MSI API's?
MsiDatabaseCommit I check for ERROR_SUCCESS else raise the approriate error.
Something Ive just noticed that may shed a clue.
I have managed to get the COM (WindowsInstaller.Installer) interface to work 9using INSERT SQL statement) and NOT the MSI API's, however when I ran the code on a VMWARE it could only open the cached database in ready only mode, but on my physical machine I could open it in read/write mode. Is there a Windows security setting to prevent modication of the cached MSI database? This is obviously an additional problem.
I thought if the COM interface works then so should the MSI API's?