msi: Add handling for the MSIMODIFY_UPDATE command.

This commit is contained in:
James Hawkins 2007-07-23 19:20:51 -07:00 committed by Alexandre Julliard
parent 479aca4731
commit f4147ca004
2 changed files with 32 additions and 21 deletions

View File

@ -1532,6 +1532,29 @@ static UINT TABLE_delete_row( struct tagMSIVIEW *view, UINT row )
return ERROR_SUCCESS; return ERROR_SUCCESS;
} }
static UINT msi_table_update(struct tagMSIVIEW *view, MSIRECORD *rec)
{
MSITABLEVIEW *tv = (MSITABLEVIEW *)view;
UINT r, row;
/* FIXME: MsiViewFetch should set rec index 0 to some ID that
* sets the fetched record apart from other records
*/
if (!tv->table)
return ERROR_INVALID_PARAMETER;
r = msi_table_find_row(tv, rec, &row);
if (r != ERROR_SUCCESS)
return ERROR_SUCCESS;
/* the row cannot be changed */
if (row != 0)
return ERROR_FUNCTION_FAILED;
return TABLE_set_row(view, row, rec, (1 << tv->num_cols) - 1);
}
static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode, static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
MSIRECORD *rec) MSIRECORD *rec)
{ {
@ -1553,9 +1576,12 @@ static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
r = TABLE_insert_row( view, rec, TRUE ); r = TABLE_insert_row( view, rec, TRUE );
break; break;
case MSIMODIFY_UPDATE:
r = msi_table_update( view, rec );
break;
case MSIMODIFY_REFRESH: case MSIMODIFY_REFRESH:
case MSIMODIFY_INSERT: case MSIMODIFY_INSERT:
case MSIMODIFY_UPDATE:
case MSIMODIFY_ASSIGN: case MSIMODIFY_ASSIGN:
case MSIMODIFY_REPLACE: case MSIMODIFY_REPLACE:
case MSIMODIFY_MERGE: case MSIMODIFY_MERGE:

View File

@ -832,17 +832,11 @@ static void test_viewmodify(void)
ok(r == ERROR_SUCCESS, "MsiRecordSetString failed\n"); ok(r == ERROR_SUCCESS, "MsiRecordSetString failed\n");
r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec);
todo_wine ok(r == ERROR_SUCCESS, "MsiViewModify failed\n");
{
ok(r == ERROR_SUCCESS, "MsiViewModify failed\n");
}
/* do it again */ /* do it again */
r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec);
todo_wine ok(r == ERROR_SUCCESS, "MsiViewModify failed: %d\n", r);
{
ok(r == ERROR_SUCCESS, "MsiViewModify failed: %d\n", r);
}
/* update the view, primary key */ /* update the view, primary key */
r = MsiRecordSetInteger(hrec, 1, 5); r = MsiRecordSetInteger(hrec, 1, 5);
@ -883,10 +877,7 @@ static void test_viewmodify(void)
sz = sizeof(buffer); sz = sizeof(buffer);
r = MsiRecordGetString(hrec, 3, buffer, &sz); r = MsiRecordGetString(hrec, 3, buffer, &sz);
ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n"); ok(r == ERROR_SUCCESS, "MsiRecordGetString failed\n");
todo_wine ok(!lstrcmp(buffer, "3141592"), "Expected 3141592, got %s\n", buffer);
{
ok(!lstrcmp(buffer, "3141592"), "Expected 3141592, got %s\n", buffer);
}
r = MsiCloseHandle(hrec); r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "failed to close record\n"); ok(r == ERROR_SUCCESS, "failed to close record\n");
@ -965,10 +956,7 @@ static void test_viewmodify(void)
ok(r == ERROR_SUCCESS, "failed to set string\n"); ok(r == ERROR_SUCCESS, "failed to set string\n");
r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec);
todo_wine ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n");
{
ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n");
}
r = MsiCloseHandle(hrec); r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "failed to close record\n"); ok(r == ERROR_SUCCESS, "failed to close record\n");
@ -993,10 +981,7 @@ static void test_viewmodify(void)
ok(r == ERROR_SUCCESS, "failed to set string\n"); ok(r == ERROR_SUCCESS, "failed to set string\n");
r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec);
todo_wine ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n");
{
ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n");
}
r = MsiCloseHandle(hrec); r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "failed to close record\n"); ok(r == ERROR_SUCCESS, "failed to close record\n");