msi 2: Allow non-key columns to be used with the join query [try2]

James Hawkins truiken at gmail.com
Thu Sep 7 20:11:38 CDT 2006


Hi,

This patch includes a test for both cases of non-key columns.  Fixes
bug 4632.  http://bugs.winehq.org/show_bug.cgi?id=4632

Changelog:
* Allow non-key columns to be used with the join query.

 dlls/msi/join.c     |    6 -----
 dlls/msi/tests/db.c |   56 ++++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 46 insertions(+), 16 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/join.c b/dlls/msi/join.c
index 17f04c0..4523158 100644
--- a/dlls/msi/join.c
+++ b/dlls/msi/join.c
@@ -393,16 +393,10 @@ static UINT join_check_condition(MSIJOIN
     if (r != ERROR_SUCCESS)
         return ERROR_FUNCTION_FAILED;
 
-    if (!(type & MSITYPE_KEY))
-        return ERROR_FUNCTION_FAILED;
-
     r = jv->right->ops->get_column_info( jv->right, jv->right_key, NULL, &type );
     if (r != ERROR_SUCCESS)
         return ERROR_FUNCTION_FAILED;
 
-    if (!(type & MSITYPE_KEY))
-        return ERROR_FUNCTION_FAILED;
-
     TRACE("left %s (%u) right %s (%u)\n",
         debugstr_w(cond->u.expr.left->u.column), jv->left_key,
         debugstr_w(cond->u.expr.right->u.column), jv->right_key);
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 7316fb4..9e43258 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -1676,6 +1676,11 @@ static const struct join_res join_res_th
     { "msvcr.dll", "ijklmnop" },
 };
 
+static const struct join_res join_res_fourth[] =
+{
+    { "msvcp.dll.01234", "single.dll.31415" },
+};
+
 static void test_join(void)
 {
     MSIHANDLE hdb, hview, hrec;
@@ -1741,6 +1746,9 @@ static void test_join(void)
     r = add_binary_entry( hdb, "'msvcr.dll.56789', 'ijklmnop'" );
     ok( r == ERROR_SUCCESS, "cannot add binary: %d\n", r );
 
+    r = add_binary_entry( hdb, "'single.dll.31415', 'msvcp.dll'" );
+    ok( r == ERROR_SUCCESS, "cannot add binary: %d\n", r );
+
     query = "SELECT `Component`.`ComponentId`, `FeatureComponents`.`Feature_` "
             "FROM `Component`, `FeatureComponents` "
             "WHERE `Component`.`Component` = `FeatureComponents`.`Component_` "
@@ -1834,16 +1842,10 @@ static void test_join(void)
             "WHERE `StdDlls`.`Binary_` = `Binary`.`Name` "
             "ORDER BY `File`";
     r = MsiDatabaseOpenView(hdb, query, &hview);
-    todo_wine
-    {
-        ok( r == ERROR_SUCCESS, "failed to open view: %d\n", r );
-    }
+    ok( r == ERROR_SUCCESS, "failed to open view: %d\n", r );
 
     r = MsiViewExecute(hview, 0);
-    todo_wine
-    {
-        ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
-    }
+    ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
 
     i = 0;
     while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS)
@@ -1867,11 +1869,45 @@ static void test_join(void)
         MsiCloseHandle(hrec);
     }
 
-    todo_wine
+    ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
+
+    MsiViewClose(hview);
+    MsiCloseHandle(hview);
+
+    query = "SELECT `StdDlls`.`Binary_`, `Binary`.`Name` "
+            "FROM `StdDlls`, `Binary` "
+            "WHERE `StdDlls`.`File` = `Binary`.`Data` "
+            "ORDER BY `Name`";
+    r = MsiDatabaseOpenView(hdb, query, &hview);
+    ok( r == ERROR_SUCCESS, "failed to open view: %d\n", r );
+
+    r = MsiViewExecute(hview, 0);
+    ok( r == ERROR_SUCCESS, "failed to execute view: %d\n", r );
+
+    i = 0;
+    while ((r = MsiViewFetch(hview, &hrec)) == ERROR_SUCCESS)
     {
-        ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
+        count = MsiRecordGetFieldCount( hrec );
+        ok( count == 2, "Expected 2 record fields, got %d\n", count );
+
+        size = MAX_PATH;
+        r = MsiRecordGetString( hrec, 1, buf, &size );
+        ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r );
+        ok( !lstrcmp( buf, join_res_fourth[i].one ),
+            "Expected '%s', got %s\n", join_res_fourth[i].one, buf );
+
+        size = MAX_PATH;
+        r = MsiRecordGetString( hrec, 2, buf, &size );
+        ok( r == ERROR_SUCCESS, "failed to get record string: %d\n", r );
+        ok( !lstrcmp( buf, join_res_fourth[i].two ),
+            "Expected '%s', got %s\n", join_res_fourth[i].two, buf );
+
+        i++;
+        MsiCloseHandle(hrec);
     }
 
+    ok( r == ERROR_NO_MORE_ITEMS, "expected no more items: %d\n", r );
+
     MsiViewClose(hview);
     MsiCloseHandle(hview);
     MsiCloseHandle(hdb);
-- 
1.4.2


More information about the wine-patches mailing list