From 5e81dbebb07fb82131f2e1944797e70b53429b7f Mon Sep 17 00:00:00 2001 From: James Hawkins Date: Sun, 29 Jul 2007 21:23:19 -0700 Subject: [PATCH] msi: 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 deletion(-) diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 3e38f20ab80..89cc48a2e62 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 5104e670f5c..ecca17aa732 100644 --- a/dlls/msi/where.c +++ b/dlls/msi/where.c @@ -192,7 +192,8 @@ static UINT STRCMP_Evaluate( MSIWHEREVIEW *wv, UINT row, const struct expr *cond 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;