[This is preliminary documentation and subject to change.]
The MsiOpenDatabase function opens a database file for data access.
UINT MsiOpenDatabase(
LPCTSTR szDatabasePath, // path to database
LPCTSTR szPersist, // output database or predefined
// persist mode
MSIHANDLE *phDatabase // location to return database handle
);
Value | Meaning |
---|---|
MSIDBOPEN_CREATEDIRECT | Create a new database, direct mode read/write. |
MSIDBOPEN_CREATE | Create a new database, transact mode read/write. |
MSIDBOPEN_DIRECT | Open a database direct read/write without transaction. |
MSIDBOPEN_READONLY | Open a database read-only, no persistent changes. |
MSIDBOPEN_TRANSACT | Open a database read/write in transaction mode. |
The MsiOpenDatabase function initiates database access. This function cannot be used for a running installation. The database must be opened in transaction, create, or direct mode for changes to be retained. Create mode creates a new installer database
Note When a database is opened as the output of another database, the summary information stream of the output database is actually a read-only mirror of the original database, and, thus, cannot be changed. Additionally, it is not persisted with the database. To create or modify the summary information for the output database, it must be closed and reopened.
Windows NT: Requires version 4.0 or later. Available as a redistributable for Windows NT 4.0.
Windows: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Windows CE: Unsupported.
Header: Declared in msiquery.h.
Import Library: Use msi.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
Database Access Reference, General Database Access Functions