Commit 342fcb61 authored by Andoni Morales Alastruey's avatar Andoni Morales Alastruey Committed by Alexandre Julliard

msi: Implement MSIMODIFY_MERGE function in TABLE_modify.

parent e08a7a61
......@@ -1766,7 +1766,7 @@ static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
MSIRECORD *rec, UINT row)
{
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
UINT r, column;
UINT r, frow, column;
TRACE("%p %d %p\n", view, eModifyMode, rec );
......@@ -1811,8 +1811,18 @@ static UINT TABLE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
r = msi_table_assign( view, rec );
break;
case MSIMODIFY_REPLACE:
case MSIMODIFY_MERGE:
/* check row that matches this record */
r = msi_table_find_row( tv, rec, &frow, &column );
if (r != ERROR_SUCCESS)
{
r = table_validate_new( tv, rec, NULL );
if (r == ERROR_SUCCESS)
r = TABLE_insert_row( view, rec, -1, FALSE );
}
break;
case MSIMODIFY_REPLACE:
case MSIMODIFY_VALIDATE:
case MSIMODIFY_VALIDATE_FIELD:
case MSIMODIFY_VALIDATE_DELETE:
......
......@@ -923,6 +923,30 @@ static void test_viewmodify(void)
r = MsiViewModify(hview, MSIMODIFY_INSERT_TEMPORARY, hrec );
ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n");
/* try to merge the same record */
r = MsiViewExecute(hview, 0);
ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
r = MsiViewModify(hview, MSIMODIFY_MERGE, hrec );
ok(r == ERROR_SUCCESS, "MsiViewModify failed\n");
r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "failed to close record\n");
/* try merging a new record */
hrec = MsiCreateRecord(3);
r = MsiRecordSetInteger(hrec, 1, 10);
ok(r == ERROR_SUCCESS, "failed to set integer\n");
r = MsiRecordSetString(hrec, 2, "pepe");
ok(r == ERROR_SUCCESS, "failed to set string\n");
r = MsiRecordSetString(hrec, 3, "7654321");
ok(r == ERROR_SUCCESS, "failed to set string\n");
r = MsiViewModify(hview, MSIMODIFY_MERGE, hrec );
ok(r == ERROR_SUCCESS, "MsiViewModify failed\n");
r = MsiViewExecute(hview, 0);
ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "failed to close record\n");
......
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