View Class
A View represents a result set obtained when processing a query using the «see M:WixToolset.Dtf.WindowsInstaller.Database.OpenView(System.String,System.Object[])» method of a «see P:WixToolset.Dtf.WindowsInstaller.View.Database» . Before any data can be transferred, the query must be executed using the «see M:WixToolset.Dtf.WindowsInstaller.View.Execute(WixToolset.Dtf.WindowsInstaller.Record)» method, passing to it all replaceable parameters designated within the SQL query string.
Methods
Section titled “Methods”| Method | Description |
|---|---|
| Assign(record) | Updates or inserts a Record into the View. |
| Delete(record) | Deletes a Record from the View. |
| Execute(executeParams) | Executes a SQL View query and supplies any required parameters. The query uses the question mark token to represent parameters as described in SQL Syntax. The values of these parameters are passed in as the corresponding fields of a parameter record. |
| Execute() | Executes a SQL View query. |
| Fetch() | Fetches the next sequential record from the view, or null if there are no more records. |
| GetEnumerator() | Enumerates over the Records retrieved by the View. |
| Insert(record) | Inserts a Record into the view. |
| InsertTemporary(record) | Inserts a Record into the View. The inserted data is not persistent. |
| Merge(record) | Inserts or validates a record. |
| Modify(mode, record) | Updates a fetched Record. |
| Refresh(record) | Refreshes the data in a Record. |
| Replace(record) | Updates or deletes and inserts a Record into the View. |
| Seek(record) | Refreshes the information in the supplied record without changing the position in the result set and without affecting subsequent fetch operations. |
| Update(record) | Updates the View with new data from the Record. |
| Validate(record) | Validates a record, returning information about any errors. |
| ValidateDelete(record) | Validates a record that will be deleted later, returning information about any errors. |
| ValidateFields(record) | Validates fields of a fetched or new record, returning information about any errors. Can validate one or more fields of an incomplete record. |
| ValidateNew(record) | Validates a new record, returning information about any errors. |
Properties
Section titled “Properties”| Property | Description |
|---|---|
| Columns | Gets the set of columns that were included in the query for this View, or null if this view is not a SELECT query. |
| Database | Gets the Database on which this View was opened. |
| QueryString | Gets the SQL query string used to open this View. |
| Tables | Gets the set of tables that were included in the SQL query for this View. |
WixToolset.Dtf.WindowsInstaller.dll version 5.0.0+41e11442b2ca93e444b60213b5ae99dcbab787d8 |
Assign(record) Method
Section titled “Assign(record) Method”Updates or inserts a Record into the View.
Declaration
Section titled “Declaration”public void Assign( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be assigned |
Remarks
Section titled “Remarks”Updates record if the primary keys match an existing row and inserts if they do not match. Fails with a read-only database. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the assignment failed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Delete(record) Method
Section titled “Delete(record) Method”Deletes a Record from the View.
Declaration
Section titled “Declaration”public void Delete( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be deleted |
Remarks
Section titled “Remarks”The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Fails if the row has been deleted. Works only with read-write records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the deletion failed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Execute(executeParams) Method
Section titled “Execute(executeParams) Method”Executes a SQL View query and supplies any required parameters. The query uses the question mark token to represent parameters as described in SQL Syntax. The values of these parameters are passed in as the corresponding fields of a parameter record.
Declaration
Section titled “Declaration”public void Execute( Record executeParams)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| executeParams | Record | Optional Record that supplies the parameters. This Record contains values to replace the parameter tokens in the SQL query. |
Remarks
Section titled “Remarks”Win32 MSI API: MsiViewExecute
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the View could not be executed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Execute() Method
Section titled “Execute() Method”Executes a SQL View query.
Declaration
Section titled “Declaration”public void Execute()Remarks
Section titled “Remarks”Win32 MSI API: MsiViewExecute
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the View could not be executed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Fetch() Method
Section titled “Fetch() Method”Fetches the next sequential record from the view, or null if there are no more records.
Declaration
Section titled “Declaration”public Record Fetch()Remarks
Section titled “Remarks”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: MsiViewFetch
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the View is not in an active state |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
GetEnumerator() Method
Section titled “GetEnumerator() Method”Enumerates over the Records retrieved by the View.
Declaration
Section titled “Declaration”public IEnumerator<WixToolset.Dtf.WindowsInstaller.Record> GetEnumerator()Return value
Section titled “Return value”IEnumerator<WixToolset.Dtf.WindowsInstaller.Record> An enumerator of Record objects.
Remarks
Section titled “Remarks”Each 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. However, note that it is not necessary to complete the enumeration just for the purpose of closing handles, because Records are fetched lazily on each step of the enumeration. Win32 MSI API: MsiViewFetch
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | The View was not d before attempting the enumeration. |
Insert(record) Method
Section titled “Insert(record) Method”Inserts a Record into the view.
Declaration
Section titled “Declaration”public void Insert( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be inserted |
Remarks
Section titled “Remarks”Fails if a row with the same primary keys exists. Fails with a read-only database. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the insertion failed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
InsertTemporary(record) Method
Section titled “InsertTemporary(record) Method”Inserts a Record into the View. The inserted data is not persistent.
Declaration
Section titled “Declaration”public void InsertTemporary( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be inserted |
Remarks
Section titled “Remarks”Fails if a row with the same primary key exists. Works only with read-write records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the insertion failed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Merge(record) Method
Section titled “Merge(record) Method”Inserts or validates a record.
Declaration
Section titled “Declaration”public bool Merge( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be merged |
Return value
Section titled “Return value”bool true if the record was inserted or validated, false if there is an existing record with the same primary keys that is not identical
Remarks
Section titled “Remarks”Works only with read-write records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the merge failed (for a reason other than invalid data) |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Modify(mode, record) Method
Section titled “Modify(mode, record) Method”Updates a fetched Record.
Declaration
Section titled “Declaration”public void Modify( ViewModifyMode mode, Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| mode | ViewModifyMode | specifies the modify mode |
| record | Record | the Record to modify |
Remarks
Section titled “Remarks”You can update or delete a record immediately after inserting, or seeking provided you have NOT modified the 0th field of the inserted or sought record. To execute any SQL statement, a View must be created. However, a View that does not create a result set, such as CREATE TABLE, or INSERT INTO, cannot be used with any of the Modify methods to update tables though the view. You cannot fetch a record containing binary data from one database and then use that record to insert the data into another database. To move binary data from one database to another, you should export the data to a file and then import it into the new database using a query and the «see M:WixToolset.Dtf.WindowsInstaller.Record.SetStream(System.Int32,System.String)» . This ensures that each database has its own copy of the binary data. Note that custom actions can only add, modify, or remove temporary rows, columns, or tables from a database. Custom actions cannot modify persistent data in a database, such as data that is a part of the database stored on disk. Win32 MSI API: MsiViewModify
See also
Section titled “See also”- M:WixToolset.Dtf.WindowsInstaller.View.Refresh(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.Insert(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.Update(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.Assign(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.Replace(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.Delete(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.InsertTemporary(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.Seek(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.Merge(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.Validate(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.ValidateNew(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.ValidateFields(WixToolset.Dtf.WindowsInstaller.Record)
- M:WixToolset.Dtf.WindowsInstaller.View.ValidateDelete(WixToolset.Dtf.WindowsInstaller.Record)
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the modification failed, |
or a validation was requested and the data did not pass || T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Refresh(record) Method
Section titled “Refresh(record) Method”Refreshes the data in a Record.
Declaration
Section titled “Declaration”public void Refresh( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be refreshed |
Remarks
Section titled “Remarks”The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Fails with a deleted Record. Works only with read-write Records. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the refresh failed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Replace(record) Method
Section titled “Replace(record) Method”Updates or deletes and inserts a Record into the View.
Declaration
Section titled “Declaration”public void Replace( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be replaced |
Remarks
Section titled “Remarks”The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Updates record if the primary keys are unchanged. Deletes old row and inserts new if primary keys have changed. Fails with a read-only database. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the replacement failed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Seek(record) Method
Section titled “Seek(record) Method”Refreshes the information in the supplied record without changing the position in the result set and without affecting subsequent fetch operations.
Declaration
Section titled “Declaration”public bool Seek( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be filled with the result of the seek |
Remarks
Section titled “Remarks”After seeking, the Record may then be used for subsequent Update, Delete, and Refresh operations. All primary key columns of the table must be in the query and the Record must have at least as many fields as the query. Seek cannot be used with multi-table queries. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the seek failed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Update(record) Method
Section titled “Update(record) Method”Updates the View with new data from the Record.
Declaration
Section titled “Declaration”public void Update( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the new data |
Remarks
Section titled “Remarks”Only non-primary keys can be updated. The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Fails with a deleted Record. Works only with read-write Records. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI API: MsiViewModify
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the update failed |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Validate(record) Method
Section titled “Validate(record) Method”Validates a record, returning information about any errors.
Declaration
Section titled “Declaration”public System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> Validate( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be validated |
Return value
Section titled “Return value”System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> null if the record was validated; if there is an existing record with the same primary keys that has conflicting data then error information is returned
Remarks
Section titled “Remarks”The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Works with read-write and read-only records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI APIs: MsiViewModify , MsiViewGetError
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the validation failed (for a reason other than invalid data) |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
ValidateDelete(record) Method
Section titled “ValidateDelete(record) Method”Validates a record that will be deleted later, returning information about any errors.
Declaration
Section titled “Declaration”public System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> ValidateDelete( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be validated |
Return value
Section titled “Return value”System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> null if the record is safe to delete; if another row refers to the primary keys of this row then error information is returned
Remarks
Section titled “Remarks”Validation does not check for the existence of the primary keys of this row in properties or strings. Does not check if a column is a foreign key to multiple tables. Works with read-write and read-only records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI APIs: MsiViewModify , MsiViewGetError
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the validation failed (for a reason other than invalid data) |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
ValidateFields(record) Method
Section titled “ValidateFields(record) Method”Validates fields of a fetched or new record, returning information about any errors. Can validate one or more fields of an incomplete record.
Declaration
Section titled “Declaration”public System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> ValidateFields( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be validated |
Return value
Section titled “Return value”System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> null if the record was validated; if there is an existing record with the same primary keys that has conflicting data then error information is returned
Remarks
Section titled “Remarks”Works with read-write and read-only records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI APIs: MsiViewModify , MsiViewGetError
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the validation failed (for a reason other than invalid data) |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
ValidateNew(record) Method
Section titled “ValidateNew(record) Method”Validates a new record, returning information about any errors.
Declaration
Section titled “Declaration”public System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> ValidateNew( Record record)Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
| record | Record | the Record to be validated |
Return value
Section titled “Return value”System.Collections.Generic.ICollection<WixToolset.Dtf.WindowsInstaller.ValidationErrorInfo> null if the record was validated; if there is an existing record with the same primary keys then error information is returned
Remarks
Section titled “Remarks”Checks for duplicate keys. The Record must have been obtained by calling «see M:WixToolset.Dtf.WindowsInstaller.View.Fetch» . Works with read-write and read-only records. This method cannot be used with a View containing joins. See «see M:WixToolset.Dtf.WindowsInstaller.View.Modify(WixToolset.Dtf.WindowsInstaller.ViewModifyMode,WixToolset.Dtf.WindowsInstaller.Record)» for more remarks. Win32 MSI APIs: MsiViewModify , MsiViewGetError
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the validation failed (for a reason other than invalid data) |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Columns Property
Section titled “Columns Property”Gets the set of columns that were included in the query for this View, or null if this view is not a SELECT query.
Declaration
Section titled “Declaration”public ColumnCollection Columns { get; set; }Remarks
Section titled “Remarks”Win32 MSI API: MsiViewGetColumnInfo
Exceptions
Section titled “Exceptions”| Exception | Description |
|---|---|
| T:WixToolset.Dtf.WindowsInstaller.InstallerException | the View is not in an active state |
| T:WixToolset.Dtf.WindowsInstaller.InvalidHandleException | the View handle is invalid |
Database Property
Section titled “Database Property”Gets the Database on which this View was opened.
Declaration
Section titled “Declaration”public Database Database { get; set; }QueryString Property
Section titled “QueryString Property”Gets the SQL query string used to open this View.
Declaration
Section titled “Declaration”public string QueryString { get; set; }Tables Property
Section titled “Tables Property”Gets the set of tables that were included in the SQL query for this View.
Declaration
Section titled “Declaration”public IList<WixToolset.Dtf.WindowsInstaller.TableInfo> Tables { get; set; }