Nate Gallaher : msi: Test that a query on a join of two tables returns data from the correct table .
Alexandre Julliard
julliard at winehq.org
Tue Oct 27 09:46:35 CDT 2009
Module: wine
Branch: master
Commit: 07c321ba73bf7d01501668ca4af681843b98de9a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=07c321ba73bf7d01501668ca4af681843b98de9a
Author: Nate Gallaher <ngallaher at deepthought.org>
Date: Sun Oct 18 12:47:02 2009 -0400
msi: Test that a query on a join of two tables returns data from the correct table.
---
dlls/msi/tests/db.c | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 96 insertions(+), 0 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index bfaba17..19cd74c 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -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();
More information about the wine-cvs
mailing list