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
d1a55eb3
Commit
d1a55eb3
authored
May 29, 2005
by
Mike McCormack
Committed by
Alexandre Julliard
May 29, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of some redundant parser types.
parent
309ae278
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
85 additions
and
112 deletions
+85
-112
create.c
dlls/msi/create.c
+5
-5
insert.c
dlls/msi/insert.c
+1
-1
order.c
dlls/msi/order.c
+3
-3
query.h
dlls/msi/query.h
+14
-25
select.c
dlls/msi/select.c
+3
-3
sql.y
dlls/msi/sql.y
+55
-71
update.c
dlls/msi/update.c
+4
-4
No files found.
dlls/msi/create.c
View file @
d1a55eb3
...
...
@@ -44,7 +44,7 @@ typedef struct tagMSICREATEVIEW
MSIDATABASE
*
db
;
LPWSTR
name
;
BOOL
bIsTemp
;
c
reate_col_info
*
col_info
;
c
olumn_info
*
col_info
;
}
MSICREATEVIEW
;
static
UINT
CREATE_fetch_int
(
struct
tagMSIVIEW
*
view
,
UINT
row
,
UINT
col
,
UINT
*
val
)
...
...
@@ -59,7 +59,7 @@ static UINT CREATE_fetch_int( struct tagMSIVIEW *view, UINT row, UINT col, UINT
static
UINT
CREATE_execute
(
struct
tagMSIVIEW
*
view
,
MSIRECORD
*
record
)
{
MSICREATEVIEW
*
cv
=
(
MSICREATEVIEW
*
)
view
;
c
reate_col
_info
*
col
;
c
olumn
_info
*
col
;
UINT
r
,
nField
,
row
,
table_val
,
column_val
;
static
const
WCHAR
szTables
[]
=
{
'_'
,
'T'
,
'a'
,
'b'
,
'l'
,
'e'
,
's'
,
0
};
static
const
WCHAR
szColumns
[]
=
{
'_'
,
'C'
,
'o'
,
'l'
,
'u'
,
'm'
,
'n'
,
's'
,
0
};
...
...
@@ -122,8 +122,8 @@ static UINT CREATE_execute( struct tagMSIVIEW *view, MSIRECORD *record )
if
(
r
)
goto
err
;
column_val
=
msi_addstringW
(
cv
->
db
->
strings
,
0
,
col
->
col
name
,
-
1
,
1
);
TRACE
(
"New string %s -> %d
\n
"
,
debugstr_w
(
col
->
col
name
),
column_val
);
column_val
=
msi_addstringW
(
cv
->
db
->
strings
,
0
,
col
->
col
umn
,
-
1
,
1
);
TRACE
(
"New string %s -> %d
\n
"
,
debugstr_w
(
col
->
col
umn
),
column_val
);
if
(
column_val
<
0
)
break
;
...
...
@@ -226,7 +226,7 @@ MSIVIEWOPS create_ops =
};
UINT
CREATE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPWSTR
table
,
c
reate_col
_info
*
col_info
,
BOOL
temp
)
c
olumn
_info
*
col_info
,
BOOL
temp
)
{
MSICREATEVIEW
*
cv
=
NULL
;
...
...
dlls/msi/insert.c
View file @
d1a55eb3
...
...
@@ -255,7 +255,7 @@ MSIVIEWOPS insert_ops =
};
UINT
INSERT_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPWSTR
table
,
string_list
*
columns
,
value_list
*
values
,
BOOL
temp
)
column_info
*
columns
,
value_list
*
values
,
BOOL
temp
)
{
MSIINSERTVIEW
*
iv
=
NULL
;
UINT
r
;
...
...
dlls/msi/order.c
View file @
d1a55eb3
...
...
@@ -302,11 +302,11 @@ static UINT ORDER_AddColumn( MSIORDERVIEW *ov, LPCWSTR name )
}
UINT
ORDER_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
,
string_list
*
columns
)
column_info
*
columns
)
{
MSIORDERVIEW
*
ov
=
NULL
;
UINT
count
=
0
,
r
;
string_list
*
x
;
column_info
*
x
;
TRACE
(
"%p
\n
"
,
ov
);
...
...
@@ -332,7 +332,7 @@ UINT ORDER_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
*
view
=
(
MSIVIEW
*
)
ov
;
for
(
x
=
columns
;
x
;
x
=
x
->
next
)
ORDER_AddColumn
(
ov
,
x
->
string
);
ORDER_AddColumn
(
ov
,
x
->
column
);
return
ERROR_SUCCESS
;
}
dlls/msi/query.h
View file @
d1a55eb3
...
...
@@ -59,11 +59,14 @@ struct sql_str {
INT
len
;
};
typedef
struct
_
string_list
typedef
struct
_
column_info
{
LPWSTR
string
;
struct
_string_list
*
next
;
}
string_list
;
LPCWSTR
table
;
LPCWSTR
column
;
UINT
type
;
struct
expr
*
val
;
struct
_column_info
*
next
;
}
column_info
;
struct
complex_expr
{
...
...
@@ -80,56 +83,42 @@ struct expr
struct
complex_expr
expr
;
INT
ival
;
UINT
uval
;
LPWSTR
sval
;
LPWSTR
column
;
LP
C
WSTR
sval
;
LP
C
WSTR
column
;
UINT
col_number
;
}
u
;
};
typedef
struct
_create_col_info
{
LPWSTR
colname
;
UINT
type
;
struct
_create_col_info
*
next
;
}
create_col_info
;
typedef
struct
_value_list
{
struct
expr
*
val
;
struct
_value_list
*
next
;
}
value_list
;
typedef
struct
_column_assignment
{
string_list
*
col_list
;
value_list
*
val_list
;
}
column_assignment
;
UINT
MSI_ParseSQL
(
MSIDATABASE
*
db
,
LPCWSTR
command
,
MSIVIEW
**
phview
,
struct
list
*
mem
);
UINT
TABLE_CreateView
(
MSIDATABASE
*
db
,
LPCWSTR
name
,
MSIVIEW
**
view
);
UINT
SELECT_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
,
string_list
*
columns
);
column_info
*
columns
);
UINT
DISTINCT_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
);
UINT
ORDER_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
,
string_list
*
columns
);
column_info
*
columns
);
UINT
WHERE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
,
struct
expr
*
cond
);
UINT
CREATE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPWSTR
table
,
c
reate_col
_info
*
col_info
,
BOOL
temp
);
c
olumn
_info
*
col_info
,
BOOL
temp
);
UINT
INSERT_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPWSTR
table
,
string_list
*
columns
,
value_list
*
values
,
BOOL
temp
);
column_info
*
columns
,
value_list
*
values
,
BOOL
temp
);
UINT
UPDATE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
,
LPWSTR
table
,
column_
assignment
*
list
,
struct
expr
*
expr
);
column_
info
*
list
,
struct
expr
*
expr
);
UINT
DELETE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
);
...
...
dlls/msi/select.c
View file @
d1a55eb3
...
...
@@ -210,7 +210,7 @@ MSIVIEWOPS select_ops =
SELECT_delete
};
static
UINT
SELECT_AddColumn
(
MSISELECTVIEW
*
sv
,
LPWSTR
name
)
static
UINT
SELECT_AddColumn
(
MSISELECTVIEW
*
sv
,
LP
C
WSTR
name
)
{
UINT
r
,
n
=
0
;
MSIVIEW
*
table
;
...
...
@@ -245,7 +245,7 @@ static UINT SELECT_AddColumn( MSISELECTVIEW *sv, LPWSTR name )
}
UINT
SELECT_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
,
string_list
*
columns
)
column_info
*
columns
)
{
MSISELECTVIEW
*
sv
=
NULL
;
UINT
count
=
0
,
r
;
...
...
@@ -273,7 +273,7 @@ UINT SELECT_CreateView( MSIDATABASE *db, MSIVIEW **view, MSIVIEW *table,
while
(
columns
)
{
r
=
SELECT_AddColumn
(
sv
,
columns
->
string
);
r
=
SELECT_AddColumn
(
sv
,
columns
->
column
);
if
(
r
)
break
;
columns
=
columns
->
next
;
...
...
dlls/msi/sql.y
View file @
d1a55eb3
...
...
@@ -55,11 +55,12 @@ static INT SQL_getint( void *info );
static int SQL_lex( void *SQL_lval, SQL_input *info );
static void *parser_alloc( void *info, unsigned int sz );
static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column );
static BOOL SQL_MarkPrimaryKeys( c
reate_col_info *cols, string_list
*keys);
static BOOL SQL_MarkPrimaryKeys( c
olumn_info *cols, column_info
*keys);
static struct expr * EXPR_complex( void *info, struct expr *l, UINT op, struct expr *r );
static struct expr * EXPR_column( void *info,
LPWSTR
column );
static struct expr * EXPR_column( void *info,
column_info *
column );
static struct expr * EXPR_ival( void *info, struct sql_str *, int sign );
static struct expr * EXPR_sval( void *info, struct sql_str * );
static struct expr * EXPR_wildcard( void *info );
...
...
@@ -72,13 +73,11 @@ static struct expr * EXPR_wildcard( void *info );
{
struct sql_str str;
LPWSTR string;
string_list
*column_list;
column_info
*column_list;
value_list *val_list;
MSIVIEW *query;
struct expr *expr;
USHORT column_type;
create_col_info *column_info;
column_assignment update_col_info;
}
%token TK_ABORT TK_AFTER TK_AGG_FUNCTION TK_ALL TK_AND TK_AS TK_ASC
...
...
@@ -125,15 +124,14 @@ static struct expr * EXPR_wildcard( void *info );
%nonassoc END_OF_FILE ILLEGAL SPACE UNCLOSED_STRING COMMENT FUNCTION
COLUMN AGG_FUNCTION.
%type <string> column table id
%type <column_list> selcollist
%type <query> query from fromtable unorderedsel selectfrom
%type <string> table id
%type <column_list> selcollist column column_and_type column_def table_def
%type <column_list> column_assignment update_assign_list
%type <query> query from fromtable selectfrom unorderedsel
%type <query> oneupdate onedelete oneselect onequery onecreate oneinsert
%type <expr> expr val column_val const_val
%type <column_type> column_type data_type data_type_l data_count
%type <column_info> column_def table_def
%type <val_list> constlist
%type <update_col_info> column_assignment update_assign_list
%%
...
...
@@ -210,7 +208,7 @@ oneupdate:
SQL_input* sql = (SQL_input*) info;
MSIVIEW *update = NULL;
UPDATE_CreateView( sql->db, &update, $2,
&
$4, $6 );
UPDATE_CreateView( sql->db, &update, $2, $4, $6 );
if( !update )
YYABORT;
$$ = update;
...
...
@@ -241,33 +239,27 @@ table_def:
;
column_def:
column_def TK_COMMA column
column
_type
column_def TK_COMMA column
_and
_type
{
c
reate_col
_info *ci;
c
olumn
_info *ci;
for( ci = $1; ci->next; ci = ci->next )
;
ci->next = HeapAlloc( GetProcessHeap(), 0, sizeof *$$ );
if( !ci->next )
{
/* FIXME: free $1 */
YYABORT;
}
ci->next->colname = $3;
ci->next->type = $4;
ci->next->next = NULL;
ci->next = $3;
$$ = $1;
}
| column
column
_type
| column
_and
_type
{
$$ = HeapAlloc( GetProcessHeap(), 0, sizeof *$$ );
if( ! $$ )
YYABORT;
$$->colname = $1;
$$ = $1;
}
;
column_and_type:
column column_type
{
$$ = $1;
$$->type = $2;
$$->next = NULL;
}
;
...
...
@@ -386,30 +378,9 @@ selectfrom:
selcollist:
column
{
string_list *list;
list = HeapAlloc( GetProcessHeap(), 0, sizeof *list );
if( !list )
YYABORT;
list->string = $1;
list->next = NULL;
$$ = list;
TRACE("Collist %s\n",debugstr_w($$->string));
}
| column TK_COMMA selcollist
{
string_list *list;
list = HeapAlloc( GetProcessHeap(), 0, sizeof *list );
if( !list )
YYABORT;
list->string = $1;
list->next = $3;
$$ = list;
TRACE("From table: %s\n",debugstr_w($$->string));
$1->next = $3;
}
| TK_STAR
{
...
...
@@ -553,25 +524,16 @@ update_assign_list:
column_assignment
| column_assignment TK_COMMA update_assign_list
{
$1.col_list->next = $3.col_list;
$1.val_list->next = $3.val_list;
$$ = $1;
$$->next = $3;
}
;
column_assignment:
column TK_EQ const_val
{
$$.col_list = HeapAlloc( GetProcessHeap(), 0, sizeof *$$.col_list );
if( !$$.col_list )
YYABORT;
$$.col_list->string = $1;
$$.col_list->next = NULL;
$$.val_list = HeapAlloc( GetProcessHeap(), 0, sizeof *$$.val_list );
if( !$$.val_list )
YYABORT;
$$.val_list->val = $3;
$$.val_list->next = 0;
$$ = $1;
$$->val = $3;
}
;
...
...
@@ -614,11 +576,15 @@ column_val:
column:
table TK_DOT id
{
$$ = $3; /* FIXME */
$$ = parser_alloc_column( info, $1, $3 );
if( !$$ )
YYABORT;
}
| id
{
$$ = $1;
$$ = parser_alloc_column( info, NULL, $1 );
if( !$$ )
YYABORT;
}
;
...
...
@@ -650,6 +616,23 @@ static void *parser_alloc( void *info, unsigned int sz )
return &mem[1];
}
static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column )
{
column_info *col;
col = parser_alloc( info, sizeof (*col) );
if( col )
{
col->table = table;
col->column = column;
col->val = NULL;
col->type = 0;
col->next = NULL;
}
return col;
}
int SQL_lex( void *SQL_lval, SQL_input *sql )
{
int token;
...
...
@@ -733,13 +716,13 @@ static struct expr * EXPR_complex( void *info, struct expr *l, UINT op, struct e
return e;
}
static struct expr * EXPR_column( void *info,
LPWSTR
column )
static struct expr * EXPR_column( void *info,
column_info *
column )
{
struct expr *e = parser_alloc( info, sizeof *e );
if( e )
{
e->type = EXPR_COLUMN;
e->u.sval = column;
e->u.sval = column
->column
;
}
return e;
}
...
...
@@ -766,19 +749,20 @@ static struct expr * EXPR_sval( void *info, struct sql_str *str )
return e;
}
static BOOL SQL_MarkPrimaryKeys( create_col_info *cols, string_list *keys)
static BOOL SQL_MarkPrimaryKeys( column_info *cols,
column_info *keys )
{
string_list
*k;
column_info
*k;
BOOL found = TRUE;
for( k = keys; k && found; k = k->next )
{
c
reate_col
_info *c;
c
olumn
_info *c;
found = FALSE;
for( c = cols; c && !found; c = c->next )
{
if( lstrcmpW( k->
string, c->colname
) )
if( lstrcmpW( k->
column, c->column
) )
continue;
c->type |= MSITYPE_KEY;
found = TRUE;
...
...
dlls/msi/update.c
View file @
d1a55eb3
...
...
@@ -43,7 +43,7 @@ typedef struct tagMSIUPDATEVIEW
MSIVIEW
view
;
MSIDATABASE
*
db
;
MSIVIEW
*
wv
;
value_list
*
vals
;
column_info
*
vals
;
}
MSIUPDATEVIEW
;
static
UINT
UPDATE_fetch_int
(
struct
tagMSIVIEW
*
view
,
UINT
row
,
UINT
col
,
UINT
*
val
)
...
...
@@ -193,7 +193,7 @@ static MSIVIEWOPS update_ops =
};
UINT
UPDATE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPWSTR
table
,
column_
assignment
*
list
,
struct
expr
*
expr
)
column_
info
*
columns
,
struct
expr
*
expr
)
{
MSIUPDATEVIEW
*
uv
=
NULL
;
UINT
r
;
...
...
@@ -215,7 +215,7 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
}
/* then select the columns we want */
r
=
SELECT_CreateView
(
db
,
&
sv
,
wv
,
list
->
col_list
);
r
=
SELECT_CreateView
(
db
,
&
sv
,
wv
,
columns
);
if
(
r
!=
ERROR_SUCCESS
)
{
if
(
tv
)
...
...
@@ -231,7 +231,7 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPWSTR table,
uv
->
view
.
ops
=
&
update_ops
;
msiobj_addref
(
&
db
->
hdr
);
uv
->
db
=
db
;
uv
->
vals
=
list
->
val_list
;
uv
->
vals
=
columns
;
uv
->
wv
=
sv
;
*
view
=
(
MSIVIEW
*
)
uv
;
...
...
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