MsiDatabaseCommit Function

Windows Installer

MsiDatabaseCommit Function

The MsiDatabaseCommit function commits changes to a database.

Syntax

C++UINT MsiDatabaseCommit(
  __in  MSIHANDLE hDatabase
);

Parameters

hDatabase [in]

Handle to the database obtained from MsiOpenDatabase.

Return Value

The MsiDatabaseCommit function returns one of the following values:

ERROR_FUNCTION_FAILED

The function failed.

ERROR_INVALID_HANDLE

An invalid or inactive handle was supplied.

ERROR_INVALID_HANDLE_STATE

The handle is in an invalid state.

ERROR_SUCCESS

The function succeeded.

Remarks

The MsiDatabaseCommit function finalizes the persistent form of the database. All persistent data is then written to the writable database. No temporary columns or rows are written. The MsiDatabaseCommit function has no effect on a database that is opened as read-only. You can call this function multiple times to save the current state of tables loaded into memory. When the database is finally closed, any changes made after the database is committed are rolled back. This function is normally called prior to shutdown when all database changes have been finalized.

If the function fails, you can obtain extended error information by using MsiGetLastErrorRecord.

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

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.