Skip to content

Database Class

Accesses a Windows Installer database.

MethodDescription
ApplyTransform(transformFile)Apply a transform to the database, suppressing any error conditions specified by the transform’s summary information.
ApplyTransform(transformFile, errorConditionsToSuppress)Apply a transform to the database, specifying error conditions to suppress.
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(table)Gets the count of all rows in the table.
CountRows(table, where)Gets the count of all rows in the table that satisfy a given condition.
CreateRecord(fieldCount)Creates a new record object with the requested number of fields.
CreateTransformSummaryInfo(referenceDatabase, transformFile, errors, validations)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(path)Schedules a file or directory for deletion after the database handle is closed.
Dispose(disposing)Closes the database handle. After closing a handle, further method calls may throw «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .
Execute(sqlFormat, args)Executes the query specified by a SQL string. The query may not be a SELECT statement.
Execute(sql, record)Executes the query specified by a SQL string. The query may not be a SELECT statement.
ExecuteIntegerQuery(sqlFormat, args)Executes the specified SQL SELECT query and returns all results as integers.
ExecuteIntegerQuery(sql, record)Executes the specified SQL SELECT query and returns all results as integers.
ExecutePropertyQuery(property)Returns the value of the specified property.
ExecuteQuery(sqlFormat, args)Executes the specified SQL SELECT query and returns all results.
ExecuteQuery(sql, record)Executes the specified SQL SELECT query and returns all results.
ExecuteScalar(sqlFormat, args)Executes the specified SQL SELECT query and returns a single result.
ExecuteScalar(sql, record)Executes the specified SQL SELECT query and returns a single result.
ExecuteStringQuery(sqlFormat, args)Executes the specified SQL SELECT query and returns all results as strings.
ExecuteStringQuery(sql, record)Executes the specified SQL SELECT query and returns all results as strings.
Export(table, exportFilePath)Copies the structure and data from a specified table to a text archive file.
ExportAll(directoryPath)Exports all database tables, streams, and summary information to archive files.
FromHandle(handle, ownsHandle)Creates a new Database object from an integer database handle.
GenerateTransform(referenceDatabase, transformFile)Creates a transform that, when applied to the object database, results in the reference database.
Import(importFilePath)Imports a database table from a text archive file, dropping any existing table.
ImportAll(directoryPath)Imports all database tables, streams, and summary information from archive files.
IsColumnPersistent(table, column)Checks whether a table contains a persistent column with a given name.
IsTablePersistent(table)Checks whether a table exists and is persistent in the database.
IsTransformValid(transformFile)Checks whether a transform is valid for this Database, according to its validation data and flags.
IsTransformValid(transformSummaryInfo)Checks whether a transform is valid for this Database, according to its SummaryInfo data.
Merge(otherDatabase, errorTable)Merges another database with this database.
Merge(otherDatabase)Merges another database with this database.
OpenView(sqlFormat, args)Gets a View object representing the query specified by a SQL string.
ToString()Returns the file path of this database, or the handle value if a file path was not specified.
ViewTransform(transformFile)Apply a transform to the database, recording the changes in the “_TransformView” table.
PropertyDescription
CodePageGets or sets the code page of the Database.
FilePathGets the file path the Database was originally opened from, or null if not known.
IsReadOnlyGets a boolean value indicating whether this database was opened in read-only mode.
OpenModeGets the open mode for the database.
SummaryInfoGets the SummaryInfo object for this database that can be used to examine and modify properties to the summary information stream.
TablesGets the collection of tables in the Database.

The «see M:WixToolset.Dtf.WindowsInstaller.Database.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:

  • Obtain a Database object using one of the Database constructors.
  • Initiate a query using a SQL string by calling the «see M:WixToolset.Dtf.WindowsInstaller.Database.OpenView(System.String,System.Object[])» method of the Database.
  • Set query parameters in a «see T:WixToolset.Dtf.WindowsInstaller.Record» and execute the database query by calling the «see M:WixToolset.Dtf.WindowsInstaller.View.Execute(WixToolset.Dtf.WindowsInstaller.Record)» method of the «see T:WixToolset.Dtf.WindowsInstaller.View» . This produces a result that can be fetched or updated.
  • Call the «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» method of the View repeatedly to return Records.
  • Update database rows of a Record object obtained by the Fetch method using one of the «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» methods of the View.
  • Release the query and any unfetched records by calling the «see M:WixToolset.Dtf.WindowsInstaller.InstallerHandle.Close» method of the View.
  • Persist any database updates by calling the Commit method of the Database.

WixToolset.Dtf.WindowsInstaller.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8

Apply a transform to the database, suppressing any error conditions specified by the transform’s summary information.

public void ApplyTransform(
string transformFile
)
ParameterTypeDescription
transformFilestringPath to the transform file

Win32 MSI API: MsiDatabaseApplyTransform

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe transform could not be applied
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

ApplyTransform(transformFile, errorConditionsToSuppress) Method

Section titled “ApplyTransform(transformFile, errorConditionsToSuppress) Method”

Apply a transform to the database, specifying error conditions to suppress.

public void ApplyTransform(
string transformFile,
TransformErrors errorConditionsToSuppress
)
ParameterTypeDescription
transformFilestringPath to the transform file
errorConditionsToSuppressTransformErrorsError conditions that are to be suppressed

Win32 MSI API: MsiDatabaseApplyTransform

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe transform could not be applied
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

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

public void Commit()

For a database open in «see F:WixToolset.Dtf.WindowsInstaller.DatabaseOpenMode.ReadOnly» mode, this method has no effect. For a database open in «see F:WixToolset.Dtf.WindowsInstaller.DatabaseOpenMode.CreateDirect» or «see F:WixToolset.Dtf.WindowsInstaller.DatabaseOpenMode.Direct» mode, it is not necessary to call this method because the database will be automatically committed when it is closed. However this method may be called at any time to persist the current state of tables loaded into memory. For a database open in «see F:WixToolset.Dtf.WindowsInstaller.DatabaseOpenMode.Create» or «see F:WixToolset.Dtf.WindowsInstaller.DatabaseOpenMode.Transact» mode, no changes will be persisted until this method is called. If the database object is closed without calling this method, the database file remains unmodified. Win32 MSI API: MsiDatabaseCommit

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Gets the count of all rows in the table.

public int CountRows(
string table
)
ParameterTypeDescription
tablestringName of the table whose rows are to be counted

int The count of all rows in the table

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Gets the count of all rows in the table that satisfy a given condition.

public int CountRows(
string table,
string where
)
ParameterTypeDescription
tablestringName of the table whose rows are to be counted
wherestringConditional expression, such as could be placed on the end of a SQL WHERE clause

int The count of all rows in the table satisfying the condition

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL WHERE syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Creates a new record object with the requested number of fields.

public Record CreateRecord(
int fieldCount
)
ParameterTypeDescription
fieldCountintRequired number of fields, which may be 0. The maximum number of fields in a record is limited to 65535.

Record A new record object that can be used with the database.

This method is equivalent to directly calling the «see T:WixToolset.Dtf.WindowsInstaller.Record» constructor in all cases outside of a custom action context. When in a custom action session, this method allows creation of a record that can work with a database other than the session database. The Record object should be «see M:WixToolset.Dtf.WindowsInstaller.InstallerHandle.Close» d after use. It is best that the handle be closed manually as soon as it is no longer needed, as leaving lots of unused handles open can degrade performance. Win32 MSI API: MsiCreateRecord

CreateTransformSummaryInfo(referenceDatabase, transformFile, errors, validations) Method

Section titled “CreateTransformSummaryInfo(referenceDatabase, transformFile, errors, validations) Method”

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.

public void CreateTransformSummaryInfo(
Database referenceDatabase,
string transformFile,
TransformErrors errors,
TransformValidations validations
)
ParameterTypeDescription
referenceDatabaseDatabaseDatabase that does not include the changes
transformFilestringName of the generated transform file
errorsTransformErrorsError conditions that should be suppressed when the transform is applied
validationsTransformValidationsDefines which properties should be validated to verify that this transform can be applied to a database.

Win32 MSI API: MsiCreateTransformSummaryInfo

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe transform summary info could not be
generated |

| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | a Database handle is invalid |

Schedules a file or directory for deletion after the database handle is closed.

public void DeleteOnClose(
string path
)
ParameterTypeDescription
pathstringFile or directory path to be deleted. All files and subdirectories under a directory are deleted.

Once an item is scheduled, it cannot be unscheduled. The items cannot be deleted if the Database object is auto-disposed by the garbage collector; the handle must be explicitly closed. Files which are read-only or otherwise locked cannot be deleted, but they will not cause an exception to be thrown.

Closes the database handle. After closing a handle, further method calls may throw «see T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException» .

protected void Dispose(
bool disposing
)
ParameterTypeDescription
disposingboolIf true, the method has been called directly or indirectly by a user’s code, so managed and unmanaged resources will be disposed. If false, only unmanaged resources will be disposed.

Executes the query specified by a SQL string. The query may not be a SELECT statement.

public void Execute(
string sqlFormat,
System.Object[] args
)
ParameterTypeDescription
sqlFormatstringSQL query string, which may contain format items
argsSystem.Object[]Zero or more objects to format

The sqlFormat parameter is formatted using «see M:System.String.Format(System.String,System.Object[])» . Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Executes the query specified by a SQL string. The query may not be a SELECT statement.

public void Execute(
string sql,
Record record
)
ParameterTypeDescription
sqlstringSQL query string
recordRecordOptional Record object containing the values that replace the parameter tokens (?) in the SQL query.

Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

ExecuteIntegerQuery(sqlFormat, args) Method

Section titled “ExecuteIntegerQuery(sqlFormat, args) Method”

Executes the specified SQL SELECT query and returns all results as integers.

public IList<System.Int32> ExecuteIntegerQuery(
string sqlFormat,
System.Object[] args
)
ParameterTypeDescription
sqlFormatstringSQL query string, which may contain format items
argsSystem.Object[]Zero or more objects to format

IList<System.Int32> All results combined into an array

The sqlFormat parameter is formatted using «see M:System.String.Format(System.String,System.Object[])» . Multiple rows columns will be collapsed into a single one-dimensional list. Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute , MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Executes the specified SQL SELECT query and returns all results as integers.

public IList<System.Int32> ExecuteIntegerQuery(
string sql,
Record record
)
ParameterTypeDescription
sqlstringSQL SELECT query string
recordRecordOptional Record object containing the values that replace the parameter tokens (?) in the SQL query.

IList<System.Int32> All results combined into an array

Multiple rows columns will be collapsed into a single one-dimensional list. Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute , MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Returns the value of the specified property.

public string ExecutePropertyQuery(
string property
)
ParameterTypeDescription
propertystringName of the property to retrieve.

Executes the specified SQL SELECT query and returns all results.

public System.Collections.IList ExecuteQuery(
string sqlFormat,
System.Object[] args
)
ParameterTypeDescription
sqlFormatstringSQL query string, which may contain format items
argsSystem.Object[]Zero or more objects to format

System.Collections.IList All results combined into an array

The sqlFormat parameter is formatted using «see M:System.String.Format(System.String,System.Object[])» . Multiple rows columns will be collapsed into a single one-dimensional list. Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute , MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Executes the specified SQL SELECT query and returns all results.

public System.Collections.IList ExecuteQuery(
string sql,
Record record
)
ParameterTypeDescription
sqlstringSQL SELECT query string
recordRecordOptional Record object containing the values that replace the parameter tokens (?) in the SQL query.

System.Collections.IList All results combined into an array

Multiple rows columns will be collapsed into a single one-dimensional list. Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute , MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Executes the specified SQL SELECT query and returns a single result.

public System.Object ExecuteScalar(
string sqlFormat,
System.Object[] args
)
ParameterTypeDescription
sqlFormatstringSQL query string, which may contain format items
argsSystem.Object[]Zero or more objects to format

System.Object First field of the first result

The sqlFormat parameter is formatted using «see M:System.String.Format(System.String,System.Object[])» . Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute , MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
or the query returned 0 results |

| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the Database handle is invalid |

Executes the specified SQL SELECT query and returns a single result.

public System.Object ExecuteScalar(
string sql,
Record record
)
ParameterTypeDescription
sqlstringSQL SELECT query string
recordRecordOptional Record object containing the values that replace the parameter tokens (?) in the SQL query.

System.Object First field of the first result

Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute , MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
or the query returned 0 results |

| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the Database handle is invalid |

ExecuteStringQuery(sqlFormat, args) Method

Section titled “ExecuteStringQuery(sqlFormat, args) Method”

Executes the specified SQL SELECT query and returns all results as strings.

public IList<System.String> ExecuteStringQuery(
string sqlFormat,
System.Object[] args
)
ParameterTypeDescription
sqlFormatstringSQL query string, which may contain format items
argsSystem.Object[]Zero or more objects to format

IList<System.String> All results combined into an array

The sqlFormat parameter is formatted using «see M:System.String.Format(System.String,System.Object[])» . Multiple rows columns will be collapsed into a single on-dimensional list. Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute , MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Executes the specified SQL SELECT query and returns all results as strings.

public IList<System.String> ExecuteStringQuery(
string sql,
Record record
)
ParameterTypeDescription
sqlstringSQL SELECT query string
recordRecordOptional Record object containing the values that replace the parameter tokens (?) in the SQL query.

IList<System.String> All results combined into an array

Multiple rows columns will be collapsed into a single on-dimensional list. Win32 MSI APIs: MsiDatabaseOpenView , MsiViewExecute , MsiViewFetch

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Copies the structure and data from a specified table to a text archive file.

public void Export(
string table,
string exportFilePath
)
ParameterTypeDescription
tablestringName of the table to be exported
exportFilePathstringPath to the file to be created

Win32 MSI API: MsiDatabaseExport

ExceptionDescription
T:System.IO.FileNotFoundExceptionthe file path is invalid
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Exports all database tables, streams, and summary information to archive files.

public void ExportAll(
string directoryPath
)
ParameterTypeDescription
directoryPathstringPath to the directory where archive files will be created

The directory will be created if it does not already exist. Win32 MSI API: MsiDatabaseExport

ExceptionDescription
T:System.IO.FileNotFoundExceptionthe directory path is invalid
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Creates a new Database object from an integer database handle.

public static Database FromHandle(
IntPtr handle,
bool ownsHandle
)
ParameterTypeDescription
handleIntPtrInteger database handle
ownsHandlebooltrue to close the handle when this object is disposed

This method is only provided for interop purposes. A Database object should normally be obtained from «see P:WixToolset.Dtf.WindowsInstaller.Session.Database» or a public Database constructor.

GenerateTransform(referenceDatabase, transformFile) Method

Section titled “GenerateTransform(referenceDatabase, transformFile) Method”

Creates a transform that, when applied to the object database, results in the reference database.

public bool GenerateTransform(
Database referenceDatabase,
string transformFile
)
ParameterTypeDescription
referenceDatabaseDatabaseDatabase that does not include the changes
transformFilestringName of the generated transform file, or null to only check whether or not the two database are identical

bool true if a transform is generated, or false if a transform is not generated because there are no differences between the two databases.

A transform can add non-primary key columns to the end of a table. A transform cannot be created that adds primary key columns to a table. A transform cannot be created that changes the order, names, or definitions of columns. If the transform is to be applied during an installation you must use the «see M:WixToolset.Dtf.WindowsInstaller.Database.CreateTransformSummaryInfo(WixToolset.Dtf.WindowsInstaller.Database,System.String,WixToolset.Dtf.WindowsInstaller.TransformErrors,WixToolset.Dtf.WindowsInstaller.TransformValidations)» method to populate the summary information stream. Win32 MSI API: MsiDatabaseGenerateTransform

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe transform could not be generated
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptiona Database handle is invalid

Imports a database table from a text archive file, dropping any existing table.

public void Import(
string importFilePath
)
ParameterTypeDescription
importFilePathstringPath to the file to be imported. The table name is specified within the file.

Win32 MSI API: MsiDatabaseImport

ExceptionDescription
T:System.IO.FileNotFoundExceptionthe file path is invalid
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Imports all database tables, streams, and summary information from archive files.

public void ImportAll(
string directoryPath
)
ParameterTypeDescription
directoryPathstringPath to the directory from which archive files will be imported

Win32 MSI API: MsiDatabaseImport

ExceptionDescription
T:System.IO.FileNotFoundExceptionthe directory path is invalid
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Checks whether a table contains a persistent column with a given name.

public bool IsColumnPersistent(
string table,
string column
)
ParameterTypeDescription
tablestringThe table to the checked
columnstringThe name of the column to be checked

bool true if the column exists in the table; false if the column is temporary or does not exist.

To check whether a column exists regardless of persistence, use «see M:WixToolset.Dtf.WindowsInstaller.ColumnCollection.Contains(System.String)» .

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe View could not be executed
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Checks whether a table exists and is persistent in the database.

public bool IsTablePersistent(
string table
)
ParameterTypeDescription
tablestringThe table to the checked

bool true if the table exists and is persistent in the database; false otherwise

To check whether a table exists regardless of persistence, use «see M:WixToolset.Dtf.WindowsInstaller.TableCollection.Contains(System.String)» . Win32 MSI API: MsiDatabaseIsTablePersistent

ExceptionDescription
T:System.ArgumentExceptionthe table is unknown
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

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

public bool IsTransformValid(
string transformFile
)
ParameterTypeDescription
transformFilestringPath to the transform file

bool true if the transform can be validly applied to this Database; false otherwise

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe transform could not be applied
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

IsTransformValid(transformSummaryInfo) Method

Section titled “IsTransformValid(transformSummaryInfo) Method”

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

public bool IsTransformValid(
SummaryInfo transformSummaryInfo
)
ParameterTypeDescription
transformSummaryInfoSummaryInfoSummaryInfo data of a transform file

bool true if the transform can be validly applied to this Database; false otherwise

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionerror processing summary info
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database or SummaryInfo handle is invalid

Merges another database with this database.

public void Merge(
Database otherDatabase,
string errorTable
)
ParameterTypeDescription
otherDatabaseDatabaseThe database to be merged into this database
errorTablestringOptional name of table to contain the names of the tables containing merge conflicts, the number of conflicting rows within the table, and a reference to the table with the merge conflict.

Merge does not copy over embedded cabinet files or embedded transforms from the reference database into the target database. Embedded data streams that are listed in the Binary table or Icon table are copied from the reference database to the target database. Storage embedded in the reference database are not copied to the target database. The Merge method merges the data of two databases. These databases must have the same codepage. The merge fails if any tables or rows in the databases conflict. A conflict exists if the data in any row in the first database differs from the data in the corresponding row of the second database. Corresponding rows are in the same table of both databases and have the same primary key in both databases. The tables of non-conflicting databases must have the same number of primary keys, same number of columns, same column types, same column names, and the same data in rows with identical primary keys. Temporary columns however don’t matter in the column count and corresponding tables can have a different number of temporary columns without creating conflict as long as the persistent columns match. If the number, type, or name of columns in corresponding tables are different, the schema of the two databases are incompatible and the installer will stop processing tables and the merge fails. The installer checks that the two databases have the same schema before checking for row merge conflicts. If the schemas are incompatible, the databases have be modified. If the data in particular rows differ, this is a row merge conflict, the merge fails and creates a new table with the specified name. The first column of this table is the name of the table having the conflict. The second column gives the number of rows in the table having the conflict. Win32 MSI API: MsiDatabaseMerge

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.MergeExceptionmerge failed due to a schema difference or data conflict
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Merges another database with this database.

public void Merge(
Database otherDatabase
)
ParameterTypeDescription
otherDatabaseDatabaseThe database to be merged into this database

MsiDatabaseMerge does not copy over embedded cabinet files or embedded transforms from the reference database into the target database. Embedded data streams that are listed in the Binary table or Icon table are copied from the reference database to the target database. Storage embedded in the reference database are not copied to the target database. The Merge method merges the data of two databases. These databases must have the same codepage. The merge fails if any tables or rows in the databases conflict. A conflict exists if the data in any row in the first database differs from the data in the corresponding row of the second database. Corresponding rows are in the same table of both databases and have the same primary key in both databases. The tables of non-conflicting databases must have the same number of primary keys, same number of columns, same column types, same column names, and the same data in rows with identical primary keys. Temporary columns however don’t matter in the column count and corresponding tables can have a different number of temporary columns without creating conflict as long as the persistent columns match. If the number, type, or name of columns in corresponding tables are different, the schema of the two databases are incompatible and the installer will stop processing tables and the merge fails. The installer checks that the two databases have the same schema before checking for row merge conflicts. If the schemas are incompatible, the databases have be modified. Win32 MSI API: MsiDatabaseMerge

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.MergeExceptionmerge failed due to a schema difference or data conflict
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Gets a View object representing the query specified by a SQL string.

public View OpenView(
string sqlFormat,
System.Object[] args
)
ParameterTypeDescription
sqlFormatstringSQL query string, which may contain format items
argsSystem.Object[]Zero or more objects to format

View A View object representing the query specified by a SQL string

The sqlFormat parameter is formatted using «see M:System.String.Format(System.String,System.Object[])» . The View object should be «see M:WixToolset.Dtf.WindowsInstaller.InstallerHandle.Close» d after use. It is best that the handle be closed manually as soon as it is no longer needed, as leaving lots of unused handles open can degrade performance. Win32 MSI API: MsiDatabaseOpenView

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.BadQuerySyntaxExceptionthe SQL syntax is invalid
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Returns the file path of this database, or the handle value if a file path was not specified.

public string ToString()

Apply a transform to the database, recording the changes in the “_TransformView” table.

public void ViewTransform(
string transformFile
)
ParameterTypeDescription
transformFilestringPath to the transform file

Win32 MSI API: MsiDatabaseApplyTransform

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InstallerExceptionthe transform could not be applied
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Gets or sets the code page of the Database.

public int CodePage { get; set; }

Getting or setting the code page is a slow operation because it involves an export or import of the codepage data to/from a temporary file.

ExceptionDescription
T:System.IO.IOExceptionerror exporting/importing the codepage data
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

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

public string FilePath { get; set; }

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

public bool IsReadOnly { get; set; }

Win32 MSI API: MsiGetDatabaseState

Gets the open mode for the database.

public DatabaseOpenMode OpenMode { get; set; }

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

public SummaryInfo SummaryInfo { get; set; }

The object returned from this property does not need to be explicitly persisted or closed. Any modifications will be automatically saved when the database is committed. Win32 MSI API: MsiGetSummaryInformation

ExceptionDescription
T:WixToolset.Dtf.WindowsInstaller.InvalidHandleExceptionthe Database handle is invalid

Gets the collection of tables in the Database.

public TableCollection Tables { get; set; }