MsiDatabaseImport Function

Windows Installer

MsiDatabaseImport Function

The MsiDatabaseImport function imports an installer text archive file into an open database table.

Syntax

C++UINT MsiDatabaseImport(
  __in  MSIHANDLE hDatabase,
  __in  LPCTSTR szFolderPath,
  __in  LPCTSTR szFileName
);

Parameters

hDatabase [in]

Handle to the database obtained from MsiOpenDatabase.

szFolderPath [in]

Specifies the path to the folder that contains archive files.

szFileName [in]

Specifies the name of the file to import.

Return Value

The MsiDatabaseImport function returns one of the following values:

ERROR_BAD_PATHNAME

An invalid path was passed to the function.

ERROR_FUNCTION_FAILED

The function failed.

ERROR_INVALID_HANDLE

An invalid or inactive handle was supplied.

ERROR_INVALID_PARAMETER

An invalid parameter was passed to the function.

ERROR_SUCCESS

The function succeeded.

Remarks

When you use the MsiDatabaseImport function to import a text archive table named _SummaryInformation into an installer database, you write the "05SummaryInformation" stream. This stream contains standard properties that can be viewed using Windows Explorer and are defined by COM. The rows of the table are written to the property stream as pairs of property ID numbers and corresponding data values. See Summary Information Stream Property Set. Date and time in _SummaryInformation are in the format: YYYY/MM/DD hh::mm::ss. For example, 1999/03/22 15:25:45. If the table contains binary streams, the name of the stream is in the data field, and the actual stream is retrieved from a file of that name in a subfolder with the same name as the table.

Text archive files that are exported from a database by MsiDatabaseExport are intended for use with version control systems, and are not intended to be used as a means of editing data. Use the database API functions and tools designed for that purpose. Note that control characters in text archive files are translated to avoid conflicts with file delimiters. If a text archive file contains non-ASCII data, it is stamped with the code page of the data, and can only be imported into a database of that exact code page, or into a neutral database. Neutral databases are set to the code page of the imported file. A database can be unconditionally set to a particular code page by importing a pseudo table named: _ForceCodepage. The format of such a file is: Two blank lines, followed by a line that contains the numeric code page, a tab delimiter and the exact string: _ForceCodepage

This function cannot be called from custom actions. A call to this function from a custom action causes the function to fail.

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
Unicode and ANSI namesMsiDatabaseImportW (Unicode) and MsiDatabaseImportA (ANSI)

See Also

Database Management Functions
Text Archive Files

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.