Fix selecting string columns and matching against a wildcard.

This commit is contained in:
Mike McCormack 2004-12-22 15:22:12 +00:00 committed by Alexandre Julliard
parent ee0344a4a2
commit 1bd8d8a55a
3 changed files with 20 additions and 6 deletions

View File

@ -52,6 +52,7 @@
#define EXPR_STRCMP 7
#define EXPR_UTF8 8
#define EXPR_WILDCARD 9
#define EXPR_COL_NUMBER_STRING 10
struct sql_str {
LPCWSTR data;

View File

@ -1088,7 +1088,7 @@ static UINT TABLE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT *
return ERROR_FUNCTION_FAILED;
}
TRACE("Data [%d][%d] = %d \n", row, col, *val );
/* TRACE("Data [%d][%d] = %d \n", row, col, *val ); */
return ERROR_SUCCESS;
}

View File

@ -137,7 +137,7 @@ static const WCHAR *STRING_evaluate( string_table *st,
switch( expr->type )
{
case EXPR_COL_NUMBER:
case EXPR_COL_NUMBER_STRING:
r = table->ops->fetch_int( table, row, expr->u.col_number, &val );
if( r != ERROR_SUCCESS )
return NULL;
@ -190,6 +190,7 @@ static UINT WHERE_evaluate( MSIDATABASE *db, MSIVIEW *table, UINT row,
switch( cond->type )
{
case EXPR_COL_NUMBER_STRING:
case EXPR_COL_NUMBER:
return table->ops->fetch_int( table, row, cond->u.col_number, val );
@ -368,9 +369,19 @@ static UINT WHERE_VerifyCondition( MSIDATABASE *db, MSIVIEW *table, struct expr
r = VIEW_find_column( table, cond->u.column, &val );
if( r == ERROR_SUCCESS )
{
*valid = 1;
cond->type = EXPR_COL_NUMBER;
cond->u.col_number = val;
UINT type = 0;
r = table->ops->get_column_info( table, val, NULL, &type );
if( r == ERROR_SUCCESS )
{
if (type&MSITYPE_STRING)
cond->type = EXPR_COL_NUMBER_STRING;
else
cond->type = EXPR_COL_NUMBER;
cond->u.col_number = val;
*valid = 1;
}
else
*valid = 0;
}
else
{
@ -390,7 +401,9 @@ static UINT WHERE_VerifyCondition( MSIDATABASE *db, MSIVIEW *table, struct expr
/* check the type of the comparison */
if( ( cond->u.expr.left->type == EXPR_SVAL ) ||
( cond->u.expr.right->type == EXPR_SVAL ) )
( cond->u.expr.left->type == EXPR_COL_NUMBER_STRING ) ||
( cond->u.expr.right->type == EXPR_SVAL ) ||
( cond->u.expr.right->type == EXPR_COL_NUMBER_STRING ) )
{
switch( cond->u.expr.op )
{