MsiViewFetch Function

Windows Installer

MsiViewFetch Function

The MsiViewFetch function fetches the next sequential record from the view. This function returns a handle that should be closed using MsiCloseHandle.

Syntax

C++UINT MsiViewFetch(
  __in   MSIHANDLE hView,
  __out  MSIHANDLE *phRecord
);

Parameters

hView [in]

Handle to the view to fetch from.

phRecord [out]

Pointer to the handle for the fetched record.

Return Value

ERROR_FUNCTION_FAILED

An error occurred during fetching.

ERROR_INVALID_HANDLE

An invalid or inactive handle was supplied.

ERROR_INVALID_HANDLE_STATE

The handle was in an invalid state.

ERROR_NO_MORE_ITEMS

No records remain, and a null handle is returned.

ERROR_SUCCESS

The function succeeded, and a handle to the record is returned.

Note that in low memory situations, this function can raise a STATUS_NO_MEMORY exception.

Remarks

If the MsiViewFetch function returns ERROR_FUNCTION_FAILED, it is possible that the MsiViewExecute function was not called first. If more rows are available in the result set, MsiViewFetch returns phRecord as a handle to a record containing the requested column data, or phRecord is 0. For maximum performance, the same record should be used for all retrievals, or the record should be released by going out of scope.

Note that it is recommended to use variables of type PMSIHANDLE because the installer closes PMSIHANDLE objects as they go out of scope, whereas you must close MSIHANDLE objects by calling MsiCloseHandle. For more information see Use PMSIHANDLE instead of HANDLE section in the Windows Installer Best Practices.

Requirements

VersionWindows Installer 5.0 on 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, Windows XP, and Windows 2000
HeaderMsiquery.h
LibraryMsi.lib
DLLMsi.dll

See Also

General Database Access Functions
Working with Queries

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.