Database Class

Microsoft Deployment Tools

Deployment Tools Foundation Database Class
Accesses a Windows Installer database.
Declaration Syntax
C# Visual Basic Visual C++
public class Database : InstallerHandle
Public Class Database _
	Inherits InstallerHandle
public ref class Database : public InstallerHandle
Members
All Members Constructors Methods Properties



Icon Member Description
Database(String)
Opens an existing database in read-only mode.

Database(String, String)
Opens an existing database with another database as output.

Database(String, DatabaseOpenMode)
Opens an existing database or creates a new one.

Database(IntPtr, Boolean, String, DatabaseOpenMode)
Creates a new database from an MSI handle.

ApplyTransform(String)
Apply a transform to the database, suppressing any error conditions specified by the transform's summary information.

ApplyTransform(String, TransformErrors)
Apply a transform to the database, specifying error conditions to suppress.

Close()()()
Closes the handle. After closing a handle, further method calls may throw an InvalidHandleException.
(Inherited from InstallerHandle.)
CodePage
Gets or sets the code page of the Database.

Commit()()()
Finalizes the persistent form of the database. All persistent data is written to the writeable database, and no temporary columns or rows are written.

CountRows(String)
Gets the count of all rows in the table.

CountRows(String, String)
Gets the count of all rows in the table that satisfy a given condition.

CreateObjRef(Type)
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.
(Inherited from MarshalByRefObject.)
CreateRecord(Int32)
Creates a new record object with the requested number of fields.

CreateTransformSummaryInfo(Database, String, TransformErrors, TransformValidations)
Creates and populates the summary information stream of an existing transform file, and fills in the properties with the base and reference ProductCode and ProductVersion.

DeleteOnClose(String)
Schedules a file or directory for deletion after the database handle is closed.

Dispose(Boolean)
Closes the database handle. After closing a handle, further method calls may throw InvalidHandleException.
(Overrides InstallerHandle.Dispose(Boolean).)
Dispose()()()
Closes the handle. After closing a handle, further method calls may throw an InvalidHandleException.
(Inherited from InstallerHandle.)
Equals(Object)
Tests whether this handle object is equal to another handle object. Two handle objects are equal if their types are the same and their native integer handles are the same.
(Inherited from InstallerHandle.)
Execute(String, array<Object>[]()[])
Executes the query specified by a SQL string. The query may not be a SELECT statement.

Execute(String, Record)
Executes the query specified by a SQL string. The query may not be a SELECT statement.

ExecuteIntegerQuery(String, array<Object>[]()[])
Executes the specified SQL SELECT query and returns all results as integers.

ExecuteIntegerQuery(String, Record)
Executes the specified SQL SELECT query and returns all results as integers.

ExecuteQuery(String, array<Object>[]()[])
Executes the specified SQL SELECT query and returns all results.

ExecuteQuery(String, Record)
Executes the specified SQL SELECT query and returns all results.

ExecuteScalar(String, array<Object>[]()[])
Executes the specified SQL SELECT query and returns a single result.

ExecuteScalar(String, Record)
Executes the specified SQL SELECT query and returns a single result.

ExecuteStringQuery(String, array<Object>[]()[])
Executes the specified SQL SELECT query and returns all results as strings.

ExecuteStringQuery(String, Record)
Executes the specified SQL SELECT query and returns all results as strings.

Export(String, String)
Copies the structure and data from a specified table to a text archive file.

ExportAll(String)
Exports all database tables, streams, and summary information to archive files.

FilePath
Gets the file path the Database was originally opened from, or null if not known.

Finalize()()()
Allows an Object to attempt to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection.
(Inherited from Object.)
FromHandle(IntPtr, Boolean)
Creates a new Database object from an integer database handle.

GenerateTransform(Database, String)
Creates a transform that, when applied to the object database, results in the reference database.

GetHashCode()()()
Gets a hash value for the handle object.
(Inherited from InstallerHandle.)
GetLifetimeService()()()
Retrieves the current lifetime service object that controls the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
GetType()()()
Gets the Type of the current instance.
(Inherited from Object.)
Handle
Gets the native integer handle.
(Inherited from InstallerHandle.)
Import(String)
Imports a database table from a text archive file, dropping any existing table.

ImportAll(String)
Imports all database tables, streams, and summary information from archive files.

InitializeLifetimeService()()()
Obtains a lifetime service object to control the lifetime policy for this instance.
(Inherited from MarshalByRefObject.)
IsClosed
Checks if the handle is closed. When closed, method calls on the handle object may throw an InvalidHandleException.
(Inherited from InstallerHandle.)
IsColumnPersistent(String, String)
Checks whether a table contains a persistent column with a given name.

IsReadOnly
Gets a boolean value indicating whether this database was opened in read-only mode.

IsTablePersistent(String)
Checks whether a table exists and is persistent in the database.

IsTransformValid(String)
Checks whether a transform is valid for this Database, according to its validation data and flags.

IsTransformValid(SummaryInfo)
Checks whether a transform is valid for this Database, according to its SummaryInfo data.

MemberwiseClone(Boolean)
Creates a shallow copy of the current MarshalByRefObject object.
(Inherited from MarshalByRefObject.)
MemberwiseClone()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
Merge(Database, String)
Merges another database with this database.

Merge(Database)
Merges another database with this database.

OpenMode
Gets the open mode for the database.

OpenView(String, array<Object>[]()[])
Gets a View object representing the query specified by a SQL string.

SummaryInfo
Gets the SummaryInfo object for this database that can be used to examine and modify properties to the summary information stream.

Tables
Gets the collection of tables in the Database.

ToString()()()
Returns the file path of this database, or the handle value if a file path was not specified.
(Overrides Object.ToString()()().)
ViewTransform(String)
Apply a transform to the database, recording the changes in the "_TransformView" table.

Remarks

The Commit()()() method must be called before the Database is closed 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:

  1. Obtain a Database object using one of the Database constructors.
  2. Initiate a query using a SQL string by calling the OpenView(String, array<Object>[]()[]) method of the Database.
  3. Set query parameters in a Record and execute the database query by calling the Execute(Record) method of the View. This produces a result that can be fetched or updated.
  4. Call the Fetch()()() method of the View repeatedly to return Records.
  5. Update database rows of a Record object obtained by the Fetch method using one of the Modify(ViewModifyMode, Record) methods of the View.
  6. Release the query and any unfetched records by calling the Close()()() method of the View.
  7. Persist any database updates by calling the Commit method of the Database.

Inheritance Hierarchy
Object
MarshalByRefObject
  InstallerHandle
    Database
      QDatabase
      InstallPackage
      PatchPackage

Assembly: Microsoft.Deployment.WindowsInstaller (Module: Microsoft.Deployment.WindowsInstaller) Version: 3.0.0.0 (3.5.1623.0)