From a28ebdf7d4cb6a4ea6dc568bfe1b5ac285055e76 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Mon, 12 Jun 2006 17:57:27 +0900 Subject: [PATCH] msi: Add some more test cases for INSERT. --- dlls/msi/tests/db.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 420e1941511..fc8331b643d 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -162,6 +162,44 @@ static void test_msiinsert(void) r = do_query(hdb, query, &hrec); 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); ok(r == ERROR_INVALID_PARAMETER, "MsiViewFetch failed\n");