Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4d9c17da
Commit
4d9c17da
authored
Apr 06, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Apr 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Don't execute the view again when modifying a WHERE query.
parent
bcba82dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
107 additions
and
5 deletions
+107
-5
db.c
dlls/msi/tests/db.c
+102
-0
where.c
dlls/msi/where.c
+5
-5
No files found.
dlls/msi/tests/db.c
View file @
4d9c17da
...
...
@@ -5887,6 +5887,107 @@ static void test_viewmodify_refresh(void)
DeleteFileA
(
msifile
);
}
static
void
test_where_viewmodify
(
void
)
{
MSIHANDLE
hdb
,
hview
,
hrec
;
const
char
*
query
;
UINT
r
;
DeleteFile
(
msifile
);
r
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_CREATE
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` INT, `B` INT PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"INSERT INTO `Table` ( `A`, `B` ) VALUES ( 1, 2 )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"INSERT INTO `Table` ( `A`, `B` ) VALUES ( 3, 4 )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"INSERT INTO `Table` ( `A`, `B` ) VALUES ( 5, 6 )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* `B` = 3 doesn't match, but the view shouldn't be executed */
query
=
"SELECT * FROM `Table` WHERE `B` = 3"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
hrec
=
MsiCreateRecord
(
2
);
MsiRecordSetInteger
(
hrec
,
1
,
7
);
MsiRecordSetInteger
(
hrec
,
2
,
8
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_INSERT_TEMPORARY
,
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
MsiCloseHandle
(
hrec
);
MsiViewClose
(
hview
);
MsiCloseHandle
(
hview
);
query
=
"SELECT * FROM `Table` WHERE `A` = 7"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
hrec
,
1
);
ok
(
r
==
7
,
"Expected 7, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
hrec
,
2
);
ok
(
r
==
8
,
"Expected 8, got %d
\n
"
,
r
);
MsiRecordSetInteger
(
hrec
,
2
,
9
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_UPDATE
,
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
MsiCloseHandle
(
hrec
);
MsiViewClose
(
hview
);
MsiCloseHandle
(
hview
);
query
=
"SELECT * FROM `Table` WHERE `A` = 7"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
hrec
,
1
);
ok
(
r
==
7
,
"Expected 7, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
hrec
,
2
);
ok
(
r
==
9
,
"Expected 9, got %d
\n
"
,
r
);
query
=
"UPDATE `Table` SET `B` = 10 WHERE `A` = 7"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_REFRESH
,
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
hrec
,
1
);
ok
(
r
==
7
,
"Expected 7, got %d
\n
"
,
r
);
r
=
MsiRecordGetInteger
(
hrec
,
2
);
ok
(
r
==
10
,
"Expected 10, got %d
\n
"
,
r
);
MsiCloseHandle
(
hrec
);
MsiViewClose
(
hview
);
MsiCloseHandle
(
hview
);
MsiCloseHandle
(
hdb
);
}
START_TEST
(
db
)
{
test_msidatabase
();
...
...
@@ -5923,4 +6024,5 @@ START_TEST(db)
test_noquotes
();
test_forcecodepage
();
test_viewmodify_refresh
();
test_where_viewmodify
();
}
dlls/msi/where.c
View file @
4d9c17da
...
...
@@ -86,6 +86,9 @@ static UINT find_entry_in_hash(MSIHASHENTRY **table, UINT row, UINT *val)
{
MSIHASHENTRY
*
entry
;
if
(
!
table
)
return
ERROR_SUCCESS
;
if
(
!
(
entry
=
table
[
row
%
MSI_HASH_TABLE_SIZE
]))
{
WARN
(
"Row not found in hash table!
\n
"
);
...
...
@@ -503,15 +506,12 @@ static UINT WHERE_modify( struct tagMSIVIEW *view, MSIMODIFY eModifyMode,
MSIRECORD
*
rec
,
UINT
row
)
{
MSIWHEREVIEW
*
wv
=
(
MSIWHEREVIEW
*
)
view
;
UINT
r
;
TRACE
(
"%p %d %p
\n
"
,
wv
,
eModifyMode
,
rec
);
r
=
WHERE_execute
(
view
,
NULL
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
find_entry_in_hash
(
wv
->
reorder
,
row
-
1
,
&
row
);
row
++
;
return
wv
->
table
->
ops
->
modify
(
wv
->
table
,
eModifyMode
,
rec
,
row
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment