Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
2924501a
Commit
2924501a
authored
Aug 31, 2006
by
Mike McCormack
Committed by
Alexandre Julliard
Sep 07, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Check that column names are unique when creating a table.
parent
bd9891ff
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
5 deletions
+30
-5
create.c
dlls/msi/create.c
+19
-1
db.c
dlls/msi/tests/db.c
+11
-4
No files found.
dlls/msi/create.c
View file @
2924501a
...
...
@@ -221,17 +221,35 @@ static const MSIVIEWOPS create_ops =
CREATE_delete
};
static
UINT
check_columns
(
column_info
*
col_info
)
{
column_info
*
c1
,
*
c2
;
/* check for two columns with the same name */
for
(
c1
=
col_info
;
c1
;
c1
=
c1
->
next
)
for
(
c2
=
c1
->
next
;
c2
;
c2
=
c2
->
next
)
if
(
!
lstrcmpW
(
c1
->
column
,
c2
->
column
))
return
ERROR_BAD_QUERY_SYNTAX
;
return
ERROR_SUCCESS
;
}
UINT
CREATE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPWSTR
table
,
column_info
*
col_info
,
BOOL
temp
)
{
MSICREATEVIEW
*
cv
=
NULL
;
UINT
r
;
TRACE
(
"%p
\n
"
,
cv
);
r
=
check_columns
(
col_info
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
cv
=
msi_alloc_zero
(
sizeof
*
cv
);
if
(
!
cv
)
return
ERROR_FUNCTION_FAILED
;
/* fill the structure */
cv
->
view
.
ops
=
&
create_ops
;
msiobj_addref
(
&
db
->
hdr
);
...
...
dlls/msi/tests/db.c
View file @
2924501a
...
...
@@ -1203,6 +1203,13 @@ static void test_markers(void)
r
=
run_query
(
hdb
,
rec
,
query
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* verify that we just created a table called '?', not 'Fable' */
r
=
try_query
(
hdb
,
"SELECT * from `Fable`"
);
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
r
=
try_query
(
hdb
,
"SELECT * from `?`"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* try table name as marker without backticks */
MsiRecordSetString
(
rec
,
1
,
"Mable"
);
query
=
"CREATE TABLE ? ( `One` SHORT NOT NULL, `Two` CHAR(255) PRIMARY KEY `One`)"
;
...
...
@@ -1232,10 +1239,7 @@ static void test_markers(void)
MsiRecordSetString
(
rec
,
3
,
"One"
);
query
=
"CREATE TABLE `Mable` ( `?` SHORT NOT NULL, `?` CHAR(255) PRIMARY KEY `?`)"
;
r
=
run_query
(
hdb
,
rec
,
query
);
todo_wine
{
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_BAD_QUERY_SYNTAX
,
"Expected ERROR_BAD_QUERY_SYNTAX, got %d
\n
"
,
r
);
/* try names with backticks, minus definitions */
query
=
"CREATE TABLE `Mable` ( `?`, `?` PRIMARY KEY `?`)"
;
...
...
@@ -1271,6 +1275,9 @@ static void test_markers(void)
r
=
run_query
(
hdb
,
0
,
query
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
r
=
try_query
(
hdb
,
"SELECT * from `Table`"
);
ok
(
r
==
ERROR_SUCCESS
,
"Expected ERROR_SUCCESS, got %d
\n
"
,
r
);
/* try values as markers */
MsiCloseHandle
(
rec
);
rec
=
MsiCreateRecord
(
2
);
...
...
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