Skip to content

Commit 9d793f2

Browse files
winesynclearn-more
authored andcommitted
[WINESYNC] msi: Support DROP 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 6b6e1bd2c73ac23b03db0e656f895896936df5ba by Piotr Caban <[email protected]>
1 parent e6af2a5 commit 9d793f2

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

dll/win32/msi/table.c

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2554,8 +2554,63 @@ static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, B
25542554
return TransformView_set_row( view, row, rec, ~0 );
25552555
}
25562556

2557+
static UINT TransformView_drop_table( MSITABLEVIEW *tv, UINT row )
2558+
{
2559+
static const WCHAR query_pfx[] = L"INSERT INTO `_TransformView` ( `Table`, `Column` ) VALUES ( '";
2560+
static const WCHAR query_sfx[] = L"', 'DROP' )";
2561+
2562+
WCHAR buf[256], *query = buf;
2563+
UINT r, table_id, len;
2564+
const WCHAR *table;
2565+
int table_len;
2566+
MSIQUERY *q;
2567+
2568+
r = TABLE_fetch_int( &tv->view, row, 1, &table_id );
2569+
if (r != ERROR_SUCCESS)
2570+
return r;
2571+
2572+
table = msi_string_lookup( tv->db->strings, table_id, &table_len );
2573+
if (!table)
2574+
return ERROR_INSTALL_TRANSFORM_FAILURE;
2575+
2576+
len = ARRAY_SIZE(query_pfx) - 1 + table_len + ARRAY_SIZE(query_sfx);
2577+
if (len > ARRAY_SIZE(buf))
2578+
{
2579+
query = msi_alloc( len * sizeof(WCHAR) );
2580+
if (!query)
2581+
return ERROR_OUTOFMEMORY;
2582+
}
2583+
2584+
memcpy( query, query_pfx, ARRAY_SIZE(query_pfx) * sizeof(WCHAR) );
2585+
len = ARRAY_SIZE(query_pfx) - 1;
2586+
memcpy( query + len, table, table_len * sizeof(WCHAR) );
2587+
len += table_len;
2588+
memcpy( query + len, query_sfx, ARRAY_SIZE(query_sfx) * sizeof(WCHAR) );
2589+
2590+
r = MSI_DatabaseOpenViewW( tv->db, query, &q );
2591+
if (query != buf)
2592+
msi_free( query );
2593+
if (r != ERROR_SUCCESS)
2594+
return r;
2595+
2596+
r = MSI_ViewExecute( q, NULL );
2597+
msiobj_release( &q->hdr );
2598+
return r;
2599+
}
2600+
25572601
static UINT TransformView_delete_row( MSIVIEW *view, UINT row )
25582602
{
2603+
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
2604+
2605+
if (!wcscmp( tv->name, szColumns ))
2606+
{
2607+
ERR("trying to remove column\n");
2608+
return ERROR_INSTALL_TRANSFORM_FAILURE;
2609+
}
2610+
2611+
if (!wcscmp( tv->name, szTables ))
2612+
return TransformView_drop_table( tv, row );
2613+
25592614
FIXME("\n");
25602615
return ERROR_CALL_NOT_IMPLEMENTED;
25612616
}

0 commit comments

Comments
 (0)