msi: Test that a query on a join of two tables returns data from the correct table.
This commit is contained in:
parent
cc366e1282
commit
07c321ba73
|
@ -1566,6 +1566,101 @@ static void test_binary(void)
|
|||
DeleteFile( msifile );
|
||||
}
|
||||
|
||||
static void test_where_not_in_selected(void)
|
||||
{
|
||||
MSIHANDLE hdb = 0, rec, view;
|
||||
LPCSTR query;
|
||||
UINT r;
|
||||
|
||||
hdb = create_db();
|
||||
ok( hdb, "failed to create db\n");
|
||||
|
||||
r = run_query(hdb, 0,
|
||||
"CREATE TABLE `IESTable` ("
|
||||
"`Action` CHAR(64), "
|
||||
"`Condition` CHAR(64), "
|
||||
"`Sequence` LONG PRIMARY KEY `Sequence`)");
|
||||
ok( r == S_OK, "Cannot create IESTable table: %d\n", r);
|
||||
|
||||
r = run_query(hdb, 0,
|
||||
"CREATE TABLE `CATable` ("
|
||||
"`Action` CHAR(64), "
|
||||
"`Type` LONG PRIMARY KEY `Type`)");
|
||||
ok( r == S_OK, "Cannot create CATable table: %d\n", r);
|
||||
|
||||
r = run_query(hdb, 0, "INSERT INTO `IESTable` "
|
||||
"( `Action`, `Condition`, `Sequence`) "
|
||||
"VALUES ( 'clean', 'cond4', 4)");
|
||||
ok( r == S_OK, "cannot add entry to IESTable table:%d\n", r );
|
||||
|
||||
r = run_query(hdb, 0, "INSERT INTO `IESTable` "
|
||||
"( `Action`, `Condition`, `Sequence`) "
|
||||
"VALUES ( 'depends', 'cond1', 1)");
|
||||
ok( r == S_OK, "cannot add entry to IESTable table:%d\n", r );
|
||||
|
||||
r = run_query(hdb, 0, "INSERT INTO `IESTable` "
|
||||
"( `Action`, `Condition`, `Sequence`) "
|
||||
"VALUES ( 'build', 'cond2', 2)");
|
||||
ok( r == S_OK, "cannot add entry to IESTable table:%d\n", r );
|
||||
|
||||
r = run_query(hdb, 0, "INSERT INTO `IESTable` "
|
||||
"( `Action`, `Condition`, `Sequence`) "
|
||||
"VALUES ( 'build2', 'cond6', 6)");
|
||||
ok( r == S_OK, "cannot add entry to IESTable table:%d\n", r );
|
||||
|
||||
r = run_query(hdb, 0, "INSERT INTO `IESTable` "
|
||||
"( `Action`, `Condition`, `Sequence`) "
|
||||
"VALUES ( 'build', 'cond3', 3)");
|
||||
ok(r == S_OK, "cannot add entry to IESTable table:%d\n", r );
|
||||
|
||||
r = run_query(hdb, 0, "INSERT INTO `CATable` "
|
||||
"( `Action`, `Type` ) "
|
||||
"VALUES ( 'build', 32)");
|
||||
ok(r == S_OK, "cannot add entry to CATable table:%d\n", r );
|
||||
|
||||
r = run_query(hdb, 0, "INSERT INTO `CATable` "
|
||||
"( `Action`, `Type` ) "
|
||||
"VALUES ( 'depends', 64)");
|
||||
ok(r == S_OK, "cannot add entry to CATable table:%d\n", r );
|
||||
|
||||
r = run_query(hdb, 0, "INSERT INTO `CATable` "
|
||||
"( `Action`, `Type` ) "
|
||||
"VALUES ( 'clean', 63)");
|
||||
ok(r == S_OK, "cannot add entry to CATable table:%d\n", r );
|
||||
|
||||
r = run_query(hdb, 0, "INSERT INTO `CATable` "
|
||||
"( `Action`, `Type` ) "
|
||||
"VALUES ( 'build2', 34)");
|
||||
ok(r == S_OK, "cannot add entry to CATable table:%d\n", r );
|
||||
query = "Select IESTable.Condition from CATable, IESTable where "
|
||||
"CATable.Action = IESTable.Action and CATable.Type = 32";
|
||||
r = MsiDatabaseOpenView(hdb, query, &view);
|
||||
ok( r == ERROR_SUCCESS, "failed to open view: %d\n", r );
|
||||
|
||||
r = MsiViewExecute(view, 0);
|
||||
ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
|
||||
|
||||
r = MsiViewFetch(view, &rec);
|
||||
ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r );
|
||||
|
||||
ok( check_record( rec, 1, "cond2"), "wrong condition\n");
|
||||
|
||||
MsiCloseHandle( rec );
|
||||
r = MsiViewFetch(view, &rec);
|
||||
ok( r == ERROR_SUCCESS, "failed to fetch view: %d\n", r );
|
||||
|
||||
ok( check_record( rec, 1, "cond3"), "wrong condition\n");
|
||||
|
||||
MsiCloseHandle( rec );
|
||||
MsiViewClose(view);
|
||||
MsiCloseHandle(view);
|
||||
|
||||
MsiCloseHandle( hdb );
|
||||
DeleteFile(msifile);
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void test_where(void)
|
||||
{
|
||||
MSIHANDLE hdb = 0, rec, view;
|
||||
|
@ -8450,6 +8545,7 @@ START_TEST(db)
|
|||
test_longstrings();
|
||||
test_streamtable();
|
||||
test_binary();
|
||||
test_where_not_in_selected();
|
||||
test_where();
|
||||
test_msiimport();
|
||||
test_binary_import();
|
||||
|
|
Loading…
Reference in New Issue