ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2022
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
436 discussions
Start a n
N
ew thread
[reactos] 291/360: [WINESYNC] msi: Fix adding temporary columns.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9cf1ecf2f3813427b4483…
commit 9cf1ecf2f3813427b4483d2498b6d04b51aa5c34 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:42 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:31 2022 +0100 [WINESYNC] msi: Fix adding temporary columns. 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 15b47513a1926a103492e0774396119f57d2e8d5 by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/alter.c | 82 +--------------------------- dll/win32/msi/msipriv.h | 2 +- dll/win32/msi/table.c | 105 ++++++++++++++++++++++++++++-------- modules/rostests/winetests/msi/db.c | 10 +++- 4 files changed, 95 insertions(+), 104 deletions(-) diff --git a/dll/win32/msi/alter.c b/dll/win32/msi/alter.c index 7922171ae25..78f1a3930c7 100644 --- a/dll/win32/msi/alter.c +++ b/dll/win32/msi/alter.c @@ -61,85 +61,6 @@ static UINT ALTER_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, ISt return ERROR_FUNCTION_FAILED; } -static UINT ITERATE_columns(MSIRECORD *row, LPVOID param) -{ - (*(UINT *)param)++; - return ERROR_SUCCESS; -} - -static BOOL check_column_exists(MSIDATABASE *db, LPCWSTR table, LPCWSTR column) -{ - MSIQUERY *view; - MSIRECORD *rec; - UINT r; - - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','_','C','o','l','u','m','n','s','`',' ','W','H','E','R','E',' ', - '`','T','a','b','l','e','`','=','\'','%','s','\'',' ','A','N','D',' ', - '`','N','a','m','e','`','=','\'','%','s','\'',0 - }; - - r = MSI_OpenQuery(db, &view, query, table, column); - if (r != ERROR_SUCCESS) - return FALSE; - - r = MSI_ViewExecute(view, NULL); - if (r != ERROR_SUCCESS) - goto done; - - r = MSI_ViewFetch(view, &rec); - if (r == ERROR_SUCCESS) - msiobj_release(&rec->hdr); - -done: - msiobj_release(&view->hdr); - return (r == ERROR_SUCCESS); -} - -static UINT alter_add_column(MSIALTERVIEW *av) -{ - UINT r, colnum = 1; - MSIQUERY *view; - MSIVIEW *columns; - - static const WCHAR szColumns[] = {'_','C','o','l','u','m','n','s',0}; - static const WCHAR query[] = { - 'S','E','L','E','C','T',' ','*',' ','F','R','O','M',' ', - '`','_','C','o','l','u','m','n','s','`',' ','W','H','E','R','E',' ', - '`','T','a','b','l','e','`','=','\'','%','s','\'',' ','O','R','D','E','R',' ', - 'B','Y',' ','`','N','u','m','b','e','r','`',0 - }; - - r = TABLE_CreateView(av->db, szColumns, &columns); - if (r != ERROR_SUCCESS) - return r; - - if (check_column_exists(av->db, av->colinfo->table, av->colinfo->column)) - { - columns->ops->delete(columns); - return ERROR_BAD_QUERY_SYNTAX; - } - - r = MSI_OpenQuery(av->db, &view, query, av->colinfo->table, av->colinfo->column); - if (r == ERROR_SUCCESS) - { - r = MSI_IterateRecords(view, NULL, ITERATE_columns, &colnum); - msiobj_release(&view->hdr); - if (r != ERROR_SUCCESS) - { - columns->ops->delete(columns); - return r; - } - } - r = columns->ops->add_column(columns, av->colinfo->table, - colnum, av->colinfo->column, - av->colinfo->type, (av->hold == 1)); - - columns->ops->delete(columns); - return r; -} - static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record ) { MSIALTERVIEW *av = (MSIALTERVIEW*)view; @@ -148,7 +69,8 @@ static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record ) TRACE("%p %p\n", av, record); if (av->colinfo) - return alter_add_column(av); + return av->table->ops->add_column(av->table, av->colinfo->column, + av->colinfo->type, av->colinfo->temporary, av->hold == 1); if (av->hold == 1) av->table->ops->add_ref(av->table); diff --git a/dll/win32/msi/msipriv.h b/dll/win32/msi/msipriv.h index 6f2992d10ea..97126e39693 100644 --- a/dll/win32/msi/msipriv.h +++ b/dll/win32/msi/msipriv.h @@ -337,7 +337,7 @@ typedef struct tagMSIVIEWOPS /* * add_column - adds a column to the table */ - UINT (*add_column)( struct tagMSIVIEW *view, LPCWSTR table, UINT number, LPCWSTR column, UINT type, BOOL hold ); + UINT (*add_column)( struct tagMSIVIEW *view, LPCWSTR column, INT type, BOOL temporary, BOOL hold ); /* * sort - orders the table by columns diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index c6171106043..5a1466592f1 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -2040,38 +2040,99 @@ static UINT TABLE_release(struct tagMSIVIEW *view) return ref; } -static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR table, UINT number, - LPCWSTR column, UINT type, BOOL hold) +static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR column, + INT type, BOOL temporary, BOOL hold) { + UINT i, r, table_id, col_id, size, offset; MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - MSITABLE *msitable; - MSIRECORD *rec; - UINT r; + MSICOLUMNINFO *colinfo; - rec = MSI_CreateRecord(4); - if (!rec) - return ERROR_OUTOFMEMORY; + if (temporary && !hold && !tv->table->ref_count) + return ERROR_SUCCESS; - MSI_RecordSetStringW(rec, 1, table); - MSI_RecordSetInteger(rec, 2, number); - MSI_RecordSetStringW(rec, 3, column); - MSI_RecordSetInteger(rec, 4, type); + if (!temporary && tv->table->col_count && + tv->table->colinfo[tv->table->col_count-1].temporary) + return ERROR_BAD_QUERY_SYNTAX; + + for (i = 0; i < tv->table->col_count; i++) + { + if (!wcscmp(tv->table->colinfo[i].colname, column)) + return ERROR_BAD_QUERY_SYNTAX; + } - r = TABLE_insert_row(&tv->view, rec, -1, FALSE); + colinfo = msi_realloc(tv->table->colinfo, sizeof(*tv->table->colinfo) * (tv->table->col_count + 1)); + if (!colinfo) + return ERROR_OUTOFMEMORY; + tv->table->colinfo = colinfo; + + r = msi_string2id( tv->db->strings, tv->name, -1, &table_id ); if (r != ERROR_SUCCESS) - goto done; + return r; + col_id = msi_add_string( tv->db->strings, column, -1, !temporary ); - msi_update_table_columns(tv->db, table); + colinfo[tv->table->col_count].tablename = msi_string_lookup( tv->db->strings, table_id, NULL ); + colinfo[tv->table->col_count].number = tv->table->col_count + 1; + colinfo[tv->table->col_count].colname = msi_string_lookup( tv->db->strings, col_id, NULL ); + colinfo[tv->table->col_count].type = type; + colinfo[tv->table->col_count].offset = 0; + colinfo[tv->table->col_count].hash_table = NULL; + colinfo[tv->table->col_count].temporary = temporary; + tv->table->col_count++; - if (!hold) - goto done; + table_calc_column_offsets( tv->db, tv->table->colinfo, tv->table->col_count); - msitable = find_cached_table(tv->db, table); - InterlockedIncrement(&msitable->ref_count); + size = msi_table_get_row_size( tv->db, tv->table->colinfo, tv->table->col_count, LONG_STR_BYTES ); + offset = tv->table->colinfo[tv->table->col_count - 1].offset; + for (i = 0; i < tv->table->row_count; i++) + { + BYTE *data = msi_realloc( tv->table->data[i], size ); + if (!data) + { + tv->table->col_count--; + return ERROR_OUTOFMEMORY; + } -done: - msiobj_release(&rec->hdr); - return r; + tv->table->data[i] = data; + memset(data + offset, 0, size - offset); + } + + if (!temporary) + { + MSIVIEW *columns; + MSIRECORD *rec; + + rec = MSI_CreateRecord(4); + if (!rec) + { + tv->table->col_count--; + return ERROR_OUTOFMEMORY; + } + + MSI_RecordSetStringW(rec, 1, tv->name); + MSI_RecordSetInteger(rec, 2, tv->table->col_count); + MSI_RecordSetStringW(rec, 3, column); + MSI_RecordSetInteger(rec, 4, type); + + r = TABLE_CreateView(tv->db, szColumns, &columns); + if (r != ERROR_SUCCESS) + { + tv->table->col_count--; + msiobj_release(&rec->hdr); + return r; + } + + r = TABLE_insert_row(columns, rec, -1, FALSE); + columns->ops->delete(columns); + msiobj_release(&rec->hdr); + if (r != ERROR_SUCCESS) + { + tv->table->col_count--; + return r; + } + } + if (hold) + TABLE_add_ref(view); + return ERROR_SUCCESS; } static UINT TABLE_drop(struct tagMSIVIEW *view) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 22466548b1f..3e1c551d38f 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -3950,7 +3950,7 @@ static void test_temporary_table(void) static void test_alter(void) { MSICONDITION cond; - MSIHANDLE hdb = 0; + MSIHANDLE hdb = 0, rec; const char *query; UINT r; @@ -4020,6 +4020,10 @@ static void test_alter(void) r = run_query(hdb, 0, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + query = "SELECT * FROM `_Columns` WHERE `Table` = 'U' AND `Name` = 'C'"; + r = do_query(hdb, query, &rec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + /* add column C again */ query = "ALTER TABLE `U` ADD `C` INTEGER"; r = run_query(hdb, 0, query); @@ -4037,6 +4041,10 @@ static void test_alter(void) r = run_query(hdb, 0, query); ok(r == ERROR_BAD_QUERY_SYNTAX, "Expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); + query = "SELECT * FROM `_Columns` WHERE `Table` = 'U' AND `Name` = 'D'"; + r = do_query(hdb, query, &rec); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + query = "INSERT INTO `U` ( `A`, `B`, `C`, `D` ) VALUES ( 5, 6, 7, 8 )"; r = run_query(hdb, 0, query); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r);
2 years, 9 months
1
0
0
0
[reactos] 290/360: [WINESYNC] msi: Add table existance tests for tables with temporary columns.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=41e6537b6944747556078…
commit 41e6537b69447475560787a890d65d83fa2b3b55 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:41 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:31 2022 +0100 [WINESYNC] msi: Add table existance tests for tables with temporary columns. 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 cb9cb83cda01fa873667e11038d9bdd01428f059 by Piotr Caban <piotr(a)codeweavers.com> --- modules/rostests/winetests/msi/db.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index c49b5e62655..22466548b1f 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -3957,10 +3957,22 @@ static void test_alter(void) hdb = create_db(); ok( hdb, "failed to create db\n"); + query = "CREATE TABLE `T` ( `B` SHORT NOT NULL TEMPORARY, `C` CHAR(255) TEMPORARY PRIMARY KEY `C`)"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "failed to add table\n"); + + query = "SELECT * FROM `T`"; + r = run_query(hdb, 0, query); + ok(r == ERROR_BAD_QUERY_SYNTAX, "expected ERROR_BAD_QUERY_SYNTAX, got %d\n", r); + query = "CREATE TABLE `T` ( `B` SHORT NOT NULL TEMPORARY, `C` CHAR(255) TEMPORARY PRIMARY KEY `C`) HOLD"; r = run_query(hdb, 0, query); ok(r == ERROR_SUCCESS, "failed to add table\n"); + query = "SELECT * FROM `T`"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", r); + cond = MsiDatabaseIsTablePersistentA(hdb, "T"); ok( cond == MSICONDITION_FALSE, "wrong return condition\n");
2 years, 9 months
1
0
0
0
[reactos] 289/360: [WINESYNC] msi: Test freeing _TransformView table.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8b9aafd97bd0e4cdf115f…
commit 8b9aafd97bd0e4cdf115f489d5ba7ce3a6de3f4c Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:41 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:31 2022 +0100 [WINESYNC] msi: Test freeing _TransformView table. 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 eb5a803bdbb8f602ae1212674a121cadd24642a5 by Piotr Caban <piotr(a)codeweavers.com> --- modules/rostests/winetests/msi/db.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 2bf03e1ac61..c49b5e62655 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -3217,6 +3217,12 @@ static void test_try_transform(void) r = MsiCloseHandle(hview); ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + query = "ALTER TABLE `_TransformView` FREE"; + r = run_query( hdb, 0, query ); + ok( r == ERROR_SUCCESS, "cannot free _TransformView table: %d\n", r ); + r = run_query( hdb, 0, query ); + ok( r == ERROR_BAD_QUERY_SYNTAX, "_TransformView table still exist: %d\n", r ); + r = MsiDatabaseApplyTransformA( hdb, mstfile, 0 ); ok( r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r );
2 years, 9 months
1
0
0
0
[reactos] 288/360: [WINESYNC] msi: Remove ref_count from MSICOLUMNINFO.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=eb6788c94321e02cc8cad…
commit eb6788c94321e02cc8cad23e3d0e539c0381e6b6 Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:41 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:30 2022 +0100 [WINESYNC] msi: Remove ref_count from MSICOLUMNINFO. 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 7200257d0428b1e9b4da72e8c4e39f9cf27455e6 by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/alter.c | 6 +++--- dll/win32/msi/table.c | 50 ++++++++++++++++---------------------------------- 2 files changed, 19 insertions(+), 37 deletions(-) diff --git a/dll/win32/msi/alter.c b/dll/win32/msi/alter.c index 5c5893c8248..7922171ae25 100644 --- a/dll/win32/msi/alter.c +++ b/dll/win32/msi/alter.c @@ -147,6 +147,9 @@ static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record ) TRACE("%p %p\n", av, record); + if (av->colinfo) + return alter_add_column(av); + if (av->hold == 1) av->table->ops->add_ref(av->table); else if (av->hold == -1) @@ -156,9 +159,6 @@ static UINT ALTER_execute( struct tagMSIVIEW *view, MSIRECORD *record ) av->table = NULL; } - if (av->colinfo) - return alter_add_column(av); - return ERROR_SUCCESS; } diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index 7fae4ad07ae..c6171106043 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -54,7 +54,6 @@ typedef struct tagMSICOLUMNINFO LPCWSTR colname; UINT type; UINT offset; - INT ref_count; BOOL temporary; MSICOLUMNHASHENTRY **hash_table; } MSICOLUMNINFO; @@ -80,14 +79,14 @@ static const WCHAR szNumber[] = {'N','u','m','b','e','r',0}; static const WCHAR szType[] = {'T','y','p','e',0}; static const MSICOLUMNINFO _Columns_cols[4] = { - { szColumns, 1, szTable, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, 0, NULL }, - { szColumns, 2, szNumber, MSITYPE_VALID | MSITYPE_KEY | 2, 2, 0, 0, NULL }, - { szColumns, 3, szName, MSITYPE_VALID | MSITYPE_STRING | 64, 4, 0, 0, NULL }, - { szColumns, 4, szType, MSITYPE_VALID | 2, 6, 0, 0, NULL }, + { szColumns, 1, szTable, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, NULL }, + { szColumns, 2, szNumber, MSITYPE_VALID | MSITYPE_KEY | 2, 2, 0, NULL }, + { szColumns, 3, szName, MSITYPE_VALID | MSITYPE_STRING | 64, 4, 0, NULL }, + { szColumns, 4, szType, MSITYPE_VALID | 2, 6, 0, NULL }, }; static const MSICOLUMNINFO _Tables_cols[1] = { - { szTables, 1, szName, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, 0, NULL }, + { szTables, 1, szName, MSITYPE_VALID | MSITYPE_STRING | MSITYPE_KEY | 64, 0, 0, NULL }, }; #define MAX_STREAM_NAME 0x1f @@ -694,7 +693,6 @@ static UINT get_tablecolumns( MSIDATABASE *db, LPCWSTR szTableName, MSICOLUMNINF colinfo[col - 1].type = read_table_int( table->data, i, table->colinfo[3].offset, sizeof(USHORT) ) - (1 << 15); colinfo[col - 1].offset = 0; - colinfo[col - 1].ref_count = 0; colinfo[col - 1].hash_table = NULL; } n++; @@ -765,7 +763,6 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, table->colinfo[ i ].colname = msi_string_lookup( db->strings, col_id, NULL ); table->colinfo[ i ].type = col->type; table->colinfo[ i ].offset = 0; - table->colinfo[ i ].ref_count = 0; table->colinfo[ i ].hash_table = NULL; table->colinfo[ i ].temporary = col->temporary; } @@ -1949,16 +1946,8 @@ static UINT TABLE_delete( struct tagMSIVIEW *view ) static UINT TABLE_add_ref(struct tagMSIVIEW *view) { MSITABLEVIEW *tv = (MSITABLEVIEW*)view; - UINT i; TRACE("%p %d\n", view, tv->table->ref_count); - - for (i = 0; i < tv->table->col_count; i++) - { - if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY) - InterlockedIncrement(&tv->table->colinfo[i].ref_count); - } - return InterlockedIncrement(&tv->table->ref_count); } @@ -2022,25 +2011,25 @@ static UINT TABLE_release(struct tagMSIVIEW *view) TRACE("%p %d\n", view, ref); - for (i = tv->table->col_count - 1; i >= 0; i--) + ref = InterlockedDecrement(&tv->table->ref_count); + if (ref == 0) { - if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY) + for (i = tv->table->col_count - 1; i >= 0; i--) { - ref = InterlockedDecrement(&tv->table->colinfo[i].ref_count); - if (ref == 0) + if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY) { r = TABLE_remove_column(view, tv->table->colinfo[i].tablename, tv->table->colinfo[i].number); if (r != ERROR_SUCCESS) break; } + else + { + break; + } } - } - ref = InterlockedDecrement(&tv->table->ref_count); - if (ref == 0) - { - if (!tv->table->row_count) + if (!tv->table->col_count) { list_remove(&tv->table->entry); free_table(tv->table); @@ -2057,7 +2046,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR table, UINT number MSITABLEVIEW *tv = (MSITABLEVIEW*)view; MSITABLE *msitable; MSIRECORD *rec; - UINT r, i; + UINT r; rec = MSI_CreateRecord(4); if (!rec) @@ -2078,14 +2067,7 @@ static UINT TABLE_add_column(struct tagMSIVIEW *view, LPCWSTR table, UINT number goto done; msitable = find_cached_table(tv->db, table); - for (i = 0; i < msitable->col_count; i++) - { - if (!wcscmp( msitable->colinfo[i].colname, column )) - { - InterlockedIncrement(&msitable->colinfo[i].ref_count); - break; - } - } + InterlockedIncrement(&msitable->ref_count); done: msiobj_release(&rec->hdr);
2 years, 9 months
1
0
0
0
[reactos] 287/360: [WINESYNC] msi: Fix table ref count on create.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=caa225a496ce6875ea3c4…
commit caa225a496ce6875ea3c447964915a1b6b82751a Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:41 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:30 2022 +0100 [WINESYNC] msi: Fix table ref count on create. 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 405486fbe6853c78744099fa1ebe07995e07a438 by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/create.c | 2 +- dll/win32/msi/query.h | 2 +- dll/win32/msi/table.c | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/dll/win32/msi/create.c b/dll/win32/msi/create.c index 6133159dce6..94c62ec5733 100644 --- a/dll/win32/msi/create.c +++ b/dll/win32/msi/create.c @@ -68,7 +68,7 @@ static UINT CREATE_execute( struct tagMSIVIEW *view, MSIRECORD *record ) if (cv->bIsTemp && !cv->hold) return ERROR_SUCCESS; - return msi_create_table( cv->db, cv->name, cv->col_info, persist ); + return msi_create_table( cv->db, cv->name, cv->col_info, persist, cv->hold ); } static UINT CREATE_close( struct tagMSIVIEW *view ) diff --git a/dll/win32/msi/query.h b/dll/win32/msi/query.h index c0144d30544..5e5f3906f4f 100644 --- a/dll/win32/msi/query.h +++ b/dll/win32/msi/query.h @@ -149,7 +149,7 @@ int sqliteGetToken(const WCHAR *z, int *tokenType, int *skip) DECLSPEC_HIDDEN; MSIRECORD *msi_query_merge_record( UINT fields, const column_info *vl, MSIRECORD *rec ) DECLSPEC_HIDDEN; UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, - MSICONDITION persistent ) DECLSPEC_HIDDEN; + MSICONDITION persistent, BOOL hold ) DECLSPEC_HIDDEN; UINT msi_select_update( MSIVIEW *view, MSIRECORD *rec, UINT row ) DECLSPEC_HIDDEN; diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index db4dd59f958..7fae4ad07ae 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -713,7 +713,7 @@ static UINT get_tablecolumns( MSIDATABASE *db, LPCWSTR szTableName, MSICOLUMNINF } UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, - MSICONDITION persistent ) + MSICONDITION persistent, BOOL hold ) { UINT r, nField; MSIVIEW *tv = NULL; @@ -733,7 +733,7 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, if( !table ) return ERROR_FUNCTION_FAILED; - table->ref_count = 1; + table->ref_count = 0; table->row_count = 0; table->data = NULL; table->data_persistent = NULL; @@ -742,6 +742,9 @@ UINT msi_create_table( MSIDATABASE *db, LPCWSTR name, column_info *col_info, table->persistent = persistent; lstrcpyW( table->name, name ); + if( hold ) + table->ref_count++; + for( col = col_info; col; col = col->next ) table->col_count++;
2 years, 9 months
1
0
0
0
[reactos] 286/360: [WINESYNC] msi: Support removing temporary columns in TABLE_remove_column.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5c718f5f5ccfdbba92362…
commit 5c718f5f5ccfdbba923626d6151c7d1b2744597a Author: winesync <ros-dev(a)reactos.org> AuthorDate: Sun Mar 13 19:08:40 2022 +0100 Commit: Mark Jansen <mark.jansen(a)reactos.org> CommitDate: Sun Mar 20 19:28:30 2022 +0100 [WINESYNC] msi: Support removing temporary columns in TABLE_remove_column. 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 5d568279dc0b842206918ba87a955298e72973ae by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/table.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index a413808e8a3..db4dd59f958 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -1966,6 +1966,20 @@ static UINT TABLE_remove_column(struct tagMSIVIEW *view, LPCWSTR table, UINT num MSIVIEW *columns = NULL; UINT row, r; + if (tv->table->col_count != number) + return ERROR_BAD_QUERY_SYNTAX; + + if (tv->table->colinfo[number-1].temporary) + { + UINT size = tv->table->colinfo[number-1].offset; + tv->table->col_count--; + tv->table->colinfo = msi_realloc( tv->table->colinfo, sizeof(*tv->table->colinfo) * tv->table->col_count ); + + for (row = 0; row < tv->table->row_count; row++) + tv->table->data[row] = msi_realloc( tv->table->data[row], size ); + return ERROR_SUCCESS; + } + rec = MSI_CreateRecord(2); if (!rec) return ERROR_OUTOFMEMORY; @@ -2000,11 +2014,12 @@ static UINT TABLE_release(struct tagMSIVIEW *view) { MSITABLEVIEW *tv = (MSITABLEVIEW*)view; INT ref = tv->table->ref_count; - UINT i, r; + UINT r; + INT i; TRACE("%p %d\n", view, ref); - for (i = 0; i < tv->table->col_count; i++) + for (i = tv->table->col_count - 1; i >= 0; i--) { if (tv->table->colinfo[i].type & MSITYPE_TEMPORARY) {
2 years, 9 months
1
0
0
0
[reactos] 285/360: [WINESYNC] msi: Add MsiDatabaseApplyTransformA MSITRANSFORM_ERROR_VIEWTRANSFORM test.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f78dfeafaccd093caddab…
commit f78dfeafaccd093caddab9212b6035ce239bd028 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:30 2022 +0100 [WINESYNC] msi: Add MsiDatabaseApplyTransformA MSITRANSFORM_ERROR_VIEWTRANSFORM test. 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 301dde9838563d33b610c2c09dc69cb07c4c8c9d by Piotr Caban <piotr(a)codeweavers.com> --- modules/rostests/winetests/msi/db.c | 82 +++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/modules/rostests/winetests/msi/db.c b/modules/rostests/winetests/msi/db.c index 64edcb98c03..2bf03e1ac61 100644 --- a/modules/rostests/winetests/msi/db.c +++ b/modules/rostests/winetests/msi/db.c @@ -3069,11 +3069,40 @@ static UINT package_from_db(MSIHANDLE hdb, MSIHANDLE *handle) static void test_try_transform(void) { + static const struct { + const char *table; + const char *column; + const char *row; + const char *data; + const char *current; + } transform_view[] = { + { "MOO", "OOO", "1", "c", "a" }, + { "MOO", "COW", "", "5378", "3" }, + { "MOO", "PIG", "", "5378", "4" }, + { "MOO", "PIG", "1", "5", "" }, + { "MOO", "DELETE", "3", "", "" }, + { "BINARY", "BLOB", "1", "BINARY.1", "" }, + { "BINARY", "INSERT", "1", "", "" }, + { "AAR", "CREATE", "", "", "" }, + { "AAR", "CAR", "", "15871", "1" }, + { "AAR", "BAR", "", "1282", "2" }, + { "AAR", "BAR", "vw", "1", "" }, + { "AAR", "BAR", "bmw", "2", "" }, + { "AAR", "INSERT", "vw", "", "" }, + { "AAR", "INSERT", "bmw", "", "" }, + { "Property", "CREATE", "", "", "" }, + { "Property", "Property", "", "11592", "1" }, + { "Property", "Value", "", "7424", "2" }, + { "Property", "Value", "prop", "val", "" }, + { "Property", "INSERT", "prop", "", "" } + }; + MSIHANDLE hdb, hview, hrec, hpkg = 0; LPCSTR query; UINT r; DWORD sz; char buffer[MAX_PATH]; + int i, matched; DeleteFileA(msifile); DeleteFileA(mstfile); @@ -3135,6 +3164,59 @@ static void test_try_transform(void) r = MsiOpenDatabaseW(msifileW, MSIDBOPEN_DIRECT, &hdb ); ok( r == ERROR_SUCCESS , "Failed to create database\n" ); + r = MsiDatabaseApplyTransformA(hdb, mstfile, MSITRANSFORM_ERROR_VIEWTRANSFORM); + ok(r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r); + + query = "select * from `_TransformView`"; + r = MsiDatabaseOpenViewA(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "MsiDatabaseOpenView failed\n"); + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); + + r = MsiViewGetColumnInfo(hview, MSICOLINFO_NAMES, &hrec); + ok(r == ERROR_SUCCESS, "error\n"); + check_record(hrec, 5, "Table", "Column", "Row", "Data", "Current"); + MsiCloseHandle(hrec); + + r = MsiViewGetColumnInfo(hview, MSICOLINFO_TYPES, &hrec); + ok(r == ERROR_SUCCESS, "error\n"); + check_record(hrec, 5, "g0", "g0", "G0", "G0", "G0"); + MsiCloseHandle(hrec); + + matched = 0; + while (MsiViewFetch(hview, &hrec) == ERROR_SUCCESS) + { + char data[5][256]; + + for (i = 1; i <= 5; i++) { + sz = ARRAY_SIZE(data[0]); + r = MsiRecordGetStringA(hrec, i, data[i-1], &sz); + ok(r == ERROR_SUCCESS, "%d) MsiRecordGetStringA failed %d\n", i, r); + } + + for (i = 0; i < ARRAY_SIZE(transform_view); i++) + { + if (strcmp(data[0], transform_view[i].table) || + strcmp(data[1], transform_view[i].column) || + strcmp(data[2], transform_view[i].row)) + continue; + + matched++; + ok(!strcmp(data[3], transform_view[i].data), "%d) data[3] = %s\n", i, data[3]); + ok(!strcmp(data[4], transform_view[i].current), "%d) data[4] = %s\n", i, data[4]); + break; + } + ok(i != ARRAY_SIZE(transform_view), "invalid row: %s, %s, %s\n", + wine_dbgstr_a(data[0]), wine_dbgstr_a(data[1]), wine_dbgstr_a(data[2])); + MsiCloseHandle(hrec); + } + ok(matched == ARRAY_SIZE(transform_view), "matched = %d\n", matched); + + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "MsiViewClose failed\n"); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "MsiCloseHandle failed\n"); + r = MsiDatabaseApplyTransformA( hdb, mstfile, 0 ); ok( r == ERROR_SUCCESS, "return code %d, should be ERROR_SUCCESS\n", r );
2 years, 9 months
1
0
0
0
[reactos] 284/360: [WINESYNC] msi: Support DELETE when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4048c060fc2c33358dd8a…
commit 4048c060fc2c33358dd8ae6c5bcb251d86060a92 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:30 2022 +0100 [WINESYNC] msi: Support DELETE 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 b1f9f4ccee6f7d42dbeaf457e81db462a1b526af by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/table.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index 95da84a92dc..a413808e8a3 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -2600,7 +2600,15 @@ static UINT TransformView_drop_table( MSITABLEVIEW *tv, UINT row ) static UINT TransformView_delete_row( MSIVIEW *view, UINT row ) { + static const WCHAR query_pfx[] = L"INSERT INTO `_TransformView` ( `Table`, `Column`, `Row`) VALUES ( '"; + static const WCHAR query_column[] = L"', 'DELETE', '"; + static const WCHAR query_sfx[] = L"')"; + MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + WCHAR *key, buf[256], *query = buf; + UINT r, len, name_len, key_len; + MSIRECORD *rec; + MSIQUERY *q; if (!wcscmp( tv->name, szColumns )) { @@ -2611,8 +2619,49 @@ static UINT TransformView_delete_row( MSIVIEW *view, UINT row ) if (!wcscmp( tv->name, szTables )) return TransformView_drop_table( tv, row ); - FIXME("\n"); - return ERROR_CALL_NOT_IMPLEMENTED; + r = msi_view_get_row( tv->db, view, row, &rec ); + if (r != ERROR_SUCCESS) + return r; + + key = create_key_string( tv, rec ); + msiobj_release( &rec->hdr ); + if (!key) + return ERROR_OUTOFMEMORY; + + name_len = wcslen( tv->name ); + key_len = wcslen( key ); + len = ARRAY_SIZE(query_pfx) + name_len + ARRAY_SIZE(query_column) + key_len + ARRAY_SIZE(query_sfx) - 2; + if (len > ARRAY_SIZE(buf)) + { + query = msi_alloc( len * sizeof(WCHAR) ); + if (!query) + { + msi_free( tv ); + msi_free( key ); + return ERROR_OUTOFMEMORY; + } + } + + memcpy( query, query_pfx, ARRAY_SIZE(query_pfx) * sizeof(WCHAR) ); + len = ARRAY_SIZE(query_pfx) - 1; + memcpy( query + len, tv->name, name_len * sizeof(WCHAR) ); + len += name_len; + memcpy( query + len, query_column, ARRAY_SIZE(query_column) * sizeof(WCHAR) ); + len += ARRAY_SIZE(query_column) - 1; + memcpy( query + len, key, key_len * sizeof(WCHAR) ); + len += key_len; + memcpy( query + len, query_sfx, ARRAY_SIZE(query_sfx) * sizeof(WCHAR) ); + 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 ); + return r; } static UINT TransformView_execute( MSIVIEW *view, MSIRECORD *record )
2 years, 9 months
1
0
0
0
[reactos] 283/360: [WINESYNC] msi: Support DROP when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used.
by winesync
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9d793f296e5f4fda2acb3…
commit 9d793f296e5f4fda2acb3e852ba906942bdcca3d 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 DROP 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 6b6e1bd2c73ac23b03db0e656f895896936df5ba by Piotr Caban <piotr(a)codeweavers.com> --- dll/win32/msi/table.c | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/dll/win32/msi/table.c b/dll/win32/msi/table.c index e6b5a09375b..95da84a92dc 100644 --- a/dll/win32/msi/table.c +++ b/dll/win32/msi/table.c @@ -2554,8 +2554,63 @@ static UINT TransformView_insert_row( MSIVIEW *view, MSIRECORD *rec, UINT row, B return TransformView_set_row( view, row, rec, ~0 ); } +static UINT TransformView_drop_table( MSITABLEVIEW *tv, UINT row ) +{ + static const WCHAR query_pfx[] = L"INSERT INTO `_TransformView` ( `Table`, `Column` ) VALUES ( '"; + static const WCHAR query_sfx[] = L"', 'DROP' )"; + + WCHAR buf[256], *query = buf; + UINT r, table_id, len; + const WCHAR *table; + int table_len; + MSIQUERY *q; + + r = TABLE_fetch_int( &tv->view, row, 1, &table_id ); + if (r != ERROR_SUCCESS) + return r; + + table = msi_string_lookup( tv->db->strings, table_id, &table_len ); + if (!table) + return ERROR_INSTALL_TRANSFORM_FAILURE; + + len = ARRAY_SIZE(query_pfx) - 1 + table_len + ARRAY_SIZE(query_sfx); + if (len > ARRAY_SIZE(buf)) + { + query = msi_alloc( len * sizeof(WCHAR) ); + if (!query) + return ERROR_OUTOFMEMORY; + } + + memcpy( query, query_pfx, ARRAY_SIZE(query_pfx) * sizeof(WCHAR) ); + len = ARRAY_SIZE(query_pfx) - 1; + memcpy( query + len, table, table_len * sizeof(WCHAR) ); + len += table_len; + memcpy( query + len, query_sfx, ARRAY_SIZE(query_sfx) * sizeof(WCHAR) ); + + 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 ); + return r; +} + static UINT TransformView_delete_row( MSIVIEW *view, UINT row ) { + MSITABLEVIEW *tv = (MSITABLEVIEW*)view; + + if (!wcscmp( tv->name, szColumns )) + { + ERR("trying to remove column\n"); + return ERROR_INSTALL_TRANSFORM_FAILURE; + } + + if (!wcscmp( tv->name, szTables )) + return TransformView_drop_table( tv, row ); + FIXME("\n"); return ERROR_CALL_NOT_IMPLEMENTED; }
2 years, 9 months
1
0
0
0
[reactos] 282/360: [WINESYNC] msi: Support INSERT INTO when MSITRANSFORM_ERROR_VIEWTRANSFORM flag is used.
by winesync
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 )
2 years, 9 months
1
0
0
0
← Newer
1
...
9
10
11
12
13
14
15
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200