mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
[WINESYNC] msi/tests: Add tests for MsiDatabaseGetPrimaryKeys().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 3a1d9bb915952fd69f16c32cbea29983d9a5a5fc by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
parent
aede536c83
commit
b2b149a09e
1 changed files with 41 additions and 0 deletions
|
@ -9701,6 +9701,46 @@ static void test_select_column_names(void)
|
|||
ok(r == ERROR_SUCCESS , "failed to close database: %u\n", r);
|
||||
}
|
||||
|
||||
static void test_primary_keys(void)
|
||||
{
|
||||
MSIHANDLE hdb, keys;
|
||||
UINT r;
|
||||
|
||||
hdb = create_db();
|
||||
|
||||
r = MsiDatabaseGetPrimaryKeysA(hdb, "T", &keys);
|
||||
ok(r == ERROR_INVALID_TABLE, "got %u\n", r);
|
||||
|
||||
r = run_query(hdb, 0, "CREATE TABLE `T` (`A` SHORT, `B` SHORT, `C` SHORT PRIMARY KEY `A`)");
|
||||
ok(!r, "got %u\n", r);
|
||||
|
||||
r = MsiDatabaseGetPrimaryKeysA(hdb, "T", &keys);
|
||||
ok(!r, "got %u\n", r);
|
||||
|
||||
r = MsiRecordGetFieldCount(keys);
|
||||
ok(r == 1, "got %d\n", r);
|
||||
ok(check_record(keys, 0, "T"), "expected 'T'");
|
||||
ok(check_record(keys, 1, "A"), "expected 'A'");
|
||||
|
||||
MsiCloseHandle(keys);
|
||||
|
||||
r = run_query(hdb, 0, "CREATE TABLE `U` (`A` SHORT, `B` SHORT, `C` SHORT PRIMARY KEY `B`, `C`)");
|
||||
ok(!r, "got %u\n", r);
|
||||
|
||||
r = MsiDatabaseGetPrimaryKeysA(hdb, "U", &keys);
|
||||
ok(!r, "got %u\n", r);
|
||||
|
||||
r = MsiRecordGetFieldCount(keys);
|
||||
ok(r == 2, "got %d\n", r);
|
||||
ok(check_record(keys, 0, "U"), "expected 'U'");
|
||||
ok(check_record(keys, 1, "B"), "expected 'B'");
|
||||
ok(check_record(keys, 2, "C"), "expected 'C'");
|
||||
|
||||
MsiCloseHandle(keys);
|
||||
MsiCloseHandle(hdb);
|
||||
DeleteFileA(msifile);
|
||||
}
|
||||
|
||||
START_TEST(db)
|
||||
{
|
||||
test_msidatabase();
|
||||
|
@ -9756,4 +9796,5 @@ START_TEST(db)
|
|||
test_collation();
|
||||
test_embedded_nulls();
|
||||
test_select_column_names();
|
||||
test_primary_keys();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue