Skip to content

Commit 4048c06

Browse files
winesynclearn-more
authored andcommitted
[WINESYNC] msi: Support DELETE when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used.
Signed-off-by: Piotr Caban <[email protected]> Signed-off-by: Hans Leidekker <[email protected]> Signed-off-by: Alexandre Julliard <[email protected]> wine commit id b1f9f4ccee6f7d42dbeaf457e81db462a1b526af by Piotr Caban <[email protected]>
1 parent 9d793f2 commit 4048c06

File tree

1 file changed

+51
-2
lines changed

1 file changed

+51
-2
lines changed

dll/win32/msi/table.c

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,7 +2600,15 @@ static UINT TransformView_drop_table( MSITABLEVIEW *tv, UINT row )
26002600

26012601
static UINT TransformView_delete_row( MSIVIEW *view, UINT row )
26022602
{
2603+
static const WCHAR query_pfx[] = L"INSERT INTO `_TransformView` ( `Table`, `Column`, `Row`) VALUES ( '";
2604+
static const WCHAR query_column[] = L"', 'DELETE', '";
2605+
static const WCHAR query_sfx[] = L"')";
2606+
26032607
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
2608+
WCHAR *key, buf[256], *query = buf;
2609+
UINT r, len, name_len, key_len;
2610+
MSIRECORD *rec;
2611+
MSIQUERY *q;
26042612

26052613
if (!wcscmp( tv->name, szColumns ))
26062614
{
@@ -2611,8 +2619,49 @@ static UINT TransformView_delete_row( MSIVIEW *view, UINT row )
26112619
if (!wcscmp( tv->name, szTables ))
26122620
return TransformView_drop_table( tv, row );
26132621

2614-
FIXME("\n");
2615-
return ERROR_CALL_NOT_IMPLEMENTED;
2622+
r = msi_view_get_row( tv->db, view, row, &rec );
2623+
if (r != ERROR_SUCCESS)
2624+
return r;
2625+
2626+
key = create_key_string( tv, rec );
2627+
msiobj_release( &rec->hdr );
2628+
if (!key)
2629+
return ERROR_OUTOFMEMORY;
2630+
2631+
name_len = wcslen( tv->name );
2632+
key_len = wcslen( key );
2633+
len = ARRAY_SIZE(query_pfx) + name_len + ARRAY_SIZE(query_column) + key_len + ARRAY_SIZE(query_sfx) - 2;
2634+
if (len > ARRAY_SIZE(buf))
2635+
{
2636+
query = msi_alloc( len * sizeof(WCHAR) );
2637+
if (!query)
2638+
{
2639+
msi_free( tv );
2640+
msi_free( key );
2641+
return ERROR_OUTOFMEMORY;
2642+
}
2643+
}
2644+
2645+
memcpy( query, query_pfx, ARRAY_SIZE(query_pfx) * sizeof(WCHAR) );
2646+
len = ARRAY_SIZE(query_pfx) - 1;
2647+
memcpy( query + len, tv->name, name_len * sizeof(WCHAR) );
2648+
len += name_len;
2649+
memcpy( query + len, query_column, ARRAY_SIZE(query_column) * sizeof(WCHAR) );
2650+
len += ARRAY_SIZE(query_column) - 1;
2651+
memcpy( query + len, key, key_len * sizeof(WCHAR) );
2652+
len += key_len;
2653+
memcpy( query + len, query_sfx, ARRAY_SIZE(query_sfx) * sizeof(WCHAR) );
2654+
msi_free( key );
2655+
2656+
r = MSI_DatabaseOpenViewW( tv->db, query, &q );
2657+
if (query != buf)
2658+
msi_free( query );
2659+
if (r != ERROR_SUCCESS)
2660+
return r;
2661+
2662+
r = MSI_ViewExecute( q, NULL );
2663+
msiobj_release( &q->hdr );
2664+
return r;
26162665
}
26172666

26182667
static UINT TransformView_execute( MSIVIEW *view, MSIRECORD *record )

0 commit comments

Comments
 (0)