Module: wine Branch: master Commit: 36b654e69561f0df77a3cfc384c48a79392449b4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=36b654e69561f0df77a3cfc384...
Author: Hans Leidekker hans@codeweavers.com Date: Fri Jan 22 12:49:44 2010 +0100
msi: Add tests for updating rows in join tables.
---
dlls/msi/tests/db.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 57 insertions(+), 3 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 6a2852d..79d0d77 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -3218,9 +3218,6 @@ static void test_join(void) ok( !lstrcmp( buf, join_res_first[i].two ), "For (row %d, column 2) expected '%s', got %s\n", i, join_res_first[i].two, buf );
- r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); - todo_wine ok( r == ERROR_SUCCESS, "failed to modiy view: %d\n", r ); - i++; MsiCloseHandle(hrec); } @@ -3648,6 +3645,63 @@ static void test_join(void) ok( r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r );
+ /* try updating a row in a join table */ + query = "SELECT `Component`.`ComponentId`, `FeatureComponents`.`Feature_` " + "FROM `Component`, `FeatureComponents` " + "WHERE `Component`.`Component` = `FeatureComponents`.`Component_` " + "ORDER BY `Feature_`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok( r == ERROR_SUCCESS, "failed to open view: %d\n", r ); + + r = MsiViewExecute(hview, 0); + ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r ); + + r = MsiViewFetch(hview, &hrec); + ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r ); + + r = MsiRecordSetString( hrec, 1, "epicranius" ); + ok( r == ERROR_SUCCESS, "failed to set string: %d\n", r ); + + r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); + ok( r == ERROR_SUCCESS, "failed to update row: %d\n", r ); + + /* try another valid operation for joins */ + r = MsiViewModify(hview, MSIMODIFY_REFRESH, hrec); + todo_wine ok( r == ERROR_SUCCESS, "failed to refresh row: %d\n", r ); + + /* try an invalid operation for joins */ + r = MsiViewModify(hview, MSIMODIFY_DELETE, hrec); + ok( r == ERROR_FUNCTION_FAILED, "unexpected result: %d\n", r ); + + r = MsiRecordSetString( hrec, 2, "epicranius" ); + ok( r == ERROR_SUCCESS, "failed to set string: %d\n", r ); + + /* primary key cannot be updated */ + r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); + todo_wine ok( r == ERROR_FUNCTION_FAILED, "failed to update row: %d\n", r ); + + MsiCloseHandle(hrec); + MsiViewClose(hview); + MsiCloseHandle(hview); + + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); + + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "MsiViewFetch failed\n"); + + size = MAX_PATH; + r = MsiRecordGetString( hrec, 1, buf, &size ); + ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r ); + ok( !lstrcmp( buf, "epicranius" ), "expected 'epicranius', got %s\n", buf ); + + MsiCloseHandle(hrec); + MsiViewClose(hview); + MsiCloseHandle(hview); + MsiCloseHandle(hdb); DeleteFile(msifile); }