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
ca49aae6
Commit
ca49aae6
authored
Dec 23, 2011
by
Hans Leidekker
Committed by
Alexandre Julliard
Dec 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Fix handling of single quoted column names in SELECT queries.
parent
bde25b2c
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
331 additions
and
20 deletions
+331
-20
msipriv.h
dlls/msi/msipriv.h
+1
-0
msiquery.c
dlls/msi/msiquery.c
+2
-0
select.c
dlls/msi/select.c
+29
-10
sql.y
dlls/msi/sql.y
+49
-10
db.c
dlls/msi/tests/db.c
+250
-0
No files found.
dlls/msi/msipriv.h
View file @
ca49aae6
...
...
@@ -47,6 +47,7 @@ static const BOOL is_64bit = sizeof(void *) > sizeof(int);
#define MSITYPE_NULLABLE 0x1000
#define MSITYPE_KEY 0x2000
#define MSITYPE_TEMPORARY 0x4000
#define MSITYPE_UNKNOWN 0x8000
#define MAX_STREAM_NAME_LEN 62
#define LONG_STR_BYTES 3
...
...
dlls/msi/msiquery.c
View file @
ca49aae6
...
...
@@ -501,6 +501,8 @@ static UINT msi_set_record_type_string( MSIRECORD *rec, UINT field,
szType
[
0
]
=
'v'
;
else
if
(
type
&
MSITYPE_LOCALIZABLE
)
szType
[
0
]
=
'l'
;
else
if
(
type
&
MSITYPE_UNKNOWN
)
szType
[
0
]
=
'f'
;
else
if
(
type
&
MSITYPE_STRING
)
{
if
(
temporary
)
...
...
dlls/msi/select.c
View file @
ca49aae6
...
...
@@ -57,11 +57,15 @@ static UINT SELECT_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT
if
(
!
sv
->
table
)
return
ERROR_FUNCTION_FAILED
;
if
(
(
col
==
0
)
||
(
col
>
sv
->
num_cols
)
)
if
(
!
col
||
col
>
sv
->
num_cols
)
return
ERROR_FUNCTION_FAILED
;
col
=
sv
->
cols
[
col
-
1
];
if
(
!
col
)
{
*
val
=
0
;
return
ERROR_SUCCESS
;
}
return
sv
->
table
->
ops
->
fetch_int
(
sv
->
table
,
row
,
col
,
val
);
}
...
...
@@ -74,11 +78,15 @@ static UINT SELECT_fetch_stream( struct tagMSIVIEW *view, UINT row, UINT col, IS
if
(
!
sv
->
table
)
return
ERROR_FUNCTION_FAILED
;
if
(
(
col
==
0
)
||
(
col
>
sv
->
num_cols
)
)
if
(
!
col
||
col
>
sv
->
num_cols
)
return
ERROR_FUNCTION_FAILED
;
col
=
sv
->
cols
[
col
-
1
];
if
(
!
col
)
{
*
stm
=
NULL
;
return
ERROR_SUCCESS
;
}
return
sv
->
table
->
ops
->
fetch_stream
(
sv
->
table
,
row
,
col
,
stm
);
}
...
...
@@ -218,11 +226,18 @@ static UINT SELECT_get_column_info( struct tagMSIVIEW *view, UINT n, LPCWSTR *na
if
(
!
sv
->
table
)
return
ERROR_FUNCTION_FAILED
;
if
(
(
n
==
0
)
||
(
n
>
sv
->
num_cols
)
)
if
(
!
n
||
n
>
sv
->
num_cols
)
return
ERROR_FUNCTION_FAILED
;
n
=
sv
->
cols
[
n
-
1
];
if
(
!
n
)
{
if
(
name
)
*
name
=
szEmpty
;
if
(
type
)
*
type
=
MSITYPE_UNKNOWN
|
MSITYPE_VALID
;
if
(
temporary
)
*
temporary
=
FALSE
;
if
(
table_name
)
*
table_name
=
szEmpty
;
return
ERROR_SUCCESS
;
}
return
sv
->
table
->
ops
->
get_column_info
(
sv
->
table
,
n
,
name
,
type
,
temporary
,
table_name
);
}
...
...
@@ -360,7 +375,7 @@ static const MSIVIEWOPS select_ops =
static
UINT
SELECT_AddColumn
(
MSISELECTVIEW
*
sv
,
LPCWSTR
name
,
LPCWSTR
table_name
)
{
UINT
r
,
n
=
0
;
UINT
r
,
n
;
MSIVIEW
*
table
;
TRACE
(
"%p adding %s.%s
\n
"
,
sv
,
debugstr_w
(
table_name
),
...
...
@@ -380,9 +395,13 @@ static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPCWSTR name,
if
(
sv
->
num_cols
>=
sv
->
max_cols
)
return
ERROR_FUNCTION_FAILED
;
r
=
VIEW_find_column
(
table
,
name
,
table_name
,
&
n
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
if
(
!
name
[
0
]
)
n
=
0
;
else
{
r
=
VIEW_find_column
(
table
,
name
,
table_name
,
&
n
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
}
sv
->
cols
[
sv
->
num_cols
]
=
n
;
TRACE
(
"Translating column %s from %d -> %d
\n
"
,
...
...
dlls/msi/sql.y
View file @
ca49aae6
...
...
@@ -111,8 +111,8 @@ static struct expr * EXPR_wildcard( void *info );
%nonassoc END_OF_FILE ILLEGAL SPACE UNCLOSED_STRING COMMENT FUNCTION
COLUMN AGG_FUNCTION.
%type <string> table tablelist id
%type <column_list> selcollist column column_and_type column_def table_def
%type <string> table tablelist id
string
%type <column_list> selcollist col
list selcolumn col
umn column_and_type column_def table_def
%type <column_list> column_assignment update_assign_list constlist
%type <query> query from selectfrom unorderdfrom
%type <query> oneupdate onedelete oneselect onequery onecreate oneinsert onealter onedrop
...
...
@@ -120,7 +120,6 @@ static struct expr * EXPR_wildcard( void *info );
%type <column_type> column_type data_type data_type_l data_count
%type <integer> number alterop
/* Reference: http://mates.ms.mff.cuni.cz/oracle/doc/ora815nt/server.815/a67779/operator.htm */
%left TK_OR
%left TK_AND
%left TK_NOT
...
...
@@ -148,7 +147,7 @@ onequery:
;
oneinsert:
TK_INSERT TK_INTO table TK_LP
sel
collist TK_RP TK_VALUES TK_LP constlist TK_RP
TK_INSERT TK_INTO table TK_LP collist TK_RP TK_VALUES TK_LP constlist TK_RP
{
SQL_input *sql = (SQL_input*) info;
MSIVIEW *insert = NULL;
...
...
@@ -159,7 +158,7 @@ oneinsert:
PARSER_BUBBLE_UP_VIEW( sql, $$, insert );
}
| TK_INSERT TK_INTO table TK_LP
sel
collist TK_RP TK_VALUES TK_LP constlist TK_RP TK_TEMPORARY
| TK_INSERT TK_INTO table TK_LP collist TK_RP TK_VALUES TK_LP constlist TK_RP TK_TEMPORARY
{
SQL_input *sql = (SQL_input*) info;
MSIVIEW *insert = NULL;
...
...
@@ -307,7 +306,7 @@ onedrop:
;
table_def:
column_def TK_PRIMARY TK_KEY
sel
collist
column_def TK_PRIMARY TK_KEY collist
{
if( SQL_MarkPrimaryKeys( &$1, $4 ) )
$$ = $1;
...
...
@@ -448,8 +447,20 @@ selectfrom:
;
selcollist:
selcolumn
| selcolumn TK_COMMA selcollist
{
$1->next = $3;
}
| TK_STAR
{
$$ = NULL;
}
;
collist:
column
| column TK_COMMA
sel
collist
| column TK_COMMA collist
{
$1->next = $3;
}
...
...
@@ -472,7 +483,7 @@ from:
PARSER_BUBBLE_UP_VIEW( sql, $$, table );
}
| unorderdfrom TK_ORDER TK_BY
sel
collist
| unorderdfrom TK_ORDER TK_BY collist
{
UINT r;
...
...
@@ -520,8 +531,7 @@ tablelist:
{
$$ = $1;
}
|
table TK_COMMA tablelist
| table TK_COMMA tablelist
{
$$ = parser_add_table( info, $3, $1 );
if (!$$)
...
...
@@ -689,6 +699,27 @@ column:
}
;
selcolumn:
table TK_DOT id
{
$$ = parser_alloc_column( info, $1, $3 );
if( !$$ )
YYABORT;
}
| id
{
$$ = parser_alloc_column( info, NULL, $1 );
if( !$$ )
YYABORT;
}
| string
{
$$ = parser_alloc_column( info, NULL, $1 );
if( !$$ )
YYABORT;
}
;
table:
id
{
...
...
@@ -704,6 +735,14 @@ id:
}
;
string:
TK_STRING
{
if ( SQL_getstring( info, &$1, &$$ ) != ERROR_SUCCESS || !$$ )
YYABORT;
}
;
number:
TK_INTEGER
{
...
...
dlls/msi/tests/db.c
View file @
ca49aae6
This diff is collapsed.
Click to expand it.
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