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
479aca47
Commit
479aca47
authored
Jul 23, 2007
by
James Hawkins
Committed by
Alexandre Julliard
Jul 24, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Add tests for the MSIMODIFY_UPDATE command.
parent
8a7690c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
204 additions
and
3 deletions
+204
-3
db.c
dlls/msi/tests/db.c
+204
-3
No files found.
dlls/msi/tests/db.c
View file @
479aca47
...
...
@@ -774,12 +774,12 @@ static void test_viewmodify(void)
/* insert a valid record */
hrec
=
MsiCreateRecord
(
3
);
r
=
MsiRecordSetInteger
(
hrec
,
2
,
1
);
r
=
MsiRecordSetInteger
(
hrec
,
1
,
1
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set integer
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
2
,
"bob"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set
integer
\n
"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set
string
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
3
,
"7654321"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set
integer
\n
"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set
string
\n
"
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewExecute failed
\n
"
);
...
...
@@ -804,6 +804,207 @@ static void test_viewmodify(void)
r
=
MsiCloseHandle
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
query
=
"SELECT * FROM `phone`"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiDatabaseOpenView failed
\n
"
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewExecute failed
\n
"
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewFetch failed
\n
"
);
r
=
MsiRecordGetInteger
(
hrec
,
1
);
ok
(
r
==
1
,
"Expected 1, got %d
\n
"
,
r
);
sz
=
sizeof
(
buffer
);
r
=
MsiRecordGetString
(
hrec
,
2
,
buffer
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiRecordGetString failed
\n
"
);
ok
(
!
lstrcmp
(
buffer
,
"bob"
),
"Expected bob, got %s
\n
"
,
buffer
);
sz
=
sizeof
(
buffer
);
r
=
MsiRecordGetString
(
hrec
,
3
,
buffer
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiRecordGetString failed
\n
"
);
ok
(
!
lstrcmp
(
buffer
,
"7654321"
),
"Expected 7654321, got %s
\n
"
,
buffer
);
/* update the view, non-primary key */
r
=
MsiRecordSetString
(
hrec
,
3
,
"3141592"
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiRecordSetString failed
\n
"
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_UPDATE
,
hrec
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewModify failed
\n
"
);
}
/* do it again */
r
=
MsiViewModify
(
hview
,
MSIMODIFY_UPDATE
,
hrec
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewModify failed: %d
\n
"
,
r
);
}
/* update the view, primary key */
r
=
MsiRecordSetInteger
(
hrec
,
1
,
5
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiRecordSetInteger failed
\n
"
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_UPDATE
,
hrec
);
todo_wine
{
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"MsiViewModify failed
\n
"
);
}
r
=
MsiCloseHandle
(
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to close record
\n
"
);
r
=
MsiViewClose
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewClose failed
\n
"
);
r
=
MsiCloseHandle
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
query
=
"SELECT * FROM `phone`"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiDatabaseOpenView failed
\n
"
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewExecute failed
\n
"
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewFetch failed
\n
"
);
r
=
MsiRecordGetInteger
(
hrec
,
1
);
ok
(
r
==
1
,
"Expected 1, got %d
\n
"
,
r
);
sz
=
sizeof
(
buffer
);
r
=
MsiRecordGetString
(
hrec
,
2
,
buffer
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiRecordGetString failed
\n
"
);
ok
(
!
lstrcmp
(
buffer
,
"bob"
),
"Expected bob, got %s
\n
"
,
buffer
);
sz
=
sizeof
(
buffer
);
r
=
MsiRecordGetString
(
hrec
,
3
,
buffer
,
&
sz
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiRecordGetString failed
\n
"
);
todo_wine
{
ok
(
!
lstrcmp
(
buffer
,
"3141592"
),
"Expected 3141592, got %s
\n
"
,
buffer
);
}
r
=
MsiCloseHandle
(
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to close record
\n
"
);
/* use a record that doesn't come from a view fetch */
hrec
=
MsiCreateRecord
(
3
);
ok
(
hrec
!=
0
,
"MsiCreateRecord failed
\n
"
);
r
=
MsiRecordSetInteger
(
hrec
,
1
,
3
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set integer
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
2
,
"jane"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set string
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
3
,
"112358"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set string
\n
"
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_UPDATE
,
hrec
);
todo_wine
{
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"Expected ERROR_FUNCTION_FAILED, got %d
\n
"
,
r
);
}
r
=
MsiCloseHandle
(
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to close record
\n
"
);
/* use a record that doesn't come from a view fetch, primary key matches */
hrec
=
MsiCreateRecord
(
3
);
ok
(
hrec
!=
0
,
"MsiCreateRecord failed
\n
"
);
r
=
MsiRecordSetInteger
(
hrec
,
1
,
1
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set integer
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
2
,
"jane"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set string
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
3
,
"112358"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set string
\n
"
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_UPDATE
,
hrec
);
todo_wine
{
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"MsiViewModify failed
\n
"
);
}
r
=
MsiCloseHandle
(
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to close record
\n
"
);
hrec
=
MsiCreateRecord
(
3
);
r
=
MsiRecordSetInteger
(
hrec
,
1
,
2
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set integer
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
2
,
"nick"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set string
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
3
,
"141421"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set string
\n
"
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewExecute failed
\n
"
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_INSERT_TEMPORARY
,
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewModify failed
\n
"
);
r
=
MsiViewClose
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewClose failed
\n
"
);
r
=
MsiCloseHandle
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
query
=
"SELECT * FROM `phone` WHERE `id` = 1"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiDatabaseOpenView failed
\n
"
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewExecute failed
\n
"
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewFetch failed
\n
"
);
/* change the id to match the second row */
r
=
MsiRecordSetInteger
(
hrec
,
1
,
2
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set integer
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
2
,
"jerry"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set string
\n
"
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_UPDATE
,
hrec
);
todo_wine
{
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"MsiViewModify failed
\n
"
);
}
r
=
MsiCloseHandle
(
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to close record
\n
"
);
r
=
MsiViewClose
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewClose failed
\n
"
);
r
=
MsiCloseHandle
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
/* broader search */
query
=
"SELECT * FROM `phone` ORDER BY `id`"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiDatabaseOpenView failed
\n
"
);
r
=
MsiViewExecute
(
hview
,
0
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewExecute failed
\n
"
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewFetch failed
\n
"
);
/* change the id to match the second row */
r
=
MsiRecordSetInteger
(
hrec
,
1
,
2
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set integer
\n
"
);
r
=
MsiRecordSetString
(
hrec
,
2
,
"jerry"
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to set string
\n
"
);
r
=
MsiViewModify
(
hview
,
MSIMODIFY_UPDATE
,
hrec
);
todo_wine
{
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"MsiViewModify failed
\n
"
);
}
r
=
MsiCloseHandle
(
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to close record
\n
"
);
r
=
MsiViewClose
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiViewClose failed
\n
"
);
r
=
MsiCloseHandle
(
hview
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiCloseHandle failed
\n
"
);
r
=
MsiCloseHandle
(
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"MsiOpenDatabase close failed
\n
"
);
}
...
...
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