Commit 6c95dc64 authored by Mike McCormack's avatar Mike McCormack Committed by Alexandre Julliard

msi: Allow UPDATE queries without a condition.

parent 15bfb30f
......@@ -214,13 +214,23 @@ oneupdate:
TK_UPDATE table TK_SET update_assign_list TK_WHERE expr
{
SQL_input* sql = (SQL_input*) info;
MSIVIEW *update = NULL;
MSIVIEW *update = NULL;
UPDATE_CreateView( sql->db, &update, $2, $4, $6 );
if( !update )
YYABORT;
$$ = update;
}
| TK_UPDATE table TK_SET update_assign_list
{
SQL_input* sql = (SQL_input*) info;
MSIVIEW *update = NULL;
UPDATE_CreateView( sql->db, &update, $2, $4, NULL );
if( !update )
YYABORT;
$$ = update;
}
;
onedelete:
......
......@@ -3093,17 +3093,14 @@ static void test_update(void)
/* no where condition */
query = "UPDATE `Control` SET `Text` = 'this is text'";
todo_wine
{
r = MsiDatabaseOpenView(hdb, query, &view);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCESS, got %d\n", r);
r = MsiViewExecute(view, 0);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, 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 = MsiDatabaseOpenView(hdb, query, &view);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCESS, got %d\n", r);
r = MsiViewExecute(view, 0);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
r = MsiViewClose(view);
ok(r == ERROR_SUCCESS, "MsiViewClose failed\n");
r = MsiCloseHandle(view);
ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n");
/* check the modified text */
query = "SELECT `Text` FROM `Control`";
......@@ -3138,10 +3135,7 @@ static void test_update(void)
size = MAX_PATH;
r = MsiRecordGetString(rec, 1, result, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
todo_wine
{
ok(!lstrcmp(result, "this is text"), "Expected `this is text`, got %s\n", result);
}
ok(!lstrcmp(result, "this is text"), "Expected `this is text`, got %s\n", result);
MsiCloseHandle(rec);
......
......@@ -199,14 +199,19 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
if( r != ERROR_SUCCESS )
return r;
/* add conditions first */
r = WHERE_CreateView( db, &wv, tv, expr );
if( r != ERROR_SUCCESS )
if (expr)
{
tv->ops->delete( tv );
return r;
/* add conditions first */
r = WHERE_CreateView( db, &wv, tv, expr );
if( r != ERROR_SUCCESS )
{
tv->ops->delete( tv );
return r;
}
}
else
wv = tv;
/* then select the columns we want */
r = SELECT_CreateView( db, &sv, wv, columns );
if( r != ERROR_SUCCESS )
......
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