Module: wine Branch: master Commit: 58c7fe1095d01593fee7080c5ed4077ef9a11197 URL: http://source.winehq.org/git/wine.git/?a=commit;h=58c7fe1095d01593fee7080c5e...
Author: James Hawkins truiken@gmail.com Date: Fri Dec 21 23:13:30 2007 -0600
msi: Allow the not-equal operator in WHERE query string comparisons.
---
dlls/msi/tests/db.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++----- dlls/msi/where.c | 2 + 2 files changed, 58 insertions(+), 6 deletions(-)
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 099580d..891139b 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -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); }
diff --git a/dlls/msi/where.c b/dlls/msi/where.c index 258cb32..98eaa62 100644 --- a/dlls/msi/where.c +++ b/dlls/msi/where.c @@ -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;