Redigera

Dela via


Database object

The Database object accesses an installer database.

The Database object is released when it is either taken out of scope or when the object variable associated with it is set to null. The Commit method must be called before the Database object is released to write out all persistent changes. If the Commit method is not called, the installer performs an implicit rollback upon object destruction.

The client can use the following procedure for data access.

To Query API Sequencing

  1. Obtain a Database object by calling the OpenDatabase or the Installer object.
  2. Initiate a query using a SQL string by calling the OpenView method of the Database object.
  3. Set query parameters in a Record object and execute the database query by calling the Execute method of the View object. This produces a result that can be fetched or updated.
  4. Call the Fetch method of the View object repeatedly to return Record objects.
  5. Update database rows of a Record object obtained by the Fetch method using the Modify method of the View object.
  6. Release the query and any unfetched records by calling the Close method of the View object.
  7. Persist any database updates by calling the Commit method of the Database object.

Members

The Database object has these types of members:

Methods

The Database object has these methods.

Method Description
ApplyTransform Applies the transform to this database.
Commit Finalizes the persistent form of the database.
CreateTransformSummaryInfo Creates and populates the summary information stream of an existing transform file.
EnableUIPreview Facilitates the authoring of dialog boxes and billboards by providing the support needed to view user interface dialog boxes stored in the installer database.
Export Copies the structure and data from a specified table to a text archive file.
GenerateTransform Creates a transform.
Import Imports a database table from a text archive file.
Merge Merges the reference database with the base database.
OpenView Returns a View object representing the query specified by a SQL string.

Properties

The Database object has these properties.

Property Description
DatabaseState
Returns the persistence state of the database.
PrimaryKeys
Returns a Record object containing the table name and the column names (comprising the primary keys).
SummaryInformation (Database Object)
Returns a SummaryInfo object that can be used to examine, update, and add properties to the summary information stream.
TablePersistent
Returns the persistence state of the table.

Requirements

Requirement Value
Version
Windows Installer 5.0 on Windows Server 2012, Windows 8, Windows Server 2008 R2 or Windows 7. Windows Installer 4.0 or Windows Installer 4.5 on Windows Server 2008 or Windows Vista. Windows Installer on Windows Server 2003 or Windows XP
DLL
Msi.dll
IID
IID_IDatabase is defined as 000C109D-0000-0000-C000-000000000046

See also

Windows Installer Scripting Examples