msi: Add some more test cases for INSERT.

This commit is contained in:
Mike McCormack 2006-06-12 17:57:27 +09:00 committed by Alexandre Julliard
parent 7f64332d11
commit a28ebdf7d4
1 changed files with 38 additions and 0 deletions

View File

@ -162,6 +162,44 @@ static void test_msiinsert(void)
r = do_query(hdb, query, &hrec); r = do_query(hdb, query, &hrec);
ok(r == ERROR_NO_MORE_ITEMS, "MsiViewFetch failed\n"); ok(r == ERROR_NO_MORE_ITEMS, "MsiViewFetch failed\n");
todo_wine {
/* now try a few bad INSERT xqueries */
query = "INSERT INTO `phone` ( `id`, `name`, `number` )"
"VALUES(?, ?)";
r = MsiDatabaseOpenView(hdb, query, &hview);
ok(r == ERROR_BAD_QUERY_SYNTAX, "MsiDatabaseOpenView failed\n");
if (r == ERROR_SUCCESS)
r = MsiCloseHandle(hview);
}
/* construct a record to insert */
hrec = MsiCreateRecord(4);
r = MsiRecordSetInteger(hrec, 1, 2);
ok(r == ERROR_SUCCESS, "MsiRecordSetInteger failed\n");
r = MsiRecordSetString(hrec, 2, "Adam");
ok(r == ERROR_SUCCESS, "MsiRecordSetString failed\n");
r = MsiRecordSetString(hrec, 3, "96905305");
ok(r == ERROR_SUCCESS, "MsiRecordSetString failed\n");
/* insert another value, using a record and wildcards */
query = "INSERT INTO `phone` ( `id`, `name`, `number` )"
"VALUES(?, ?, ?)";
r = MsiDatabaseOpenView(hdb, query, &hview);
ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n");
if (r == ERROR_SUCCESS)
{
r = MsiViewExecute(hview, hrec);
ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n");
r = MsiViewClose(hview);
ok(r == ERROR_SUCCESS, "MsiViewClose failed\n");
r = MsiCloseHandle(hview);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
}
r = MsiCloseHandle(hrec);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
r = MsiViewFetch(0, NULL); r = MsiViewFetch(0, NULL);
ok(r == ERROR_INVALID_PARAMETER, "MsiViewFetch failed\n"); ok(r == ERROR_INVALID_PARAMETER, "MsiViewFetch failed\n");