Mike McCormack : msi: Fix where queries on 32bit integer columns.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Jul 25 05:09:47 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 4ab109e507bcf29450da18f5935962e340ebf089
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=4ab109e507bcf29450da18f5935962e340ebf089
Author: Mike McCormack <mike at codeweavers.com>
Date: Tue Jul 25 11:17:56 2006 +0900
msi: Fix where queries on 32bit integer columns.
---
dlls/msi/query.h | 1 +
dlls/msi/tests/db.c | 7 ++-----
dlls/msi/where.c | 26 ++++++++++++++++++--------
3 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/dlls/msi/query.h b/dlls/msi/query.h
index ea32c69..03ebbdd 100644
--- a/dlls/msi/query.h
+++ b/dlls/msi/query.h
@@ -53,6 +53,7 @@ #define EXPR_UVAL 6
#define EXPR_STRCMP 7
#define EXPR_WILDCARD 9
#define EXPR_COL_NUMBER_STRING 10
+#define EXPR_COL_NUMBER32 11
struct sql_str {
LPCWSTR data;
diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 5d03ca4..c268125 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -1029,11 +1029,8 @@ static void test_where(void)
query = "SELECT * FROM `Media` WHERE `LastSequence` >= 1";
r = do_query(hdb, query, &rec);
- todo_wine
- {
- ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %d\n", r);
- ok( check_record( rec, 4, "one.cab"), "wrong cabinet\n");
- }
+ ok(r == ERROR_SUCCESS, "MsiViewFetch failed: %d\n", r);
+ ok( check_record( rec, 4, "one.cab"), "wrong cabinet\n");
MsiCloseHandle( hdb );
DeleteFile(msifile);
diff --git a/dlls/msi/where.c b/dlls/msi/where.c
index 8fbedce..7670bfd 100644
--- a/dlls/msi/where.c
+++ b/dlls/msi/where.c
@@ -99,7 +99,7 @@ static UINT WHERE_set_int( struct tagMSI
return wv->table->ops->set_int( wv->table, row, col, val );
}
-static UINT INT_evaluate( UINT lval, UINT op, UINT rval )
+static INT INT_evaluate( INT lval, UINT op, INT rval )
{
switch( op )
{
@@ -156,7 +156,7 @@ static const WCHAR *STRING_evaluate( str
}
static UINT STRCMP_Evaluate( string_table *st, MSIVIEW *table, UINT row,
- struct expr *cond, UINT *val, MSIRECORD *record )
+ struct expr *cond, INT *val, MSIRECORD *record )
{
int sr;
const WCHAR *l_str, *r_str;
@@ -180,18 +180,25 @@ static UINT STRCMP_Evaluate( string_tabl
}
static UINT WHERE_evaluate( MSIDATABASE *db, MSIVIEW *table, UINT row,
- struct expr *cond, UINT *val, MSIRECORD *record )
+ struct expr *cond, INT *val, MSIRECORD *record )
{
- UINT r, lval, rval;
+ UINT r, tval;
+ INT lval, rval;
if( !cond )
return ERROR_SUCCESS;
switch( cond->type )
{
- case EXPR_COL_NUMBER_STRING:
case EXPR_COL_NUMBER:
- return table->ops->fetch_int( table, row, cond->u.col_number, val );
+ r = table->ops->fetch_int( table, row, cond->u.col_number, &tval );
+ *val = tval - 0x8000;
+ return ERROR_SUCCESS;
+
+ case EXPR_COL_NUMBER32:
+ r = table->ops->fetch_int( table, row, cond->u.col_number, &tval );
+ *val = tval;
+ return r;
case EXPR_UVAL:
*val = cond->u.uval;
@@ -226,7 +233,8 @@ static UINT WHERE_evaluate( MSIDATABASE
static UINT WHERE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
{
MSIWHEREVIEW *wv = (MSIWHEREVIEW*)view;
- UINT count = 0, r, val, i;
+ UINT count = 0, r, i;
+ INT val;
MSIVIEW *table = wv->table;
TRACE("%p %p\n", wv, record);
@@ -440,6 +448,8 @@ static UINT WHERE_VerifyCondition( MSIDA
{
if (type&MSITYPE_STRING)
cond->type = EXPR_COL_NUMBER_STRING;
+ else if ((type&0xff) == 4)
+ cond->type = EXPR_COL_NUMBER32;
else
cond->type = EXPR_COL_NUMBER;
cond->u.col_number = val;
@@ -490,7 +500,7 @@ static UINT WHERE_VerifyCondition( MSIDA
case EXPR_IVAL:
*valid = 1;
cond->type = EXPR_UVAL;
- cond->u.uval = cond->u.ival + (1<<15);
+ cond->u.uval = cond->u.ival;
break;
case EXPR_WILDCARD:
*valid = 1;
More information about the wine-cvs
mailing list