Commit 58c7fe10 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

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

parent 3c0f7ca4
...@@ -3899,13 +3899,63 @@ static void test_select_markers(void) ...@@ -3899,13 +3899,63 @@ static void test_select_markers(void)
r = MsiViewFetch(view, &res); r = MsiViewFetch(view, &res);
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
r = MsiViewClose(view); MsiCloseHandle(rec);
ok(r == ERROR_SUCCESS, "MsiViewClose failed\n"); MsiViewClose(view);
r = MsiCloseHandle(view); MsiCloseHandle(view);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
r = MsiCloseHandle(hdb); rec = MsiCreateRecord(2);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); 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); DeleteFile(msifile);
} }
......
...@@ -286,6 +286,7 @@ static UINT STRCMP_Evaluate( MSIWHEREVIEW *wv, UINT row, const struct expr *cond ...@@ -286,6 +286,7 @@ static UINT STRCMP_Evaluate( MSIWHEREVIEW *wv, UINT row, const struct expr *cond
sr = lstrcmpW( l_str, r_str ); sr = lstrcmpW( l_str, r_str );
*val = ( cond->u.expr.op == OP_EQ && ( sr == 0 ) ) || *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_LT && ( sr < 0 ) ) ||
( cond->u.expr.op == OP_GT && ( sr > 0 ) ); ( cond->u.expr.op == OP_GT && ( sr > 0 ) );
...@@ -617,6 +618,7 @@ static UINT WHERE_VerifyCondition( MSIDATABASE *db, MSIVIEW *table, struct expr ...@@ -617,6 +618,7 @@ static UINT WHERE_VerifyCondition( MSIDATABASE *db, MSIVIEW *table, struct expr
case OP_EQ: case OP_EQ:
case OP_GT: case OP_GT:
case OP_LT: case OP_LT:
case OP_NE:
break; break;
default: default:
*valid = FALSE; *valid = FALSE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment