msi: Clean up the database queries.

This commit is contained in:
Hans Leidekker 2011-07-27 10:53:26 +02:00 committed by Alexandre Julliard
parent d1b2058500
commit e1c2e8828f
15 changed files with 431 additions and 592 deletions

File diff suppressed because it is too large Load Diff

View File

@ -135,8 +135,12 @@ static UINT alter_add_column(MSIALTERVIEW *av)
{ {
r = MSI_IterateRecords(view, NULL, ITERATE_columns, &colnum); r = MSI_IterateRecords(view, NULL, ITERATE_columns, &colnum);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
if (r != ERROR_SUCCESS)
{
columns->ops->delete(columns);
return r;
}
} }
r = columns->ops->add_column(columns, av->colinfo->table, r = columns->ops->add_column(columns, av->colinfo->table,
colnum, av->colinfo->column, colnum, av->colinfo->column,
av->colinfo->type, (av->hold == 1)); av->colinfo->type, (av->hold == 1));

View File

@ -1072,10 +1072,9 @@ static UINT iterate_appsearch(MSIRECORD *row, LPVOID param)
UINT ACTION_AppSearch(MSIPACKAGE *package) UINT ACTION_AppSearch(MSIPACKAGE *package)
{ {
static const WCHAR query[] = { static const WCHAR query[] = {
's','e','l','e','c','t',' ','*',' ', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'f','r','o','m',' ',
'A','p','p','S','e','a','r','c','h',0}; 'A','p','p','S','e','a','r','c','h',0};
MSIQUERY *view = NULL; MSIQUERY *view;
UINT r; UINT r;
if (msi_action_is_unique(package, szAppSearch)) if (msi_action_is_unique(package, szAppSearch))
@ -1092,7 +1091,6 @@ UINT ACTION_AppSearch(MSIPACKAGE *package)
r = MSI_IterateRecords( view, NULL, iterate_appsearch, package ); r = MSI_IterateRecords( view, NULL, iterate_appsearch, package );
msiobj_release( &view->hdr ); msiobj_release( &view->hdr );
return r; return r;
} }
@ -1127,10 +1125,9 @@ static UINT ITERATE_CCPSearch(MSIRECORD *row, LPVOID param)
UINT ACTION_CCPSearch(MSIPACKAGE *package) UINT ACTION_CCPSearch(MSIPACKAGE *package)
{ {
static const WCHAR query[] = { static const WCHAR query[] = {
's','e','l','e','c','t',' ','*',' ', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'f','r','o','m',' ',
'C','C','P','S','e','a','r','c','h',0}; 'C','C','P','S','e','a','r','c','h',0};
MSIQUERY *view = NULL; MSIQUERY *view;
UINT r; UINT r;
if (msi_action_is_unique(package, szCCPSearch)) if (msi_action_is_unique(package, szCCPSearch))
@ -1147,6 +1144,5 @@ UINT ACTION_CCPSearch(MSIPACKAGE *package)
r = MSI_IterateRecords(view, NULL, ITERATE_CCPSearch, package); r = MSI_IterateRecords(view, NULL, ITERATE_CCPSearch, package);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
return r; return r;
} }

View File

@ -74,12 +74,12 @@ static MSIAPPID *load_appid( MSIPACKAGE* package, MSIRECORD *row )
static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name ) static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name )
{ {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','A','p','p','I','d','`',' ','W','H','E','R','E',' ',
'`','A','p','p','I','d','`',' ','=',' ','\'','%','s','\'',0};
MSIRECORD *row; MSIRECORD *row;
MSIAPPID *appid; MSIAPPID *appid;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','A','p','p','I','d','`',' ','W','H','E','R','E',' ',
'`','A','p','p','I','d','`',' ','=',' ','\'','%','s','\'',0};
if (!name) if (!name)
return NULL; return NULL;
@ -94,13 +94,12 @@ static MSIAPPID *load_given_appid( MSIPACKAGE *package, LPCWSTR name )
} }
} }
row = MSI_QueryGetRecord(package->db, ExecSeqQuery, name); row = MSI_QueryGetRecord(package->db, query, name);
if (!row) if (!row)
return NULL; return NULL;
appid = load_appid(package, row); appid = load_appid(package, row);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
return appid; return appid;
} }
@ -179,12 +178,12 @@ static MSIPROGID *load_progid( MSIPACKAGE* package, MSIRECORD *row )
static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name) static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name)
{ {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','P','r','o','g','I','d','`',' ','W','H','E','R','E',' ',
'`','P','r','o','g','I','d','`',' ','=',' ','\'','%','s','\'',0};
MSIPROGID *progid; MSIPROGID *progid;
MSIRECORD *row; MSIRECORD *row;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','P','r','o','g','I','d','`',' ','W','H','E','R','E',' ',
'`','P','r','o','g','I','d','`',' ','=',' ','\'','%','s','\'',0};
if (!name) if (!name)
return NULL; return NULL;
@ -199,13 +198,12 @@ static MSIPROGID *load_given_progid(MSIPACKAGE *package, LPCWSTR name)
} }
} }
row = MSI_QueryGetRecord( package->db, ExecSeqQuery, name ); row = MSI_QueryGetRecord( package->db, query, name );
if (!row) if (!row)
return NULL; return NULL;
progid = load_progid(package, row); progid = load_progid(package, row);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
return progid; return progid;
} }
@ -310,12 +308,12 @@ static MSICLASS *load_class( MSIPACKAGE* package, MSIRECORD *row )
*/ */
static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid) static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid)
{ {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','C','l','a','s','s','`',' ','W','H','E','R','E',' ',
'`','C','L','S','I','D','`',' ','=',' ','\'','%','s','\'',0};
MSICLASS *cls; MSICLASS *cls;
MSIRECORD *row; MSIRECORD *row;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','C','l','a','s','s','`',' ','W','H','E','R','E',' ',
'`','C','L','S','I','D','`',' ','=',' ','\'','%','s','\'',0};
if (!classid) if (!classid)
return NULL; return NULL;
@ -330,13 +328,12 @@ static MSICLASS *load_given_class(MSIPACKAGE *package, LPCWSTR classid)
} }
} }
row = MSI_QueryGetRecord(package->db, ExecSeqQuery, classid); row = MSI_QueryGetRecord(package->db, query, classid);
if (!row) if (!row)
return NULL; return NULL;
cls = load_class(package, row); cls = load_class(package, row);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
return cls; return cls;
} }
@ -370,12 +367,11 @@ static MSIMIME *load_mime( MSIPACKAGE* package, MSIRECORD *row )
static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime ) static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime )
{ {
static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','M','I','M','E','`',' ','W','H','E','R','E',' ',
'`','C','o','n','t','e','n','t','T','y','p','e','`',' ','=',' ','\'','%','s','\'',0};
MSIRECORD *row; MSIRECORD *row;
static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','M','I','M','E','`',' ','W','H','E','R','E',' ',
'`','C','o','n','t','e','n','t','T','y','p','e','`',' ','=',' ',
'\'','%','s','\'',0};
MSIMIME *mt; MSIMIME *mt;
if (!mime) if (!mime)
@ -391,13 +387,12 @@ static MSIMIME *load_given_mime( MSIPACKAGE *package, LPCWSTR mime )
} }
} }
row = MSI_QueryGetRecord(package->db, ExecSeqQuery, mime); row = MSI_QueryGetRecord(package->db, query, mime);
if (!row) if (!row)
return NULL; return NULL;
mt = load_mime(package, row); mt = load_mime(package, row);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
return mt; return mt;
} }
@ -440,14 +435,12 @@ static MSIEXTENSION *load_extension( MSIPACKAGE* package, MSIRECORD *row )
*/ */
static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name ) static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name )
{ {
MSIRECORD *row; static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','E','x','t','e','n','s','i','o','n','`',' ','W','H','E','R','E',' ',
'`','E','x','t','e','n','s','i','o','n','`',' ','=',' ','\'','%','s','\'',0};
MSIEXTENSION *ext; MSIEXTENSION *ext;
static const WCHAR ExecSeqQuery[] = MSIRECORD *row;
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','E','x','t','e','n','s','i','o','n','`',' ',
'W','H','E','R','E',' ',
'`','E','x','t','e','n','s','i','o','n','`',' ','=',' ',
'\'','%','s','\'',0};
if (!name) if (!name)
return NULL; return NULL;
@ -465,13 +458,12 @@ static MSIEXTENSION *load_given_extension( MSIPACKAGE *package, LPCWSTR name )
} }
} }
row = MSI_QueryGetRecord( package->db, ExecSeqQuery, name ); row = MSI_QueryGetRecord( package->db, query, name );
if (!row) if (!row)
return NULL; return NULL;
ext = load_extension(package, row); ext = load_extension(package, row);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
return ext; return ext;
} }
@ -548,14 +540,12 @@ static UINT iterate_all_classes(MSIRECORD *rec, LPVOID param)
static VOID load_all_classes(MSIPACKAGE *package) static VOID load_all_classes(MSIPACKAGE *package)
{ {
UINT rc = ERROR_SUCCESS; static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ','`','C','l','a','s','s','`',0};
MSIQUERY *view; MSIQUERY *view;
UINT rc;
static const WCHAR ExecSeqQuery[] = rc = MSI_DatabaseOpenViewW(package->db, query, &view);
{'S','E','L','E','C','T',' ','*',' ', 'F','R','O','M',' ',
'`','C','l','a','s','s','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return; return;
@ -595,14 +585,12 @@ static UINT iterate_all_extensions(MSIRECORD *rec, LPVOID param)
static VOID load_all_extensions(MSIPACKAGE *package) static VOID load_all_extensions(MSIPACKAGE *package)
{ {
UINT rc = ERROR_SUCCESS; static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','E','x','t','e','n','s','i','o','n','`',0};
MSIQUERY *view; MSIQUERY *view;
UINT rc;
static const WCHAR ExecSeqQuery[] = rc = MSI_DatabaseOpenViewW( package->db, query, &view );
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','E','x','t','e','n','s','i','o','n','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return; return;
@ -622,14 +610,13 @@ static UINT iterate_all_progids(MSIRECORD *rec, LPVOID param)
static VOID load_all_progids(MSIPACKAGE *package) static VOID load_all_progids(MSIPACKAGE *package)
{ {
UINT rc = ERROR_SUCCESS; static const WCHAR query[] = {
'S','E','L','E','C','T',' ','`','P','r','o','g','I','d','`',' ','F','R','O','M',' ',
'`','P','r','o','g','I','d','`',0};
MSIQUERY *view; MSIQUERY *view;
UINT rc;
static const WCHAR ExecSeqQuery[] = rc = MSI_DatabaseOpenViewW(package->db, query, &view);
{'S','E','L','E','C','T',' ','`','P','r','o','g','I','d','`',' ',
'F','R','O','M',' ', '`','P','r','o','g','I','d','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return; return;
@ -639,14 +626,12 @@ static VOID load_all_progids(MSIPACKAGE *package)
static VOID load_all_verbs(MSIPACKAGE *package) static VOID load_all_verbs(MSIPACKAGE *package)
{ {
UINT rc = ERROR_SUCCESS; static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ','`','V','e','r','b','`',0};
MSIQUERY *view; MSIQUERY *view;
UINT rc;
static const WCHAR ExecSeqQuery[] = rc = MSI_DatabaseOpenViewW(package->db, query, &view);
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','V','e','r','b','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return; return;
@ -666,16 +651,13 @@ static UINT iterate_all_mimes(MSIRECORD *rec, LPVOID param)
static VOID load_all_mimes(MSIPACKAGE *package) static VOID load_all_mimes(MSIPACKAGE *package)
{ {
UINT rc = ERROR_SUCCESS; static const WCHAR query[] = {
'S','E','L','E','C','T',' ','`','C','o','n','t','e','n','t','T','y','p','e','`',' ',
'F','R','O','M',' ','`','M','I','M','E','`',0};
MSIQUERY *view; MSIQUERY *view;
UINT rc;
static const WCHAR ExecSeqQuery[] = rc = MSI_DatabaseOpenViewW(package->db, query, &view);
{'S','E','L','E','C','T',' ',
'`','C','o','n','t','e','n','t','T','y','p','e','`',
' ','F','R','O','M',' ',
'`','M','I','M','E','`',0};
rc = MSI_DatabaseOpenViewW(package->db, ExecSeqQuery, &view);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return; return;
@ -960,7 +942,6 @@ UINT ACTION_RegisterClassInfo(MSIPACKAGE *package)
msi_ui_actiondata( package, szRegisterClassInfo, uirow ); msi_ui_actiondata( package, szRegisterClassInfo, uirow );
msiobj_release(&uirow->hdr); msiobj_release(&uirow->hdr);
} }
RegCloseKey(hkey); RegCloseKey(hkey);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -1051,7 +1032,6 @@ UINT ACTION_UnregisterClassInfo( MSIPACKAGE *package )
msi_ui_actiondata( package, szUnregisterClassInfo, uirow ); msi_ui_actiondata( package, szUnregisterClassInfo, uirow );
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
RegCloseKey( hkey ); RegCloseKey( hkey );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -1132,7 +1112,6 @@ UINT ACTION_RegisterProgIdInfo(MSIPACKAGE *package)
msi_ui_actiondata( package, szRegisterProgIdInfo, uirow ); msi_ui_actiondata( package, szRegisterProgIdInfo, uirow );
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -1167,7 +1146,6 @@ UINT ACTION_UnregisterProgIdInfo( MSIPACKAGE *package )
msi_ui_actiondata( package, szUnregisterProgIdInfo, uirow ); msi_ui_actiondata( package, szUnregisterProgIdInfo, uirow );
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -1249,8 +1227,7 @@ static UINT register_verb(MSIPACKAGE *package, LPCWSTR progid,
UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package) UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
{ {
static const WCHAR szContentType[] = static const WCHAR szContentType[] = {'C','o','n','t','e','n','t',' ','T','y','p','e',0};
{'C','o','n','t','e','n','t',' ','T','y','p','e',0 };
HKEY hkey = NULL; HKEY hkey = NULL;
MSIEXTENSION *ext; MSIEXTENSION *ext;
MSIRECORD *uirow; MSIRECORD *uirow;
@ -1361,7 +1338,6 @@ UINT ACTION_RegisterExtensionInfo(MSIPACKAGE *package)
msi_ui_actiondata( package, szRegisterExtensionInfo, uirow ); msi_ui_actiondata( package, szRegisterExtensionInfo, uirow );
msiobj_release(&uirow->hdr); msiobj_release(&uirow->hdr);
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -1447,14 +1423,12 @@ UINT ACTION_UnregisterExtensionInfo( MSIPACKAGE *package )
msi_ui_actiondata( package, szUnregisterExtensionInfo, uirow ); msi_ui_actiondata( package, szUnregisterExtensionInfo, uirow );
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package) UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
{ {
static const WCHAR szExten[] = static const WCHAR szExtension[] = {'E','x','t','e','n','s','i','o','n',0};
{'E','x','t','e','n','s','i','o','n',0 };
MSIRECORD *uirow; MSIRECORD *uirow;
MSIMIME *mt; MSIMIME *mt;
@ -1462,8 +1436,7 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry ) LIST_FOR_EACH_ENTRY( mt, &package->mimes, MSIMIME, entry )
{ {
LPWSTR extension; LPWSTR extension, key;
LPWSTR key;
/* /*
* check if the MIME is to be installed. Either as requested by an * check if the MIME is to be installed. Either as requested by an
@ -1491,7 +1464,7 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
strcpyW( key, szMIMEDatabase ); strcpyW( key, szMIMEDatabase );
strcatW( key, mt->ContentType ); strcatW( key, mt->ContentType );
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szExten, extension ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szExtension, extension );
if (mt->clsid) if (mt->clsid)
msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szCLSID, mt->clsid ); msi_reg_set_subkey_val( HKEY_CLASSES_ROOT, key, szCLSID, mt->clsid );
@ -1505,7 +1478,6 @@ UINT ACTION_RegisterMIMEInfo(MSIPACKAGE *package)
msi_ui_actiondata( package, szRegisterMIMEInfo, uirow ); msi_ui_actiondata( package, szRegisterMIMEInfo, uirow );
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -1550,6 +1522,5 @@ UINT ACTION_UnregisterMIMEInfo( MSIPACKAGE *package )
msi_ui_actiondata( package, szUnregisterMIMEInfo, uirow ); msi_ui_actiondata( package, szUnregisterMIMEInfo, uirow );
msiobj_release( &uirow->hdr ); msiobj_release( &uirow->hdr );
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }

View File

@ -1186,18 +1186,16 @@ static UINT HANDLE_CustomType53_54(MSIPACKAGE *package, LPCWSTR source,
UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL execute) 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; UINT rc = ERROR_SUCCESS;
MSIRECORD * row = 0; MSIRECORD *row;
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};
UINT type; UINT type;
LPCWSTR source, target; LPCWSTR source, target;
LPWSTR ptr, deferred_data = NULL; LPWSTR ptr, deferred_data = NULL;
LPWSTR action_copy = strdupW(action); LPWSTR deformated = NULL, action_copy = strdupW(action);
WCHAR *deformated=NULL;
/* deferred action: [properties]Action */ /* deferred action: [properties]Action */
if ((ptr = strrchrW(action_copy, ']'))) if ((ptr = strrchrW(action_copy, ']')))
@ -1206,7 +1204,7 @@ UINT ACTION_CustomAction(MSIPACKAGE *package, LPCWSTR action, UINT script, BOOL
action = ptr + 1; action = ptr + 1;
} }
row = MSI_QueryGetRecord( package->db, ExecSeqQuery, action ); row = MSI_QueryGetRecord( package->db, query, action );
if (!row) if (!row)
{ {
msi_free(action_copy); msi_free(action_copy);

View File

@ -1877,12 +1877,12 @@ done:
static UINT gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge, static UINT gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge,
struct list *tabledata) 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; MSIQUERY *view;
MERGEDATA data; MERGEDATA data;
UINT r;
static const WCHAR query[] = {'S','E','L','E','C','T',' ','*',' ',
'F','R','O','M',' ','`','_','T','a','b','l','e','s','`',0};
r = MSI_DatabaseOpenViewW(merge, query, &view); r = MSI_DatabaseOpenViewW(merge, query, &view);
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
@ -1892,7 +1892,6 @@ static UINT gather_merge_data(MSIDATABASE *db, MSIDATABASE *merge,
data.merge = merge; data.merge = merge;
data.tabledata = tabledata; data.tabledata = tabledata;
r = MSI_IterateRecords(view, NULL, merge_diff_tables, &data); r = MSI_IterateRecords(view, NULL, merge_diff_tables, &data);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
return r; return r;
} }

View File

@ -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 UINT msi_dialog_build_font_list( msi_dialog *dialog )
{ {
static const WCHAR query[] = { static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'F','R','O','M',' ','`','T','e','x','t','S','t','y','l','e','`',' ',0 '`','T','e','x','t','S','t','y','l','e','`',0};
}; MSIQUERY *view;
UINT r; UINT r;
MSIQUERY *view = NULL;
TRACE("dialog %p\n", dialog ); 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 UINT msi_dialog_button_handler( msi_dialog *dialog, msi_control *control, WPARAM param )
{ {
static const WCHAR query[] = { 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','E','v','e','n','t',' ','W','H','E','R','E',' ', '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',' ', '`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',' ','A','N','D',' ',
'`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',' ', '`','C','o','n','t','r','o','l','_','`',' ','=',' ','\'','%','s','\'',' ',
'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','i','n','g','`',0}; 'O','R','D','E','R',' ','B','Y',' ','`','O','r','d','e','r','i','n','g','`',0};
MSIQUERY *view = NULL; MSIQUERY *view;
UINT r; UINT r;
if (HIWORD(param) != BN_CLICKED) 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) if (r != ERROR_SUCCESS)
{ {
ERR("query failed\n"); ERR("query failed\n");
return 0; return ERROR_SUCCESS;
} }
r = MSI_IterateRecords( view, 0, msi_dialog_control_event, dialog ); r = MSI_IterateRecords( view, 0, msi_dialog_control_event, dialog );
msiobj_release( &view->hdr ); msiobj_release( &view->hdr );
return r; 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 ) static UINT msi_combobox_add_items( struct msi_combobox_info *info, LPCWSTR property )
{ {
UINT r;
MSIQUERY *view = NULL;
DWORD count;
static const WCHAR query[] = { static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'F','R','O','M',' ','`','C','o','m','b','o','B','o','x','`',' ', '`','C','o','m','b','o','B','o','x','`',' ','W','H','E','R','E',' ',
'W','H','E','R','E',' ',
'`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ', '`','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 ); r = MSI_OpenQuery( info->dialog->package->db, &view, query, property );
if (r != ERROR_SUCCESS) 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 UINT msi_dialog_evaluate_control_conditions( msi_dialog *dialog )
{ {
static const WCHAR query[] = { 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',' ', '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; UINT r;
MSIQUERY *view = NULL; MSIQUERY *view;
MSIPACKAGE *package = dialog->package; MSIPACKAGE *package = dialog->package;
TRACE("%p %s\n", dialog, debugstr_w(dialog->name)); 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 UINT msi_dialog_radiogroup_control( msi_dialog *dialog, MSIRECORD *rec )
{ {
static const WCHAR query[] = { static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'F','R','O','M',' ','R','a','d','i','o','B','u','t','t','o','n',' ', 'R','a','d','i','o','B','u','t','t','o','n',' ','W','H','E','R','E',' ',
'W','H','E','R','E',' ', '`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
'`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
UINT r; UINT r;
LPCWSTR prop; LPCWSTR prop;
msi_control *control; msi_control *control;
MSIQUERY *view = NULL; MSIQUERY *view;
radio_button_group_descr group; radio_button_group_descr group;
MSIPACKAGE *package = dialog->package; MSIPACKAGE *package = dialog->package;
WNDPROC oldproc; 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 ) static UINT msi_listbox_add_items( struct msi_listbox_info *info, LPCWSTR property )
{ {
UINT r;
MSIQUERY *view = NULL;
DWORD count;
static const WCHAR query[] = { static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'F','R','O','M',' ','`','L','i','s','t','B','o','x','`',' ', '`','L','i','s','t','B','o','x','`',' ','W','H','E','R','E',' ',
'W','H','E','R','E',' ',
'`','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',' ', '`','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 ); r = MSI_OpenQuery( info->dialog->package->db, &view, query, property );
if ( r != ERROR_SUCCESS ) 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 UINT msi_dialog_fill_controls( msi_dialog *dialog )
{ {
static const WCHAR query[] = { static const WCHAR query[] = {
'S','E','L','E','C','T',' ','*',' ', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'F','R','O','M',' ','C','o','n','t','r','o','l',' ', 'C','o','n','t','r','o','l',' ','W','H','E','R','E',' ',
'W','H','E','R','E',' ', '`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0};
'`','D','i','a','l','o','g','_','`',' ','=',' ','\'','%','s','\'',0};
UINT r; UINT r;
MSIQUERY *view = NULL; MSIQUERY *view;
MSIPACKAGE *package = dialog->package; MSIPACKAGE *package = dialog->package;
TRACE("%p %s\n", dialog, debugstr_w(dialog->name) ); TRACE("%p %s\n", dialog, debugstr_w(dialog->name) );

View File

@ -880,20 +880,18 @@ done:
UINT ACTION_MoveFiles( MSIPACKAGE *package ) 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; MSIQUERY *view;
UINT rc;
static const WCHAR ExecSeqQuery[] = rc = MSI_DatabaseOpenViewW(package->db, query, &view);
{'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);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS; return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_MoveFiles, package); rc = MSI_IterateRecords(view, NULL, ITERATE_MoveFiles, package);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
return rc; return rc;
} }
@ -1014,19 +1012,18 @@ static UINT ITERATE_DuplicateFiles(MSIRECORD *row, LPVOID param)
UINT ACTION_DuplicateFiles(MSIPACKAGE *package) 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; 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) if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS; return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_DuplicateFiles, package); rc = MSI_IterateRecords(view, NULL, ITERATE_DuplicateFiles, package);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
return rc; return rc;
} }
@ -1091,11 +1088,11 @@ static UINT ITERATE_RemoveDuplicateFiles( MSIRECORD *row, LPVOID param )
UINT ACTION_RemoveDuplicateFiles( MSIPACKAGE *package ) 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; MSIQUERY *view;
static const WCHAR query[] = UINT rc;
{'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, query, &view ); rc = MSI_DatabaseOpenViewW( package->db, query, &view );
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
@ -1103,7 +1100,6 @@ UINT ACTION_RemoveDuplicateFiles( MSIPACKAGE *package )
rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveDuplicateFiles, package ); rc = MSI_IterateRecords( view, NULL, ITERATE_RemoveDuplicateFiles, package );
msiobj_release( &view->hdr ); msiobj_release( &view->hdr );
return rc; return rc;
} }
@ -1228,9 +1224,9 @@ static void remove_folder( MSIFOLDER *folder )
UINT ACTION_RemoveFiles( MSIPACKAGE *package ) UINT ACTION_RemoveFiles( MSIPACKAGE *package )
{ {
static const WCHAR query[] = static const WCHAR query[] = {
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','R','e','m','o','v','e','F','i','l','e','`',0}; '`','R','e','m','o','v','e','F','i','l','e','`',0};
MSIQUERY *view; MSIQUERY *view;
MSICOMPONENT *comp; MSICOMPONENT *comp;
MSIFILE *file; MSIFILE *file;

View File

@ -266,22 +266,17 @@ static UINT ITERATE_RegisterFonts(MSIRECORD *row, LPVOID param)
UINT ACTION_RegisterFonts(MSIPACKAGE *package) 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; 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) if (rc != ERROR_SUCCESS)
{
TRACE("MSI_DatabaseOpenViewW failed: %d\n", rc);
return ERROR_SUCCESS; return ERROR_SUCCESS;
}
MSI_IterateRecords(view, NULL, ITERATE_RegisterFonts, package); MSI_IterateRecords(view, NULL, ITERATE_RegisterFonts, package);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
@ -351,21 +346,16 @@ static UINT ITERATE_UnregisterFonts( MSIRECORD *row, LPVOID param )
UINT ACTION_UnregisterFonts( MSIPACKAGE *package ) 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; MSIQUERY *view;
static const WCHAR query[] = UINT r;
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'`','F','o','n','t','`',0};
r = MSI_DatabaseOpenViewW( package->db, query, &view ); r = MSI_DatabaseOpenViewW( package->db, query, &view );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
{
TRACE("MSI_DatabaseOpenViewW failed: %u\n", r);
return ERROR_SUCCESS; return ERROR_SUCCESS;
}
MSI_IterateRecords( view, NULL, ITERATE_UnregisterFonts, package ); MSI_IterateRecords( view, NULL, ITERATE_UnregisterFonts, package );
msiobj_release( &view->hdr ); msiobj_release( &view->hdr );
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }

View File

@ -119,7 +119,7 @@ UINT WINAPI MsiSequenceA( MSIHANDLE hInstall, LPCSTR szTable, INT iSequenceMode
LPWSTR szwTable; LPWSTR szwTable;
UINT ret; UINT ret;
TRACE("%s\n", debugstr_a(szTable)); TRACE("%s, %d\n", debugstr_a(szTable), iSequenceMode);
szwTable = strdupAtoW(szTable); szwTable = strdupAtoW(szTable);
if (szTable && !szwTable) if (szTable && !szwTable)
@ -138,7 +138,7 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode
MSIPACKAGE *package; MSIPACKAGE *package;
UINT ret; UINT ret;
TRACE("%s\n", debugstr_w(szTable)); TRACE("%s, %d\n", debugstr_w(szTable), iSequenceMode);
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE ); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE );
if (!package) if (!package)
@ -173,10 +173,8 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
ret = MSI_Sequence( package, szTable );
ret = MSI_Sequence( package, szTable, iSequenceMode );
msiobj_release( &package->hdr ); msiobj_release( &package->hdr );
return ret; return ret;
} }

View File

@ -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 MSI_InstallPackage( MSIPACKAGE *, LPCWSTR, LPCWSTR ) DECLSPEC_HIDDEN;
extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR) DECLSPEC_HIDDEN; extern UINT ACTION_DialogBox( MSIPACKAGE*, LPCWSTR) DECLSPEC_HIDDEN;
extern UINT ACTION_ForceReboot(MSIPACKAGE *package) 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_SetFeatureStates( MSIPACKAGE *package ) DECLSPEC_HIDDEN;
extern UINT msi_parse_command_line( MSIPACKAGE *package, LPCWSTR szCommandLine, BOOL preserve_case ) 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; extern UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action ) DECLSPEC_HIDDEN;

View File

@ -367,21 +367,20 @@ static void MSI_FreePackage( MSIOBJECTHDR *arg)
static UINT create_temp_property_table(MSIPACKAGE *package) 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; UINT rc;
static const WCHAR CreateSql[] = { rc = MSI_DatabaseOpenViewW(package->db, query, &view);
'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);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return rc; return rc;
@ -393,22 +392,20 @@ static UINT create_temp_property_table(MSIPACKAGE *package)
UINT msi_clone_properties(MSIPACKAGE *package) UINT msi_clone_properties(MSIPACKAGE *package)
{ {
MSIQUERY *view_select = NULL;
UINT rc;
static const WCHAR query_select[] = { static const WCHAR query_select[] = {
'S','E','L','E','C','T',' ','*',' ', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
'F','R','O','M',' ','`','P','r','o','p','e','r','t','y','`',0}; '`','P','r','o','p','e','r','t','y','`',0};
static const WCHAR query_insert[] = { static const WCHAR query_insert[] = {
'I','N','S','E','R','T',' ','i','n','t','o',' ', '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','`',' ',
'(','`','_','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','`',')',' ', 'V','A','L','U','E','S',' ','(','?',',','?',')',0};
'V','A','L','U','E','S',' ','(','?',',','?',')',0};
static const WCHAR query_update[] = { static const WCHAR query_update[] = {
'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ', 'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ',
'S','E','T',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ', 'S','E','T',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ',
'W','H','E','R','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','?',0}; '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 ); rc = MSI_DatabaseOpenViewW( package->db, query_select, &view_select );
if (rc != ERROR_SUCCESS) 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 ) UINT msi_set_property( MSIDATABASE *db, LPCWSTR szName, LPCWSTR szValue )
{ {
MSIQUERY *view; static const WCHAR insert_query[] = {
MSIRECORD *row = NULL; 'I','N','S','E','R','T',' ','I','N','T','O',' ',
UINT rc; '`','_','P','r','o','p','e','r','t','y','`',' ',
DWORD sz = 0; '(','`','_','P','r','o','p','e','r','t','y','`',',','`','V','a','l','u','e','`',')',' ',
WCHAR Query[1024]; 'V','A','L','U','E','S',' ','(','?',',','?',')',0};
static const WCHAR update_query[] = {
static const WCHAR Insert[] = { 'U','P','D','A','T','E',' ','`','_','P','r','o','p','e','r','t','y','`',' ',
'I','N','S','E','R','T',' ','i','n','t','o',' ', 'S','E','T',' ','`','V','a','l','u','e','`',' ','=',' ','?',' ','W','H','E','R','E',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ','(', '`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0};
'`','_','P','r','o','p','e','r','t','y','`',',', static const WCHAR delete_query[] = {
'`','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[] = {
'D','E','L','E','T','E',' ','F','R','O','M',' ', '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','`',' ','W','H','E','R','E',' ',
'`','_','P','r','o','p','e','r','t','y','`',' ','=',' ','\'','%','s','\'',0}; '`','_','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)); 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); rc = msi_get_property(db, szName, 0, &sz);
if (!szValue || !*szValue) if (!szValue || !*szValue)
{ {
sprintfW(Query, Delete, szName); sprintfW(query, delete_query, szName);
} }
else if (rc == ERROR_MORE_DATA || rc == ERROR_SUCCESS) else if (rc == ERROR_MORE_DATA || rc == ERROR_SUCCESS)
{ {
sprintfW(Query, Update, szName); sprintfW(query, update_query, szName);
row = MSI_CreateRecord(1); row = MSI_CreateRecord(1);
MSI_RecordSetStringW(row, 1, szValue); MSI_RecordSetStringW(row, 1, szValue);
} }
else else
{ {
strcpyW(Query, Insert); strcpyW(query, insert_query);
row = MSI_CreateRecord(2); row = MSI_CreateRecord(2);
MSI_RecordSetStringW(row, 1, szName); MSI_RecordSetStringW(row, 1, szName);
MSI_RecordSetStringW(row, 2, szValue); MSI_RecordSetStringW(row, 2, szValue);
} }
rc = MSI_DatabaseOpenViewW(db, Query, &view); rc = MSI_DatabaseOpenViewW(db, query, &view);
if (rc == ERROR_SUCCESS) if (rc == ERROR_SUCCESS)
{ {
rc = MSI_ViewExecute(view, row); rc = MSI_ViewExecute(view, row);
MSI_ViewClose(view); MSI_ViewClose(view);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
} }
if (row) msiobj_release(&row->hdr);
if (row)
msiobj_release(&row->hdr);
return rc; 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 ) static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name )
{ {
MSIQUERY *view;
MSIRECORD *rec, *row = NULL;
UINT r;
static const WCHAR query[]= { static const WCHAR query[]= {
'S','E','L','E','C','T',' ','`','V','a','l','u','e','`',' ', 'S','E','L','E','C','T',' ','`','V','a','l','u','e','`',' ',
'F','R','O','M',' ' ,'`','_','P','r','o','p','e','r','t','y','`', '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','`', 'W','H','E','R','E',' ' ,'`','_','P','r','o','p','e','r','t','y','`','=','?',0};
'=','?',0}; MSIRECORD *rec, *row = NULL;
MSIQUERY *view;
UINT r;
if (!name || !*name) if (!name || !*name)
return NULL; return NULL;
@ -2080,7 +2069,6 @@ static MSIRECORD *msi_get_property_row( MSIDATABASE *db, LPCWSTR name )
MSI_ViewClose(view); MSI_ViewClose(view);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
} }
msiobj_release(&rec->hdr); msiobj_release(&rec->hdr);
return row; return row;
} }

View File

@ -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 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',' ', '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',' ','<','=',' ','?',' ', '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}; '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; MSIRECORD *rec;
UINT r; UINT r;
r = MSI_DatabaseOpenViewW( db, query_patch, &view ); r = MSI_DatabaseOpenViewW( db, query, &view );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return; 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 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',' ', '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',' ','<','=',' ','?',' ', '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}; '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; MSIRECORD *rec;
UINT r; UINT r;
r = MSI_DatabaseOpenViewW( db, query_files, &view ); r = MSI_DatabaseOpenViewW( db, query, &view );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return; 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 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',' ', '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',' ','>','=',' ','?',' ', 'W','H','E','R','E',' ','S','e','q','u','e','n','c','e',' ','>','=',' ','?',' ',
'A','N','D',' ','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; MSIQUERY *view;
UINT r; UINT r;
r = MSI_DatabaseOpenViewW( db, query_files, &view ); r = MSI_DatabaseOpenViewW( db, query, &view );
if (r != ERROR_SUCCESS) if (r != ERROR_SUCCESS)
return ERROR_SUCCESS; return ERROR_SUCCESS;

View File

@ -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 ) static UINT msi_addstreamW( MSIDATABASE *db, LPCWSTR name, IStream *data )
{ {
UINT r;
MSIQUERY *query = NULL;
MSIRECORD *rec = NULL;
static const WCHAR insert[] = { static const WCHAR insert[] = {
'I','N','S','E','R','T',' ','I','N','T','O',' ', 'I','N','S','E','R','T',' ','I','N','T','O',' ',
'`','_','S','t','r','e','a','m','s','`',' ', '`','_','S','t','r','e','a','m','s','`',' ',
'(','`','N','a','m','e','`',',', '(','`','N','a','m','e','`',',','`','D','a','t','a','`',')',' ',
'`','D','a','t','a','`',')',' ', 'V','A','L','U','E','S',' ','(','?',',','?',')',0};
'V','A','L','U','E','S',' ','(','?',',','?',')',0}; MSIQUERY *query = NULL;
MSIRECORD *rec;
UINT r;
TRACE("%p %s %p\n", db, debugstr_w(name), data); 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: err:
msiobj_release( &query->hdr ); msiobj_release( &query->hdr );
msiobj_release( &rec->hdr ); msiobj_release( &rec->hdr );
return r; return r;
} }

View File

@ -205,18 +205,17 @@ static UINT ITERATE_FindRelatedProducts(MSIRECORD *rec, LPVOID param)
UINT ACTION_FindRelatedProducts(MSIPACKAGE *package) UINT ACTION_FindRelatedProducts(MSIPACKAGE *package)
{ {
static const WCHAR Query[] = static const WCHAR query[] = {
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M', 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
' ','`','U','p','g','r','a','d','e','`',0}; '`','U','p','g','r','a','d','e','`',0};
UINT rc = ERROR_SUCCESS;
MSIQUERY *view; MSIQUERY *view;
UINT rc;
if (msi_get_property_int(package->db, szInstalled, 0)) if (msi_get_property_int(package->db, szInstalled, 0))
{ {
TRACE("Skipping FindRelatedProducts action: product already installed\n"); TRACE("Skipping FindRelatedProducts action: product already installed\n");
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
if (msi_action_is_unique(package, szFindRelatedProducts)) if (msi_action_is_unique(package, szFindRelatedProducts))
{ {
TRACE("Skipping FindRelatedProducts action: already done in UI sequence\n"); TRACE("Skipping FindRelatedProducts action: already done in UI sequence\n");
@ -225,12 +224,11 @@ UINT ACTION_FindRelatedProducts(MSIPACKAGE *package)
else else
msi_register_unique_action(package, szFindRelatedProducts); msi_register_unique_action(package, szFindRelatedProducts);
rc = MSI_DatabaseOpenViewW(package->db, Query, &view); rc = MSI_DatabaseOpenViewW(package->db, query, &view);
if (rc != ERROR_SUCCESS) if (rc != ERROR_SUCCESS)
return ERROR_SUCCESS; return ERROR_SUCCESS;
rc = MSI_IterateRecords(view, NULL, ITERATE_FindRelatedProducts, package); rc = MSI_IterateRecords(view, NULL, ITERATE_FindRelatedProducts, package);
msiobj_release(&view->hdr); msiobj_release(&view->hdr);
return rc; return rc;
} }