https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e6af2a5a6152a578aee7a…
commit e6af2a5a6152a578aee7a673d09b94db2db3babc
Author: winesync <ros-dev(a)reactos.org>
AuthorDate: Sun Mar 13 19:08:39 2022 +0100
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Sun Mar 20 19:28:29 2022 +0100
[WINESYNC] msi: Support INSERT INTO when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is
used.
Signed-off-by: Piotr Caban <piotr(a)codeweavers.com>
Signed-off-by: Hans Leidekker <hans(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
wine commit id 9130379710297cb487dbd8891b82f505e754c39d by Piotr Caban
<piotr(a)codeweavers.com>
---
dll/win32/msi/table.c | 39 +++++++++++++++++++++++++++++++++++++--
1 file changed, 37 insertions(+), 2 deletions(-)
diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c
index 56d55d32cc1..e6b5a09375b 100644
--- a/dll/win32/msi/table.c
+++ b/dll/win32/msi/table.c
@@ -2507,7 +2507,15 @@ static UINT TransformView_add_column( MSITABLEVIEW *tv, MSIRECORD
*rec )
static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, BOOL
temporary )
{
+ static const WCHAR query_fmt[] =
+ L"INSERT INTO `_TransformView` (`Table`, `Column`, `Row`) VALUES
('%s', 'INSERT', '%s')";
+
MSITABLEVIEW *tv = (MSITABLEVIEW*)view;
+ WCHAR buf[256], *query = buf;
+ MSIQUERY *q;
+ WCHAR *key;
+ int len;
+ UINT r;
if (!wcscmp(tv->name, szTables))
return TransformView_create_table( tv, rec );
@@ -2515,8 +2523,35 @@ static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD
*rec, UINT row, B
if (!wcscmp(tv->name, szColumns))
return TransformView_add_column( tv, rec );
- FIXME("\n");
- return ERROR_CALL_NOT_IMPLEMENTED;
+ key = create_key_string( tv, rec );
+ if (!key)
+ return ERROR_OUTOFMEMORY;
+
+ len = _snwprintf( NULL, 0, query_fmt, tv->name, key ) + 1;
+ if (len > ARRAY_SIZE(buf))
+ {
+ query = msi_alloc( len * sizeof(WCHAR) );
+ if (!query)
+ {
+ msi_free( key );
+ return ERROR_OUTOFMEMORY;
+ }
+ }
+ swprintf( query, len, query_fmt, tv->name, key );
+ msi_free( key );
+
+ r = MSI_DatabaseOpenViewW( tv->db, query, &q );
+ if (query != buf)
+ msi_free( query );
+ if (r != ERROR_SUCCESS)
+ return r;
+
+ r = MSI_ViewExecute( q, NULL );
+ msiobj_release( &q->hdr );
+ if (r != ERROR_SUCCESS)
+ return r;
+
+ return TransformView_set_row( view, row, rec, ~0 );
}
static UINT TransformView_delete_row( MSIVIEW *view, UINT row )