Commit a52c2bf9 authored by Bernhard Loos's avatar Bernhard Loos Committed by Alexandre Julliard

msi: Make WHEREVIEW able to deal directly with multiple tables.

parent 9b79fd57
......@@ -68,10 +68,19 @@ struct complex_expr
struct expr *right;
};
struct ext_column
struct tagJOINTABLE;
union ext_column
{
LPCWSTR column;
LPCWSTR table;
struct
{
LPCWSTR column;
LPCWSTR table;
} unparsed;
struct
{
UINT column;
struct tagJOINTABLE *table;
} parsed;
};
struct expr
......@@ -83,8 +92,7 @@ struct expr
INT ival;
UINT uval;
LPCWSTR sval;
struct ext_column column;
UINT col_number;
union ext_column column;
} u;
};
......@@ -101,7 +109,7 @@ UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) DECL
UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
column_info *columns ) DECLSPEC_HIDDEN;
UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
UINT WHERE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR tables,
struct expr *cond ) DECLSPEC_HIDDEN;
UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
......@@ -110,7 +118,7 @@ UINT CREATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
UINT INSERT_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
column_info *columns, column_info *values, BOOL temp ) DECLSPEC_HIDDEN;
UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
column_info *list, struct expr *expr ) DECLSPEC_HIDDEN;
UINT DELETE_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table ) DECLSPEC_HIDDEN;
......
......@@ -478,13 +478,13 @@ selcollist:
from:
fromtable
| fromtable TK_WHERE expr
| TK_FROM tablelist TK_WHERE expr
{
SQL_input* sql = (SQL_input*) info;
MSIVIEW* where = NULL;
UINT r;
r = WHERE_CreateView( sql->db, &where, $1, $3 );
r = WHERE_CreateView( sql->db, &where, $2, $4 );
if( r != ERROR_SUCCESS )
YYABORT;
......@@ -877,8 +877,8 @@ static struct expr * EXPR_column( void *info, const column_info *column )
if( e )
{
e->type = EXPR_COLUMN;
e->u.column.column = column->column;
e->u.column.table = column->table;
e->u.column.unparsed.column = column->column;
e->u.column.unparsed.table = column->table;
}
return e;
}
......
......@@ -3895,7 +3895,7 @@ static void test_join(void)
/* primary key cannot be updated */
r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec);
todo_wine ok( r == ERROR_FUNCTION_FAILED, "failed to update row: %d\n", r );
ok( r == ERROR_FUNCTION_FAILED, "failed to update row: %d\n", r );
MsiCloseHandle(hrec);
MsiViewClose(hview);
......
......@@ -225,31 +225,22 @@ static const MSIVIEWOPS update_ops =
NULL,
};
UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
column_info *columns, struct expr *expr )
{
MSIUPDATEVIEW *uv = NULL;
UINT r;
MSIVIEW *tv = NULL, *sv = NULL, *wv = NULL;
MSIVIEW *sv = NULL, *wv = NULL;
TRACE("%p\n", uv );
r = TABLE_CreateView( db, table, &tv );
if( r != ERROR_SUCCESS )
return r;
if (expr)
{
/* add conditions first */
r = WHERE_CreateView( db, &wv, tv, expr );
if( r != ERROR_SUCCESS )
{
tv->ops->delete( tv );
return r;
}
}
r = WHERE_CreateView( db, &wv, table, expr );
else
wv = tv;
r = TABLE_CreateView( db, table, &wv );
if( r != ERROR_SUCCESS )
return r;
/* then select the columns we want */
r = SELECT_CreateView( db, &sv, wv, columns );
......
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