msi 3: Treat an empty string and a NULL string as the same value

James Hawkins truiken at gmail.com
Sun Jul 29 23:17:36 CDT 2007


Hi,

Changelog:
* Treat an empty string and a NULL string as the same value.

 dlls/msi/tests/db.c |   18 ++++++++++++++++++
 dlls/msi/where.c    |    3 ++-
 2 files changed, 20 insertions(+), 1 deletions(-)

-- 
James Hawkins
-------------- next part --------------
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 3e38f20..89cc48a 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -1562,6 +1562,24 @@ static void test_where(void)
     ok( r == ERROR_SUCCESS, "query failed: %d\n", r );
     MsiCloseHandle( rec );
 
+    rec = MsiCreateRecord(1);
+    MsiRecordSetString(rec, 1, "");
+
+    query = "SELECT * FROM `Media` WHERE `DiskPrompt` = ?";
+    r = MsiDatabaseOpenView(hdb, query, &view);
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+    r = MsiViewExecute(view, rec);
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+    MsiCloseHandle(rec);
+
+    r = MsiViewFetch(view, &rec);
+    ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
+
+    MsiCloseHandle(rec);
+    MsiViewClose(view);
+    MsiCloseHandle(view);
+
     MsiCloseHandle( hdb );
     DeleteFile(msifile);
 }
diff --git a/dlls/msi/where.c b/dlls/msi/where.c
index 5104e67..b918ae7 100644
--- a/dlls/msi/where.c
+++ b/dlls/msi/where.c
@@ -192,7 +192,8 @@ static UINT STRCMP_Evaluate( MSIWHEREVIE
 
     l_str = STRING_evaluate( wv, row, cond->u.expr.left, record );
     r_str = STRING_evaluate( wv, row, cond->u.expr.right, record );
-    if( l_str == r_str )
+    if( l_str == r_str )||
+        ((!l_str || !*l_str) && (!r_str || !*r_str)) )
         sr = 0;
     else if( l_str && ! r_str )
         sr = 1;
-- 
1.4.1


More information about the wine-patches mailing list