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
f6492dc5
Commit
f6492dc5
authored
Jul 04, 2004
by
Mike McCormack
Committed by
Alexandre Julliard
Jul 04, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create the WHERE part of a query in one function call.
parent
ed7c4bc8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
72 deletions
+45
-72
query.h
dlls/msi/query.h
+2
-2
sql.y
dlls/msi/sql.y
+16
-22
where.c
dlls/msi/where.c
+27
-48
No files found.
dlls/msi/query.h
View file @
f6492dc5
...
...
@@ -110,8 +110,8 @@ UINT DISTINCT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table );
UINT
ORDER_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
);
UINT
ORDER_AddColumn
(
MSIVIEW
*
group
,
LPWSTR
name
);
UINT
WHERE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
);
UINT
WHERE_AddCondition
(
MSIVIEW
*
view
,
struct
expr
*
condition
);
UINT
WHERE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
,
struct
expr
*
cond
);
UINT
CREATE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPWSTR
table
,
create_col_info
*
col_info
,
BOOL
temp
);
...
...
dlls/msi/sql.y
View file @
f6492dc5
...
...
@@ -215,40 +215,37 @@ column_def:
;
ci->next = HeapAlloc( GetProcessHeap(), 0, sizeof *$$ );
if( ci->next )
if(
!
ci->next )
{
ci->next->colname = $3;
ci->next->type = $4;
ci->next->next = NULL;
}
else if( $1 )
{
HeapFree( GetProcessHeap(), 0, $1 );
$1 = NULL;
/* FIXME: free $1 */
YYABORT;
}
ci->next->colname = $3;
ci->next->type = $4;
ci->next->next = NULL;
$$ = $1;
}
| column column_type
{
$$ = HeapAlloc( GetProcessHeap(), 0, sizeof *$$ );
if( $$ )
{
$$->colname = $1;
$$->type = $2;
$$->next = NULL;
}
if( ! $$ )
YYABORT;
$$->colname = $1;
$$->type = $2;
$$->next = NULL;
}
;
column_type:
data_type_l
{
$$ = $1;
$$ = $1
| MSITYPE_VALID
;
}
| data_type_l TK_LOCALIZABLE
{
FIXME("LOCALIZABLE ignored\n");
$$ = $1;
$$ = $1
| MSITYPE_VALID
;
}
;
...
...
@@ -270,7 +267,7 @@ data_type:
}
| TK_CHAR TK_LP data_count TK_RP
{
$$ = MSITYPE_STRING | 0x
5
00 | $3;
$$ = MSITYPE_STRING | 0x
4
00 | $3;
}
| TK_LONGCHAR
{
...
...
@@ -397,10 +394,7 @@ from:
r = TABLE_CreateView( sql->db, $2, &view );
if( r != ERROR_SUCCESS )
YYABORT;
r = WHERE_CreateView( sql->db, &view, view );
if( r != ERROR_SUCCESS )
YYABORT;
r = WHERE_AddCondition( view, $4 );
r = WHERE_CreateView( sql->db, &view, view, $4 );
if( r != ERROR_SUCCESS )
YYABORT;
$$ = view;
...
...
dlls/msi/where.c
View file @
f6492dc5
...
...
@@ -321,36 +321,6 @@ MSIVIEWOPS where_ops =
WHERE_delete
};
UINT
WHERE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
)
{
MSIWHEREVIEW
*
wv
=
NULL
;
UINT
count
=
0
,
r
;
TRACE
(
"%p
\n
"
,
wv
);
r
=
table
->
ops
->
get_dimensions
(
table
,
NULL
,
&
count
);
if
(
r
!=
ERROR_SUCCESS
)
{
ERR
(
"can't get table dimensions
\n
"
);
return
r
;
}
wv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
*
wv
);
if
(
!
wv
)
return
ERROR_FUNCTION_FAILED
;
/* fill the structure */
wv
->
view
.
ops
=
&
where_ops
;
wv
->
db
=
db
;
wv
->
table
=
table
;
wv
->
row_count
=
0
;
wv
->
reorder
=
NULL
;
wv
->
cond
=
NULL
;
*
view
=
(
MSIVIEW
*
)
wv
;
return
ERROR_SUCCESS
;
}
static
UINT
WHERE_VerifyCondition
(
MSIDATABASE
*
db
,
MSIVIEW
*
table
,
struct
expr
*
cond
,
UINT
*
valid
)
{
...
...
@@ -423,33 +393,42 @@ static UINT WHERE_VerifyCondition( MSIDATABASE *db, MSIVIEW *table, struct expr
return
ERROR_SUCCESS
;
}
UINT
WHERE_AddCondition
(
MSIVIEW
*
view
,
struct
expr
*
cond
)
UINT
WHERE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
,
struct
expr
*
cond
)
{
MSIWHEREVIEW
*
wv
=
(
MSIWHEREVIEW
*
)
view
;
UINT
r
,
valid
=
0
;
if
(
wv
->
view
.
ops
!=
&
where_ops
)
return
ERROR_FUNCTION_FAILED
;
if
(
!
wv
->
table
)
return
ERROR_INVALID_PARAMETER
;
if
(
!
cond
)
return
ERROR_SUCCESS
;
MSIWHEREVIEW
*
wv
=
NULL
;
UINT
count
=
0
,
r
,
valid
=
0
;
TRACE
(
"
Adding condition
\n
"
);
TRACE
(
"
%p
\n
"
,
wv
);
r
=
WHERE_VerifyCondition
(
wv
->
db
,
wv
->
table
,
cond
,
&
valid
);
r
=
table
->
ops
->
get_dimensions
(
table
,
NULL
,
&
count
);
if
(
r
!=
ERROR_SUCCESS
)
ERR
(
"condition evaluation failed
\n
"
);
{
ERR
(
"can't get table dimensions
\n
"
);
return
r
;
}
TRACE
(
"condition is %s
\n
"
,
valid
?
"valid"
:
"invalid"
);
if
(
!
valid
)
if
(
cond
)
{
delete_expr
(
cond
);
return
ERROR_FUNCTION_FAILED
;
r
=
WHERE_VerifyCondition
(
db
,
table
,
cond
,
&
valid
);
if
(
r
!=
ERROR_SUCCESS
)
return
r
;
if
(
!
valid
)
return
ERROR_FUNCTION_FAILED
;
}
wv
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
*
wv
);
if
(
!
wv
)
return
ERROR_FUNCTION_FAILED
;
/* fill the structure */
wv
->
view
.
ops
=
&
where_ops
;
wv
->
db
=
db
;
wv
->
table
=
table
;
wv
->
row_count
=
0
;
wv
->
reorder
=
NULL
;
wv
->
cond
=
cond
;
*
view
=
(
MSIVIEW
*
)
wv
;
return
ERROR_SUCCESS
;
}
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