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

This commit is contained in:
James Hawkins 2008-01-09 01:36:25 -07:00 committed by Alexandre Julliard
parent 419a8a2426
commit 4b75f33012
4 changed files with 34 additions and 20 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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();
}

View File

@ -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,