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
56574c7c
Commit
56574c7c
authored
Feb 04, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Feb 05, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Add tests for using single quotes in an INSERT query.
parent
972c61d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
129 additions
and
0 deletions
+129
-0
db.c
dlls/msi/tests/db.c
+129
-0
No files found.
dlls/msi/tests/db.c
View file @
56574c7c
...
...
@@ -5053,6 +5053,134 @@ static void test_deleterow()
DeleteFileA
(
msifile
);
}
static
const
CHAR
import_dat
[]
=
"A
\n
"
"s72
\n
"
"Table
\t
A
\n
"
"This is a new 'string' ok
\n
"
;
static
void
test_quotes
(
void
)
{
MSIHANDLE
hdb
,
hview
,
hrec
;
const
char
*
query
;
char
buf
[
MAX_PATH
];
UINT
r
;
DWORD
size
;
DeleteFile
(
msifile
);
r
=
MsiOpenDatabase
(
msifile
,
MSIDBOPEN_CREATE
,
&
hdb
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL 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` ) VALUES ( 'This is a 'string' ok' )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"INSERT INTO `Table` ( `A` ) VALUES (
\"
This is a 'string' ok
\"
)"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"INSERT INTO `Table` ( `A` ) VALUES (
\"
test
\"
)"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"INSERT INTO `Table` ( `A` ) VALUES ( 'This is a ''string'' ok' )"
;
r
=
run_query
(
hdb
,
0
,
query
);
todo_wine
{
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
}
query
=
"INSERT INTO `Table` ( `A` ) VALUES ( 'This is a '''string''' ok' )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"INSERT INTO `Table` ( `A` ) VALUES ( 'This is a
\'
string
\'
ok' )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"INSERT INTO `Table` ( `A` ) VALUES ( 'This is a
\"
string
\"
ok' )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
query
=
"SELECT * FROM `Table`"
;
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
);
size
=
MAX_PATH
;
r
=
MsiRecordGetString
(
hrec
,
1
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
todo_wine
{
ok
(
!
lstrcmp
(
buf
,
"This is a
\"
string
\"
ok"
),
"Expected
\"
This is a
\"
string
\"
ok
\"
, got %s
\n
"
,
buf
);
}
MsiCloseHandle
(
hrec
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
todo_wine
{
ok
(
r
==
ERROR_NO_MORE_ITEMS
,
"Expected ERROR_NO_MORE_ITEMS, got %d
\n
"
,
r
);
}
MsiCloseHandle
(
hview
);
write_file
(
"import.idt"
,
import_dat
,
(
sizeof
(
import_dat
)
-
1
)
*
sizeof
(
char
));
r
=
MsiDatabaseImportA
(
hdb
,
CURR_DIR
,
"import.idt"
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
}
DeleteFileA
(
"import.idt"
);
query
=
"SELECT * FROM `Table`"
;
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
);
size
=
MAX_PATH
;
r
=
MsiRecordGetString
(
hrec
,
1
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
todo_wine
{
ok
(
!
lstrcmp
(
buf
,
"This is a new 'string' ok"
),
"Expected
\"
This is a new 'string' ok
\"
, got %s
\n
"
,
buf
);
}
MsiCloseHandle
(
hrec
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
todo_wine
{
ok
(
r
==
ERROR_NO_MORE_ITEMS
,
"Expected ERROR_NO_MORE_ITEMS, got %d
\n
"
,
r
);
}
MsiCloseHandle
(
hview
);
MsiCloseHandle
(
hdb
);
DeleteFileA
(
msifile
);
}
START_TEST
(
db
)
{
test_msidatabase
();
...
...
@@ -5084,4 +5212,5 @@ START_TEST(db)
test_order
();
test_viewmodify_delete_temporary
();
test_deleterow
();
test_quotes
();
}
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