Working with Queries

[This is preliminary documentation and subject to change.]

Because the installer uses a relational database, there are functions for making Structured Query Language (SQL) queries to the database. The following procedure describes how to use SQL to query a database:

    To query a database with SQL
  1. Open the view object, with the appropriate SQL statement, by calling the MsiDatabaseOpenView function.

    A view object is the logical table created by applying a query to a set of tables. SQL queries must adhere to the SQL syntax provided by the installer. This SQL statement can contain parameter markers that are not specified until the view object runs.

  2. Run the view object by calling the MsiViewExecute function.
  3. Retrieve the next record from a view object by calling the MsiViewFetch function.
  4. Modify the view object by calling the MsiViewModify function.

    You can also validate data with MsiViewModify by passing the appropriate flags. If MsiViewModify returns ERROR_INVALID_DATA from a validation request, the underlying data is corrupt.

  5. Obtain detailed error information on the view object by calling the MsiViewGetError function.
  6. Close the view object by calling the MsiViewClose function.