msi: Allow the not-equal operator in WHERE query string comparisons.

This commit is contained in:
James Hawkins 2007-12-21 23:13:30 -06:00 committed by Alexandre Julliard
parent 3c0f7ca4e6
commit 58c7fe1095
2 changed files with 58 additions and 6 deletions

View File

@ -3899,13 +3899,63 @@ static void test_select_markers(void)
r = MsiViewFetch(view, &res);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
r = MsiViewClose(view);
ok(r == ERROR_SUCCESS, "MsiViewClose failed\n");
r = MsiCloseHandle(view);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
r = MsiCloseHandle(hdb);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
MsiCloseHandle(rec);
MsiViewClose(view);
MsiCloseHandle(view);
rec = MsiCreateRecord(2);
MsiRecordSetString(rec, 1, "one");
MsiRecordSetInteger(rec, 2, 1);
query = "SELECT * FROM `Table` WHERE `Two`<>? AND `Three`>? ORDER BY `Three`";
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);
r = MsiViewFetch(view, &res);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetString(res, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmp(buf, "apple"), "Expected apple, got %s\n", buf);
size = MAX_PATH;
r = MsiRecordGetString(res, 2, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmp(buf, "two"), "Expected two, got %s\n", buf);
r = MsiRecordGetInteger(res, 3);
ok(r == 2, "Expected 2, got %d\n", r);
MsiCloseHandle(res);
r = MsiViewFetch(view, &res);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
size = MAX_PATH;
r = MsiRecordGetString(res, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmp(buf, "banana"), "Expected banana, got %s\n", buf);
size = MAX_PATH;
r = MsiRecordGetString(res, 2, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
ok(!lstrcmp(buf, "three"), "Expected three, got %s\n", buf);
r = MsiRecordGetInteger(res, 3);
ok(r == 3, "Expected 3, got %d\n", r);
MsiCloseHandle(res);
r = MsiViewFetch(view, &res);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiCloseHandle(rec);
MsiViewClose(view);
MsiCloseHandle(view);
MsiCloseHandle(hdb);
DeleteFile(msifile);
}

View File

@ -286,6 +286,7 @@ static UINT STRCMP_Evaluate( MSIWHEREVIEW *wv, UINT row, const struct expr *cond
sr = lstrcmpW( l_str, r_str );
*val = ( cond->u.expr.op == OP_EQ && ( sr == 0 ) ) ||
( cond->u.expr.op == OP_NE && ( sr != 0 ) ) ||
( cond->u.expr.op == OP_LT && ( sr < 0 ) ) ||
( cond->u.expr.op == OP_GT && ( sr > 0 ) );
@ -617,6 +618,7 @@ static UINT WHERE_VerifyCondition( MSIDATABASE *db, MSIVIEW *table, struct expr
case OP_EQ:
case OP_GT:
case OP_LT:
case OP_NE:
break;
default:
*valid = FALSE;