Commit e1c2e882 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msi: Clean up the database queries.

parent d1b20585
......@@ -135,8 +135,12 @@ static UINT alter_add_column(MSIALTERVIEW *av)
{
r = MSI_IterateRecords(view, NULL, ITERATE_columns, &colnum);
msiobj_release(&view->hdr);
if (r != ERROR_SUCCESS)
{
columns->ops->delete(columns);
return r;
}
}
r = columns->ops->add_column(columns, av->colinfo->table,
colnum, av->colinfo->column,
av->colinfo->type, (av->hold == 1));
......
......@@ -1072,10 +1072,9 @@ static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
UINT ACTION_AppSearch(MSIPACKAGE *package)
{
static const WCHAR query[] = {
's','e','l','e','c','t',' ','*',' ',
'f','r','o','m',' ',
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'A','p','p','S','e','a','r','c','h',0};
MSIQUERY *view = NULL;
MSIQUERY *view;
UINT r;
if (msi_action_is_unique(package, szAppSearch))
......@@ -1092,7 +1091,6 @@ UINT ACTION_AppSearch(MSIPACKAGE *package)
r = MSI_IterateRecords( view, NULL, iterate_appsearch, package );
msiobj_release( &view->hdr );
return r;
}
......@@ -1127,10 +1125,9 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
UINT ACTION_CCPSearch(MSIPACKAGE *package)
{
static const WCHAR query[] = {
's','e','l','e','c','t',' ','*',' ',
'f','r','o','m',' ',
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'C','C','P','S','e','a','r','c','h',0};
MSIQUERY *view = NULL;
MSIQUERY *view;
UINT r;
if (msi_action_is_unique(package, szCCPSearch))
......@@ -1147,6 +1144,5 @@ UINT ACTION_CCPSearch(MSIPACKAGE *package)
r = MSI_IterateRecords(view, NULL, ITERATE_CCPSearch, package);
msiobj_release(&view->hdr);
return r;
}
......@@ -1186,18 +1186,16 @@ static UINT HANDLE_CustomType53_54(MSIPACKAGE *package, LPCWSTR source,
UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL execute)
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','C','u','s','t','o','m','A','c','t','i','o','n','`',' ','W','H','E','R','E',' ',
'`','A','c','t','i' ,'o','n','`',' ','=',' ','\'','%','s','\'',0};
UINT rc = ERROR_SUCCESS;
MSIRECORD * row = 0;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','C','u','s','t','o' ,'m','A','c','t','i','o','n','`',
' ','W','H','E','R','E',' ','`','A','c','t','i' ,'o','n','`',' ',
'=',' ','\'','%','s','\'',0};
MSIRECORD *row;
UINT type;
LPCWSTR source, target;
LPWSTR ptr, deferred_data = NULL;
LPWSTR action_copy = strdupW(action);
WCHAR *deformated=NULL;
LPWSTR deformated = NULL, action_copy = strdupW(action);
/* deferred action: [properties]Action */
if ((ptr = strrchrW(action_copy, ']')))
......@@ -1206,7 +1204,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
action = ptr + 1;
}
row = MSI_QueryGetRecord( package->db, ExecSeqQuery, action );
row = MSI_QueryGetRecord( package->db, query, action );
if (!row)
{
msi_free(action_copy);
......
......@@ -1877,12 +1877,12 @@ done:
static UINT gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge,
struct list *tabledata)
{
UINT r;
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','_','T','a','b','l','e','s','`',0};
MSIQUERY *view;
MERGEDATA data;
static const WCHAR query[] = {'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ','`','_','T','a','b','l','e','s','`',0};
UINT r;
r = MSI_DatabaseOpenViewW(merge, query, &view);
if (r != ERROR_SUCCESS)
......@@ -1892,7 +1892,6 @@ static UINT gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge,
data.merge = merge;
data.tabledata = tabledata;
r = MSI_IterateRecords(view, NULL, merge_diff_tables, &data);
msiobj_release(&view->hdr);
return r;
}
......
......@@ -369,11 +369,10 @@ static UINT msi_dialog_set_font( msi_dialog *dialog, HWND hwnd, LPCWSTR name )
static UINT msi_dialog_build_font_list( msi_dialog *dialog )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ','`','T','e','x','t','S','t','y','l','e','`',' ',0
};
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','T','e','x','t','S','t','y','l','e','`',0};
MSIQUERY *view;
UINT r;
MSIQUERY *view = NULL;
TRACE("dialog %p\n", dialog );
......@@ -938,12 +937,12 @@ static UINT msi_dialog_control_event( MSIRECORD *rec, LPVOID param )
static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'C','o','n','t','r','o','l','E','v','e','n','t',' ','W','H','E','R','E',' ',
'`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ','A','N','D',' ',
'`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',' ',
'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','i','n','g','`',0};
MSIQUERY *view = NULL;
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'C','o','n','t','r','o','l','E','v','e','n','t',' ','W','H','E','R','E',' ',
'`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ','A','N','D',' ',
'`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',' ',
'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','i','n','g','`',0};
MSIQUERY *view;
UINT r;
if (HIWORD(param) != BN_CLICKED)
......@@ -953,9 +952,8 @@ static UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control,
if (r != ERROR_SUCCESS)
{
ERR("query failed\n");
return 0;
return ERROR_SUCCESS;
}
r = MSI_IterateRecords( view, 0, msi_dialog_control_event, dialog );
msiobj_release( &view->hdr );
return r;
......@@ -1472,17 +1470,14 @@ static UINT msi_combobox_add_item( MSIRECORD *rec, LPVOID param )
static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR property )
{
UINT r;
MSIQUERY *view = NULL;
DWORD count;
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ','`','C','o','m','b','o','B','o','x','`',' ',
'W','H','E','R','E',' ',
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','C','o','m','b','o','B','o','x','`',' ','W','H','E','R','E',' ',
'`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ',
'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0
};
'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0};
MSIQUERY *view;
DWORD count;
UINT r;
r = MSI_OpenQuery( info->dialog->package->db, &view, query, property );
if (r != ERROR_SUCCESS)
......@@ -1545,11 +1540,11 @@ static UINT msi_dialog_set_control_condition( MSIRECORD *rec, LPVOID param )
static UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'C','o','n','t','r','o','l','C','o','n','d','i','t','i','o','n',' ',
'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0};
'W','H','E','R','E',' ','`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0};
UINT r;
MSIQUERY *view = NULL;
MSIQUERY *view;
MSIPACKAGE *package = dialog->package;
TRACE("%p %s\n", dialog, debugstr_w(dialog->name));
......@@ -2274,14 +2269,13 @@ static LRESULT WINAPI MSIRadioGroup_WndProc( HWND hWnd, UINT msg, WPARAM wParam,
static UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ','R','a','d','i','o','B','u','t','t','o','n',' ',
'W','H','E','R','E',' ',
'`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'R','a','d','i','o','B','u','t','t','o','n',' ','W','H','E','R','E',' ',
'`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
UINT r;
LPCWSTR prop;
msi_control *control;
MSIQUERY *view = NULL;
MSIQUERY *view;
radio_button_group_descr group;
MSIPACKAGE *package = dialog->package;
WNDPROC oldproc;
......@@ -2760,17 +2754,14 @@ static UINT msi_listbox_add_item( MSIRECORD *rec, LPVOID param )
static UINT msi_listbox_add_items( struct msi_listbox_info *info, LPCWSTR property )
{
UINT r;
MSIQUERY *view = NULL;
DWORD count;
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ','`','L','i','s','t','B','o','x','`',' ',
'W','H','E','R','E',' ',
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','L','i','s','t','B','o','x','`',' ','W','H','E','R','E',' ',
'`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ',
'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0
};
'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','`',0};
MSIQUERY *view;
DWORD count;
UINT r;
r = MSI_OpenQuery( info->dialog->package->db, &view, query, property );
if ( r != ERROR_SUCCESS )
......@@ -3359,12 +3350,11 @@ static UINT msi_dialog_create_controls( MSIRECORD *rec, LPVOID param )
static UINT msi_dialog_fill_controls( msi_dialog *dialog )
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ','C','o','n','t','r','o','l',' ',
'W','H','E','R','E',' ',
'`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0};
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'C','o','n','t','r','o','l',' ','W','H','E','R','E',' ',
'`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0};
UINT r;
MSIQUERY *view = NULL;
MSIQUERY *view;
MSIPACKAGE *package = dialog->package;
TRACE("%p %s\n", dialog, debugstr_w(dialog->name) );
......
......@@ -880,20 +880,18 @@ done:
UINT ACTION_MoveFiles( MSIPACKAGE *package )
{
UINT rc;
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','M','o','v','e','F','i','l','e','`',0};
MSIQUERY *view;
UINT rc;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','M','o','v','e','F','i','l','e','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_MoveFiles, package);
msiobj_release(&view->hdr);
return rc;
}
......@@ -1014,19 +1012,18 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
UINT ACTION_DuplicateFiles(MSIPACKAGE *package)
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0};
MSIQUERY *view;
UINT rc;
MSIQUERY * view;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_DuplicateFiles, package);
msiobj_release(&view->hdr);
return rc;
}
......@@ -1091,11 +1088,11 @@ static UINT ITERATE_RemoveDuplicateFiles( MSIRECORD *row, LPVOID param )
UINT ACTION_RemoveDuplicateFiles( MSIPACKAGE *package )
{
UINT rc;
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0};
MSIQUERY *view;
static const WCHAR query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','D','u','p','l','i','c','a','t','e','F','i','l','e','`',0};
UINT rc;
rc = MSI_DatabaseOpenViewW( package->db, query, &view );
if (rc != ERROR_SUCCESS)
......@@ -1103,7 +1100,6 @@ UINT ACTION_RemoveDuplicateFiles( MSIPACKAGE *package )
rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveDuplicateFiles, package );
msiobj_release( &view->hdr );
return rc;
}
......@@ -1228,9 +1224,9 @@ static void remove_folder( MSIFOLDER *folder )
UINT ACTION_RemoveFiles( MSIPACKAGE *package )
{
static const WCHAR query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','R','e','m','o','v','e','F','i','l','e','`',0};
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','R','e','m','o','v','e','F','i','l','e','`',0};
MSIQUERY *view;
MSICOMPONENT *comp;
MSIFILE *file;
......
......@@ -266,22 +266,17 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
UINT ACTION_RegisterFonts(MSIPACKAGE *package)
{
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','F','o','n','t','`',0};
MSIQUERY *view;
UINT rc;
MSIQUERY * view;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','F','o','n','t','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS)
{
TRACE("MSI_DatabaseOpenViewW failed: %d\n", rc);
return ERROR_SUCCESS;
}
MSI_IterateRecords(view, NULL, ITERATE_RegisterFonts, package);
msiobj_release(&view->hdr);
return ERROR_SUCCESS;
}
......@@ -351,21 +346,16 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param )
UINT ACTION_UnregisterFonts( MSIPACKAGE *package )
{
UINT r;
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','F','o','n','t','`',0};
MSIQUERY *view;
static const WCHAR query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','F','o','n','t','`',0};
UINT r;
r = MSI_DatabaseOpenViewW( package->db, query, &view );
if (r != ERROR_SUCCESS)
{
TRACE("MSI_DatabaseOpenViewW failed: %u\n", r);
return ERROR_SUCCESS;
}
MSI_IterateRecords( view, NULL, ITERATE_UnregisterFonts, package );
msiobj_release( &view->hdr );
return ERROR_SUCCESS;
}
......@@ -119,7 +119,7 @@ UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode
LPWSTR szwTable;
UINT ret;
TRACE("%s\n", debugstr_a(szTable));
TRACE("%s, %d\n", debugstr_a(szTable), iSequenceMode);
szwTable = strdupAtoW(szTable);
if (szTable && !szwTable)
......@@ -138,7 +138,7 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode
MSIPACKAGE *package;
UINT ret;
TRACE("%s\n", debugstr_w(szTable));
TRACE("%s, %d\n", debugstr_w(szTable), iSequenceMode);
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package)
......@@ -173,10 +173,8 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode
return ERROR_SUCCESS;
}
ret = MSI_Sequence( package, szTable, iSequenceMode );
ret = MSI_Sequence( package, szTable );
msiobj_release( &package->hdr );
return ret;
}
......
......@@ -774,7 +774,7 @@ extern UINT msi_apply_registered_patch( MSIPACKAGE *package, LPCWSTR patch_code
extern UINT MSI_InstallPackage( MSIPACKAGE *, LPCWSTR, LPCWSTR ) DECLSPEC_HIDDEN;
extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR) DECLSPEC_HIDDEN;
extern UINT ACTION_ForceReboot(MSIPACKAGE *package) DECLSPEC_HIDDEN;
extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable, INT iSequenceMode ) DECLSPEC_HIDDEN;
extern UINT MSI_Sequence( MSIPACKAGE *package, LPCWSTR szTable ) DECLSPEC_HIDDEN;
extern UINT MSI_SetFeatureStates( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, BOOL preserve_case ) DECLSPEC_HIDDEN;
extern UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action ) DECLSPEC_HIDDEN;
......
......@@ -367,21 +367,20 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg)
static UINT create_temp_property_table(MSIPACKAGE *package)
{
MSIQUERY *view = NULL;
static const WCHAR query[] = {
'C','R','E','A','T','E',' ','T','A','B','L','E',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ','(',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ',
'C','H','A','R','(','5','6',')',' ','N','O','T',' ','N','U','L','L',' ',
'T','E','M','P','O','R','A','R','Y',',',' ',
'`','V','a','l','u','e','`',' ','C','H','A','R','(','9','8',')',' ',
'N','O','T',' ','N','U','L','L',' ','T','E','M','P','O','R','A','R','Y',
' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ',
'`','_','P','r','o','p','e','r','t','y','`',')',' ','H','O','L','D',0};
MSIQUERY *view;
UINT rc;
static const WCHAR CreateSql[] = {
'C','R','E','A','T','E',' ','T','A','B','L','E',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ','(',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ',
'C','H','A','R','(','5','6',')',' ','N','O','T',' ','N','U','L','L',' ',
'T','E','M','P','O','R','A','R','Y',',',' ',
'`','V','a','l','u','e','`',' ','C','H','A','R','(','9','8',')',' ',
'N','O','T',' ','N','U','L','L',' ','T','E','M','P','O','R','A','R','Y',
' ','P','R','I','M','A','R','Y',' ','K','E','Y',' ',
'`','_','P','r','o','p','e','r','t','y','`',')',' ','H','O','L','D',0};
rc = MSI_DatabaseOpenViewW(package->db, CreateSql, &view);
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS)
return rc;
......@@ -393,22 +392,20 @@ static UINT create_temp_property_table(MSIPACKAGE *package)
UINT msi_clone_properties(MSIPACKAGE *package)
{
MSIQUERY *view_select = NULL;
UINT rc;
static const WCHAR query_select[] = {
'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ','`','P','r','o','p','e','r','t','y','`',0};
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','P','r','o','p','e','r','t','y','`',0};
static const WCHAR query_insert[] = {
'I','N','S','E','R','T',' ','i','n','t','o',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ',
'(','`','_','P','r','o','p','e','r','t','y','`',',',
'`','V','a','l','u','e','`',')',' ',
'V','A','L','U','E','S',' ','(','?',',','?',')',0};
'I','N','S','E','R','T',' ','I','N','T','O',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ',
'(','`','_','P','r','o','p','e','r','t','y','`',',','`','V','a','l','u','e','`',')',' ',
'V','A','L','U','E','S',' ','(','?',',','?',')',0};
static const WCHAR query_update[] = {
'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ',
'S','E','T',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ',
'W','H','E','R','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','?',0};
MSIQUERY *view_select;
UINT rc;
rc = MSI_DatabaseOpenViewW( package->db, query_select, &view_select );
if (rc != ERROR_SUCCESS)
......@@ -1934,27 +1931,24 @@ void msi_reset_folders( MSIPACKAGE *package, BOOL source )
UINT msi_set_property( MSIDATABASE *db, LPCWSTR szName, LPCWSTR szValue )
{
MSIQUERY *view;
MSIRECORD *row = NULL;
UINT rc;
DWORD sz = 0;
WCHAR Query[1024];
static const WCHAR Insert[] = {
'I','N','S','E','R','T',' ','i','n','t','o',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ','(',
'`','_','P','r','o','p','e','r','t','y','`',',',
'`','V','a','l','u','e','`',')',' ','V','A','L','U','E','S'
,' ','(','?',',','?',')',0};
static const WCHAR Update[] = {
'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',
' ','s','e','t',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ',
'w','h','e','r','e',' ','`','_','P','r','o','p','e','r','t','y','`',
' ','=',' ','\'','%','s','\'',0};
static const WCHAR Delete[] = {
static const WCHAR insert_query[] = {
'I','N','S','E','R','T',' ','I','N','T','O',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ',
'(','`','_','P','r','o','p','e','r','t','y','`',',','`','V','a','l','u','e','`',')',' ',
'V','A','L','U','E','S',' ','(','?',',','?',')',0};
static const WCHAR update_query[] = {
'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ',
'S','E','T',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ','W','H','E','R','E',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
static const WCHAR delete_query[] = {
'D','E','L','E','T','E',' ','F','R','O','M',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ','W','H','E','R','E',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
MSIQUERY *view;
MSIRECORD *row = NULL;
DWORD sz = 0;
WCHAR query[1024];
UINT rc;
TRACE("%p %s %s\n", db, debugstr_w(szName), debugstr_w(szValue));
......@@ -1968,35 +1962,32 @@ UINT msi_set_property( MSIDATABASE *db, LPCWSTR szName, LPCWSTR szValue )
rc = msi_get_property(db, szName, 0, &sz);
if (!szValue || !*szValue)
{
sprintfW(Query, Delete, szName);
sprintfW(query, delete_query, szName);
}
else if (rc == ERROR_MORE_DATA || rc == ERROR_SUCCESS)
{
sprintfW(Query, Update, szName);
sprintfW(query, update_query, szName);
row = MSI_CreateRecord(1);
MSI_RecordSetStringW(row, 1, szValue);
}
else
{
strcpyW(Query, Insert);
strcpyW(query, insert_query);
row = MSI_CreateRecord(2);
MSI_RecordSetStringW(row, 1, szName);
MSI_RecordSetStringW(row, 2, szValue);
}
rc = MSI_DatabaseOpenViewW(db, Query, &view);
rc = MSI_DatabaseOpenViewW(db, query, &view);
if (rc == ERROR_SUCCESS)
{
rc = MSI_ViewExecute(view, row);
MSI_ViewClose(view);
msiobj_release(&view->hdr);
}
if (row)
msiobj_release(&row->hdr);
if (row) msiobj_release(&row->hdr);
return rc;
}
......@@ -2053,15 +2044,13 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name )
{
MSIQUERY *view;
MSIRECORD *rec, *row = NULL;
UINT r;
static const WCHAR query[]= {
'S','E','L','E','C','T',' ','`','V','a','l','u','e','`',' ',
'F','R','O','M',' ' ,'`','_','P','r','o','p','e','r','t','y','`',
' ','W','H','E','R','E',' ' ,'`','_','P','r','o','p','e','r','t','y','`',
'=','?',0};
'F','R','O','M',' ' ,'`','_','P','r','o','p','e','r','t','y','`',' ',
'W','H','E','R','E',' ' ,'`','_','P','r','o','p','e','r','t','y','`','=','?',0};
MSIRECORD *rec, *row = NULL;
MSIQUERY *view;
UINT r;
if (!name || !*name)
return NULL;
......@@ -2080,7 +2069,6 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name )
MSI_ViewClose(view);
msiobj_release(&view->hdr);
}
msiobj_release(&rec->hdr);
return row;
}
......
......@@ -266,7 +266,7 @@ static void patch_offset_list_free( struct patch_offset_list *pos )
static void patch_offset_get_patches( MSIDATABASE *db, UINT last_sequence, struct patch_offset_list *pos )
{
static const WCHAR query_patch[] = {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','P','a','t','c','h',' ',
'W','H','E','R','E',' ','S','e','q','u','e','n','c','e',' ','<','=',' ','?',' ',
'O','R','D','E','R',' ','B','Y',' ','S','e','q','u','e','n','c','e',0};
......@@ -274,7 +274,7 @@ static void patch_offset_get_patches( MSIDATABASE *db, UINT last_sequence, struc
MSIRECORD *rec;
UINT r;
r = MSI_DatabaseOpenViewW( db, query_patch, &view );
r = MSI_DatabaseOpenViewW( db, query, &view );
if (r != ERROR_SUCCESS)
return;
......@@ -301,7 +301,7 @@ static void patch_offset_get_patches( MSIDATABASE *db, UINT last_sequence, struc
static void patch_offset_get_files( MSIDATABASE *db, UINT last_sequence, struct patch_offset_list *pos )
{
static const WCHAR query_files[] = {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','F','i','l','e',' ',
'W','H','E','R','E',' ','S','e','q','u','e','n','c','e',' ','<','=',' ','?',' ',
'O','R','D','E','R',' ','B','Y',' ','S','e','q','u','e','n','c','e',0};
......@@ -309,7 +309,7 @@ static void patch_offset_get_files( MSIDATABASE *db, UINT last_sequence, struct
MSIRECORD *rec;
UINT r;
r = MSI_DatabaseOpenViewW( db, query_files, &view );
r = MSI_DatabaseOpenViewW( db, query, &view );
if (r != ERROR_SUCCESS)
return;
......@@ -342,7 +342,7 @@ static void patch_offset_get_files( MSIDATABASE *db, UINT last_sequence, struct
static UINT patch_offset_modify_db( MSIDATABASE *db, struct patch_offset_list *pos )
{
static const WCHAR query_files[] = {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','F','i','l','e',' ',
'W','H','E','R','E',' ','S','e','q','u','e','n','c','e',' ','>','=',' ','?',' ',
'A','N','D',' ','S','e','q','u','e','n','c','e',' ','<','=',' ','?',' ',
......@@ -352,7 +352,7 @@ static UINT patch_offset_modify_db( MSIDATABASE *db, struct patch_offset_list *p
MSIQUERY *view;
UINT r;
r = MSI_DatabaseOpenViewW( db, query_files, &view );
r = MSI_DatabaseOpenViewW( db, query, &view );
if (r != ERROR_SUCCESS)
return ERROR_SUCCESS;
......
......@@ -1237,16 +1237,14 @@ static UINT TABLE_get_row( struct tagMSIVIEW *view, UINT row, MSIRECORD **rec )
static UINT msi_addstreamW( MSIDATABASE *db, LPCWSTR name, IStream *data )
{
UINT r;
MSIQUERY *query = NULL;
MSIRECORD *rec = NULL;
static const WCHAR insert[] = {
'I','N','S','E','R','T',' ','I','N','T','O',' ',
'`','_','S','t','r','e','a','m','s','`',' ',
'(','`','N','a','m','e','`',',',
'`','D','a','t','a','`',')',' ',
'V','A','L','U','E','S',' ','(','?',',','?',')',0};
'I','N','S','E','R','T',' ','I','N','T','O',' ',
'`','_','S','t','r','e','a','m','s','`',' ',
'(','`','N','a','m','e','`',',','`','D','a','t','a','`',')',' ',
'V','A','L','U','E','S',' ','(','?',',','?',')',0};
MSIQUERY *query = NULL;
MSIRECORD *rec;
UINT r;
TRACE("%p %s %p\n", db, debugstr_w(name), data);
......@@ -1271,7 +1269,6 @@ static UINT msi_addstreamW( MSIDATABASE *db, LPCWSTR name, IStream *data )
err:
msiobj_release( &query->hdr );
msiobj_release( &rec->hdr );
return r;
}
......
......@@ -205,18 +205,17 @@ static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
UINT ACTION_FindRelatedProducts(MSIPACKAGE *package)
{
static const WCHAR Query[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',
' ','`','U','p','g','r','a','d','e','`',0};
UINT rc = ERROR_SUCCESS;
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','U','p','g','r','a','d','e','`',0};
MSIQUERY *view;
UINT rc;
if (msi_get_property_int(package->db, szInstalled, 0))
{
TRACE("Skipping FindRelatedProducts action: product already installed\n");
return ERROR_SUCCESS;
}
if (msi_action_is_unique(package, szFindRelatedProducts))
{
TRACE("Skipping FindRelatedProducts action: already done in UI sequence\n");
......@@ -225,12 +224,11 @@ UINT ACTION_FindRelatedProducts(MSIPACKAGE *package)
else
msi_register_unique_action(package, szFindRelatedProducts);
rc = MSI_DatabaseOpenViewW(package->db, Query, &view);
rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_FindRelatedProducts, package);
msiobj_release(&view->hdr);
return rc;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment