msi: Reject greater than and less than string comparisons in WHERE clauses.

This commit is contained in:
Hans Leidekker 2009-12-15 09:50:40 +01:00 committed by Alexandre Julliard
parent d95e58ba4d
commit 6df6332198
2 changed files with 25 additions and 5 deletions

View File

@ -1761,6 +1761,30 @@ static void test_where(void)
ok( r == ERROR_SUCCESS, "query failed: %d\n", r );
MsiCloseHandle( rec );
rec = 0;
query = "SELECT * FROM `Media` WHERE `DiskPrompt` < 'Cabinet'";
r = do_query(hdb, query, &rec);
ok( r == ERROR_BAD_QUERY_SYNTAX, "query failed: %d\n", r );
MsiCloseHandle( rec );
rec = 0;
query = "SELECT * FROM `Media` WHERE `DiskPrompt` > 'Cabinet'";
r = do_query(hdb, query, &rec);
ok( r == ERROR_BAD_QUERY_SYNTAX, "query failed: %d\n", r );
MsiCloseHandle( rec );
rec = 0;
query = "SELECT * FROM `Media` WHERE `DiskPrompt` <> 'Cabinet'";
r = do_query(hdb, query, &rec);
todo_wine ok( r == ERROR_SUCCESS, "query failed: %d\n", r );
MsiCloseHandle( rec );
rec = 0;
query = "SELECT * FROM `Media` WHERE `DiskPrompt` = 'Cabinet'";
r = do_query(hdb, query, &rec);
ok( r == ERROR_NO_MORE_ITEMS, "query failed: %d\n", r );
MsiCloseHandle( rec );
rec = MsiCreateRecord(1);
MsiRecordSetString(rec, 1, "");

View File

@ -309,9 +309,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 ) );
( cond->u.expr.op == OP_NE && ( sr != 0 ) );
return ERROR_SUCCESS;
}
@ -644,8 +642,6 @@ static UINT WHERE_VerifyCondition( MSIDATABASE *db, MSIVIEW *table, struct expr
switch( cond->u.expr.op )
{
case OP_EQ:
case OP_GT:
case OP_LT:
case OP_NE:
break;
default: