Commit 4b75f330 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

msi: Actually delete the row data instead of blanking it out.

parent 419a8a24
......@@ -77,7 +77,6 @@ static UINT DELETE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
{
MSIDELETEVIEW *dv = (MSIDELETEVIEW*)view;
UINT r, i, rows = 0, cols = 0;
MSIRECORD *empty;
TRACE("%p %p\n", dv, record);
......@@ -92,17 +91,11 @@ static UINT DELETE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
if( r != ERROR_SUCCESS )
return r;
TRACE("blanking %d rows\n", rows);
empty = MSI_CreateRecord( cols );
if (!empty)
return ERROR_FUNCTION_FAILED;
TRACE("deleting %d rows\n", rows);
/* blank out all the rows that match */
for ( i=0; i<rows; i++ )
dv->table->ops->set_row( dv->table, i, empty, (1<<cols)-1 );
msiobj_release( &empty->hdr );
dv->table->ops->delete_row( dv->table, i );
return ERROR_SUCCESS;
}
......
......@@ -1572,6 +1572,13 @@ static UINT TABLE_delete_row( struct tagMSIVIEW *view, UINT row )
data = tv->table->nonpersistent_data;
}
/* reset the hash tables */
for (i = 0; i < tv->num_cols; i++)
{
msi_free( tv->columns[i].hash_table );
tv->columns[i].hash_table = NULL;
}
if ( row == num_rows - 1 )
return ERROR_SUCCESS;
......
......@@ -4991,7 +4991,7 @@ static void test_viewmodify_delete_temporary(void)
DeleteFileA(msifile);
}
static void test_msidatabasecommit()
static void test_deleterow()
{
MSIHANDLE hdb, hview, hrec;
const char *query;
......@@ -5040,18 +5040,12 @@ static void test_msidatabasecommit()
size = MAX_PATH;
r = MsiRecordGetStringA(hrec, 1, buf, &size);
ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
todo_wine
{
ok(!lstrcmpA(buf, "two"), "Expected two, got %s\n", buf);
}
ok(!lstrcmpA(buf, "two"), "Expected two, got %s\n", buf);
MsiCloseHandle(hrec);
r = MsiViewFetch(hview, &hrec);
todo_wine
{
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
}
ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r);
MsiViewClose(hview);
MsiCloseHandle(hview);
......@@ -5089,5 +5083,5 @@ START_TEST(db)
test_defaultdatabase();
test_order();
test_viewmodify_delete_temporary();
test_msidatabasecommit();
test_deleterow();
}
......@@ -200,6 +200,26 @@ static UINT WHERE_set_row( struct tagMSIVIEW *view, UINT row, MSIRECORD *rec, UI
return wv->table->ops->set_row( wv->table, row, rec, mask );
}
static UINT WHERE_delete_row(struct tagMSIVIEW *view, UINT row)
{
MSIWHEREVIEW *wv = (MSIWHEREVIEW *)view;
UINT r;
TRACE("(%p %d)\n", view, row);
if ( !wv->table )
return ERROR_FUNCTION_FAILED;
if ( row > wv->row_count )
return ERROR_NO_MORE_ITEMS;
r = find_entry_in_hash( wv->reorder, row, &row );
if ( r != ERROR_SUCCESS )
return r;
return wv->table->ops->delete_row( wv->table, row );
}
static INT INT_evaluate_binary( INT lval, UINT op, INT rval )
{
switch( op )
......@@ -549,7 +569,7 @@ static const MSIVIEWOPS where_ops =
WHERE_get_row,
WHERE_set_row,
NULL,
NULL,
WHERE_delete_row,
WHERE_execute,
WHERE_close,
WHERE_get_dimensions,
......
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