Commit 0b352c7f authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

Use the new helper function MSI_QueryGetRecord.

parent 63098924
...@@ -77,7 +77,6 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source, ...@@ -77,7 +77,6 @@ static UINT HANDLE_CustomType34(MSIPACKAGE *package, LPCWSTR source,
UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
{ {
UINT rc = ERROR_SUCCESS; UINT rc = ERROR_SUCCESS;
MSIQUERY * view;
MSIRECORD * row = 0; MSIRECORD * row = 0;
static const WCHAR ExecSeqQuery[] = static const WCHAR ExecSeqQuery[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
...@@ -89,25 +88,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -89,25 +88,9 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
LPWSTR target; LPWSTR target;
WCHAR *deformated=NULL; WCHAR *deformated=NULL;
rc = MSI_OpenQuery(package->db, &view, ExecSeqQuery, action); row = MSI_QueryGetRecord( package->db, ExecSeqQuery, action );
if (rc != ERROR_SUCCESS) if (!row)
return rc;
rc = MSI_ViewExecute(view, 0);
if (rc != ERROR_SUCCESS)
{
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return rc;
}
rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS)
{
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return ERROR_CALL_NOT_IMPLEMENTED; return ERROR_CALL_NOT_IMPLEMENTED;
}
type = MSI_RecordGetInteger(row,2); type = MSI_RecordGetInteger(row,2);
...@@ -127,8 +110,6 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -127,8 +110,6 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
HeapFree(GetProcessHeap(),0,source); HeapFree(GetProcessHeap(),0,source);
HeapFree(GetProcessHeap(),0,target); HeapFree(GetProcessHeap(),0,target);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
if (!execute) if (!execute)
...@@ -147,8 +128,6 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -147,8 +128,6 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
HeapFree(GetProcessHeap(),0,source); HeapFree(GetProcessHeap(),0,source);
HeapFree(GetProcessHeap(),0,target); HeapFree(GetProcessHeap(),0,target);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
else else
...@@ -202,8 +181,6 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute) ...@@ -202,8 +181,6 @@ UINT ACTION_CustomAction(MSIPACKAGE *package,LPCWSTR action, BOOL execute)
HeapFree(GetProcessHeap(),0,source); HeapFree(GetProcessHeap(),0,source);
HeapFree(GetProcessHeap(),0,target); HeapFree(GetProcessHeap(),0,target);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return rc; return rc;
} }
...@@ -228,7 +205,6 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source, ...@@ -228,7 +205,6 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
{ {
/* write out the file */ /* write out the file */
UINT rc; UINT rc;
MSIQUERY * view;
MSIRECORD * row = 0; MSIRECORD * row = 0;
static const WCHAR fmt[] = static const WCHAR fmt[] =
{'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', {'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ',
...@@ -246,25 +222,9 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source, ...@@ -246,25 +222,9 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
if (the_file == INVALID_HANDLE_VALUE) if (the_file == INVALID_HANDLE_VALUE)
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
rc = MSI_OpenQuery(package->db, &view, fmt, source); row = MSI_QueryGetRecord(package->db, fmt, source);
if (rc != ERROR_SUCCESS) if (!row)
return rc; return ERROR_FUNCTION_FAILED;
rc = MSI_ViewExecute(view, 0);
if (rc != ERROR_SUCCESS)
{
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return rc;
}
rc = MSI_ViewFetch(view,&row);
if (rc != ERROR_SUCCESS)
{
MSI_ViewClose(view);
msiobj_release(&view->hdr);
return rc;
}
do do
{ {
...@@ -284,8 +244,6 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source, ...@@ -284,8 +244,6 @@ static UINT store_binary_to_temp(MSIPACKAGE *package, LPCWSTR source,
CloseHandle(the_file); CloseHandle(the_file);
msiobj_release(&row->hdr); msiobj_release(&row->hdr);
MSI_ViewClose(view);
msiobj_release(&view->hdr);
} }
return ERROR_SUCCESS; return ERROR_SUCCESS;
...@@ -615,37 +573,23 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source, ...@@ -615,37 +573,23 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source,
'W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ', 'W','H','E','R','E',' ','`','E','r','r','o','r','`',' ','=',' ',
'\'','%','s','\'',0 '\'','%','s','\'',0
}; };
MSIQUERY *view = NULL;
MSIRECORD *row = 0; MSIRECORD *row = 0;
UINT r;
LPWSTR deformated = NULL; LPWSTR deformated = NULL;
deformat_string( package, target, &deformated ); deformat_string( package, target, &deformated );
/* first try treat the error as a number */ /* first try treat the error as a number */
r = MSI_OpenQuery( package->db, &view, query, deformated ); row = MSI_QueryGetRecord( package->db, query, deformated );
if( r == ERROR_SUCCESS ) if( row )
{ {
r = MSI_ViewExecute( view, 0 ); LPCWSTR error = MSI_RecordGetString( row, 1 );
if( r == ERROR_SUCCESS ) MessageBoxW( NULL, error, NULL, MB_OK );
{ msiobj_release( &row->hdr );
r = MSI_ViewFetch( view, &row );
if( r == ERROR_SUCCESS )
{
LPCWSTR error = MSI_RecordGetString( row, 1 );
MessageBoxW( NULL, error, NULL, MB_OK );
msiobj_release( &row->hdr );
}
}
MSI_ViewClose( view );
msiobj_release( &view->hdr );
} }
else
if (r != ERROR_SUCCESS )
{
MessageBoxW( NULL, deformated, NULL, MB_OK ); MessageBoxW( NULL, deformated, NULL, MB_OK );
HeapFree( GetProcessHeap(), 0, deformated );
} HeapFree( GetProcessHeap(), 0, deformated );
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
} }
......
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