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
d89ee5fd
Commit
d89ee5fd
authored
Feb 06, 2008
by
James Hawkins
Committed by
Alexandre Julliard
Feb 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Test using carriage returns in SQL queries and imported tables.
parent
001e711b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
325 additions
and
0 deletions
+325
-0
database.c
dlls/msi/database.c
+4
-0
db.c
dlls/msi/tests/db.c
+321
-0
No files found.
dlls/msi/database.c
View file @
d89ee5fd
...
...
@@ -408,6 +408,10 @@ static LPWSTR msi_build_createsql_columns(LPWSTR *columns_data, LPWSTR *types, D
else
type
=
type_long
;
break
;
default:
ERR
(
"Unknown type: %c
\n
"
,
types
[
i
][
0
]);
msi_free
(
columns
);
return
NULL
;
}
sprintfW
(
expanded
,
column_fmt
,
columns_data
[
i
],
type
,
size
,
extra
,
comma
);
...
...
dlls/msi/tests/db.c
View file @
d89ee5fd
...
...
@@ -1590,6 +1590,18 @@ static const CHAR two_primary[] = "PrimaryOne\tPrimaryTwo\n"
"papaya
\t
leaf
\n
"
"papaya
\t
flower
\n
"
;
static
const
CHAR
endlines1
[]
=
"A
\t
B
\t
C
\t
D
\t
E
\t
F
\r\n
"
"s72
\t
s72
\t
s72
\t
s72
\t
s72
\t
s72
\n
"
"Table
\t
A
\r\n
"
"a
\t
b
\t
c
\t
d
\t
e
\t
f
\n
"
"g
\t
h
\t
i
\t\r
j
\t
k
\t
l
\r\n
"
;
static
const
CHAR
endlines2
[]
=
"A
\t
B
\t
C
\t
D
\t
E
\t
F
\r
"
"s72
\t
s72
\t
s72
\t
s72
\t
s72
\t
s72
\n
"
"Table2
\t
A
\r\n
"
"a
\t
b
\t
c
\t
d
\t
e
\t
f
\n
"
"g
\t
h
\t
i
\t
j
\t
k
\t
l
\r\n
"
;
static
void
write_file
(
const
CHAR
*
filename
,
const
char
*
data
,
int
data_size
)
{
DWORD
size
;
...
...
@@ -1630,6 +1642,19 @@ static void test_msiimport(void)
r
=
add_table_to_db
(
hdb
,
two_primary
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
add_table_to_db
(
hdb
,
endlines1
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
}
r
=
add_table_to_db
(
hdb
,
endlines2
);
todo_wine
{
ok
(
r
==
ERROR_FUNCTION_FAILED
,
"Expected ERROR_FUNCTION_FAILED, got %d
\n
"
,
r
);
}
query
=
"SELECT * FROM `TestTable`"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
view
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
...
...
@@ -1733,6 +1758,95 @@ static void test_msiimport(void)
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
MsiCloseHandle
(
view
);
query
=
"SELECT * FROM `Table`"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
view
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
}
r
=
MsiViewGetColumnInfo
(
view
,
MSICOLINFO_NAMES
,
&
rec
);
count
=
MsiRecordGetFieldCount
(
rec
);
todo_wine
{
ok
(
count
==
6
,
"Expected 6, got %d
\n
"
,
count
);
ok
(
check_record
(
rec
,
1
,
"A"
),
"Expected A
\n
"
);
ok
(
check_record
(
rec
,
2
,
"B"
),
"Expected B
\n
"
);
ok
(
check_record
(
rec
,
3
,
"C"
),
"Expected C
\n
"
);
ok
(
check_record
(
rec
,
4
,
"D"
),
"Expected D
\n
"
);
ok
(
check_record
(
rec
,
5
,
"E"
),
"Expected E
\n
"
);
ok
(
check_record
(
rec
,
6
,
"F"
),
"Expected F
\n
"
);
}
MsiCloseHandle
(
rec
);
r
=
MsiViewGetColumnInfo
(
view
,
MSICOLINFO_TYPES
,
&
rec
);
count
=
MsiRecordGetFieldCount
(
rec
);
todo_wine
{
ok
(
count
==
6
,
"Expected 6, got %d
\n
"
,
count
);
ok
(
check_record
(
rec
,
1
,
"s72"
),
"Expected s72
\n
"
);
ok
(
check_record
(
rec
,
2
,
"s72"
),
"Expected s72
\n
"
);
ok
(
check_record
(
rec
,
3
,
"s72"
),
"Expected s72
\n
"
);
ok
(
check_record
(
rec
,
4
,
"s72"
),
"Expected s72
\n
"
);
ok
(
check_record
(
rec
,
5
,
"s72"
),
"Expected s72
\n
"
);
ok
(
check_record
(
rec
,
6
,
"s72"
),
"Expected s72
\n
"
);
}
MsiCloseHandle
(
rec
);
MsiViewClose
(
view
);
MsiCloseHandle
(
view
);
query
=
"SELECT * FROM `Table`"
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
view
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
}
r
=
MsiViewExecute
(
view
,
0
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
}
r
=
MsiViewFetch
(
view
,
&
rec
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
check_record
(
rec
,
1
,
"a"
),
"Expected 'a'
\n
"
);
ok
(
check_record
(
rec
,
2
,
"b"
),
"Expected 'b'
\n
"
);
ok
(
check_record
(
rec
,
3
,
"c"
),
"Expected 'c'
\n
"
);
ok
(
check_record
(
rec
,
4
,
"d"
),
"Expected 'd'
\n
"
);
ok
(
check_record
(
rec
,
5
,
"e"
),
"Expected 'e'
\n
"
);
ok
(
check_record
(
rec
,
6
,
"f"
),
"Expected 'f'
\n
"
);
}
MsiCloseHandle
(
rec
);
r
=
MsiViewFetch
(
view
,
&
rec
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
ok
(
check_record
(
rec
,
1
,
"g"
),
"Expected 'g'
\n
"
);
ok
(
check_record
(
rec
,
2
,
"h"
),
"Expected 'h'
\n
"
);
ok
(
check_record
(
rec
,
3
,
"i"
),
"Expected 'i'
\n
"
);
ok
(
check_record
(
rec
,
4
,
"j"
),
"Expected 'j'
\n
"
);
ok
(
check_record
(
rec
,
5
,
"k"
),
"Expected 'k'
\n
"
);
ok
(
check_record
(
rec
,
6
,
"l"
),
"Expected 'l'
\n
"
);
}
MsiCloseHandle
(
rec
);
r
=
MsiViewFetch
(
view
,
&
rec
);
todo_wine
{
ok
(
r
==
ERROR_NO_MORE_ITEMS
,
"Expected ERROR_NO_MORE_ITEMS, got %d
\n
"
,
r
);
}
MsiViewClose
(
view
);
MsiCloseHandle
(
view
);
MsiCloseHandle
(
hdb
);
DeleteFileA
(
msifile
);
}
...
...
@@ -5181,6 +5295,212 @@ static void test_quotes(void)
DeleteFileA
(
msifile
);
}
static
void
test_carriagereturn
(
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`
\r
( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
todo_wine
{
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
}
query
=
"CREATE TABLE `Table`
\r
( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE
\r
TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE
\r
`Table` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` (
\r
`A` CHAR(72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A`
\r
CHAR(72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72)
\r
NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT
\r
NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT
\r
NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL
\r
PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL
\r
PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY
\r
KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY
\r
KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY KEY
\r
`A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A`
\r
)"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Table` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A` )
\r
"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `
\r
One` ( `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
=
"CREATE TABLE `Tw
\r
o` ( `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
=
"CREATE TABLE `Three
\r
` ( `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
=
"CREATE TABLE `Four` ( `A
\r
` CHAR(72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Four` ( `
\r
A` CHAR(72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Four` ( `A` CHAR(72
\r
) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
todo_wine
{
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
}
query
=
"CREATE TABLE `Four` ( `A` CHAR(
\r
72) NOT NULL PRIMARY KEY `A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Four` ( `A` CHAR(72) NOT NULL PRIMARY KEY `
\r
A` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Four` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A
\r
` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"CREATE TABLE `Four` ( `A` CHAR(72) NOT NULL PRIMARY KEY `A
\r
` )"
;
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
query
=
"SELECT * FROM `_Tables`"
;
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
=
MsiRecordGetStringA
(
hrec
,
1
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
todo_wine
{
ok
(
!
lstrcmpA
(
buf
,
"
\r
One"
),
"Expected
\"\\
rOne
\"
, got
\"
%s
\"\n
"
,
buf
);
}
MsiCloseHandle
(
hrec
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
size
=
MAX_PATH
;
r
=
MsiRecordGetStringA
(
hrec
,
1
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
todo_wine
{
ok
(
!
lstrcmpA
(
buf
,
"Tw
\r
o"
),
"Expected
\"
Tw
\\
ro
\"
, got
\"
%s
\"\n
"
,
buf
);
}
MsiCloseHandle
(
hrec
);
r
=
MsiViewFetch
(
hview
,
&
hrec
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
size
=
MAX_PATH
;
r
=
MsiRecordGetStringA
(
hrec
,
1
,
buf
,
&
size
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
todo_wine
{
ok
(
!
lstrcmpA
(
buf
,
"Three
\r
"
),
"Expected
\"
Three
\r\"
, 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
);
}
MsiViewClose
(
hview
);
MsiCloseHandle
(
hview
);
MsiCloseHandle
(
hdb
);
DeleteFileA
(
msifile
);
}
START_TEST
(
db
)
{
test_msidatabase
();
...
...
@@ -5213,4 +5533,5 @@ START_TEST(db)
test_viewmodify_delete_temporary
();
test_deleterow
();
test_quotes
();
test_carriagereturn
();
}
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