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
2e6ed06f
Commit
2e6ed06f
authored
Aug 01, 2007
by
James Hawkins
Committed by
Alexandre Julliard
Aug 02, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msi: Reimplement joins to allow joining any number of tables, each of arbitrary size.
parent
4f6a93b9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
23 deletions
+41
-23
join.c
dlls/msi/join.c
+0
-0
query.h
dlls/msi/query.h
+1
-2
sql.y
dlls/msi/sql.y
+32
-4
db.c
dlls/msi/tests/db.c
+8
-17
No files found.
dlls/msi/join.c
View file @
2e6ed06f
This diff is collapsed.
Click to expand it.
dlls/msi/query.h
View file @
2e6ed06f
...
...
@@ -119,8 +119,7 @@ UINT UPDATE_CreateView( MSIDATABASE *db, MSIVIEW **view, LPCWSTR table,
UINT
DELETE_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
MSIVIEW
*
table
);
UINT
JOIN_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPCWSTR
left
,
LPCWSTR
right
);
UINT
JOIN_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPWSTR
tables
);
UINT
ALTER_CreateView
(
MSIDATABASE
*
db
,
MSIVIEW
**
view
,
LPCWSTR
name
,
column_info
*
colinfo
,
int
hold
);
...
...
dlls/msi/sql.y
View file @
2e6ed06f
...
...
@@ -53,6 +53,7 @@ static LPWSTR SQL_getstring( void *info, const struct sql_str *str );
static INT SQL_getint( void *info );
static int sql_lex( void *SQL_lval, SQL_input *info );
static LPWSTR parser_add_table( LPWSTR list, LPWSTR table );
static void *parser_alloc( void *info, unsigned int sz );
static column_info *parser_alloc_column( void *info, LPCWSTR table, LPCWSTR column );
...
...
@@ -101,7 +102,7 @@ static struct expr * EXPR_wildcard( void *info );
%nonassoc END_OF_FILE ILLEGAL SPACE UNCLOSED_STRING COMMENT FUNCTION
COLUMN AGG_FUNCTION.
%type <string> table id
%type <string> table
tablelist
id
%type <column_list> selcollist column column_and_type column_def table_def
%type <column_list> column_assignment update_assign_list constlist
%type <query> query from fromtable selectfrom unorderedsel
...
...
@@ -466,18 +467,32 @@ fromtable:
if( r != ERROR_SUCCESS || !$$ )
YYABORT;
}
| TK_FROM table
TK_COMMA table
| TK_FROM table
list
{
SQL_input* sql = (SQL_input*) info;
UINT r;
/* only support inner joins on two tables */
r = JOIN_CreateView( sql->db, &$$, $2, $4
);
r = JOIN_CreateView( sql->db, &$$, $2 );
msi_free( $2
);
if( r != ERROR_SUCCESS )
YYABORT;
}
;
tablelist:
table
{
$$ = strdupW($1);
}
|
table TK_COMMA tablelist
{
$$ = parser_add_table($3, $1);
if (!$$)
YYABORT;
}
;
expr:
TK_LP expr TK_RP
{
...
...
@@ -663,6 +678,19 @@ number:
%%
static LPWSTR parser_add_table(LPWSTR list, LPWSTR table)
{
DWORD size = lstrlenW(list) + lstrlenW(table) + 2;
static const WCHAR space[] = {' ',0};
list = msi_realloc(list, size * sizeof(WCHAR));
if (!list) return NULL;
lstrcatW(list, space);
lstrcatW(list, table);
return list;
}
static void *parser_alloc( void *info, unsigned int sz )
{
SQL_input* sql = (SQL_input*) info;
...
...
dlls/msi/tests/db.c
View file @
2e6ed06f
...
...
@@ -2890,10 +2890,7 @@ static void test_join(void)
ok
(
r
==
ERROR_SUCCESS
,
"failed to open view: %d
\n
"
,
r
);
r
=
MsiViewExecute
(
hview
,
0
);
todo_wine
{
ok
(
r
==
ERROR_SUCCESS
,
"failed to execute view: %d
\n
"
,
r
);
}
ok
(
r
==
ERROR_SUCCESS
,
"failed to execute view: %d
\n
"
,
r
);
i
=
0
;
data_correct
=
TRUE
;
...
...
@@ -2919,10 +2916,7 @@ static void test_join(void)
}
ok
(
data_correct
,
"data returned in the wrong order
\n
"
);
todo_wine
{
ok
(
i
==
6
,
"Expected 6 rows, got %d
\n
"
,
i
);
}
ok
(
i
==
6
,
"Expected 6 rows, got %d
\n
"
,
i
);
ok
(
r
==
ERROR_NO_MORE_ITEMS
,
"expected no more items: %d
\n
"
,
r
);
MsiViewClose
(
hview
);
...
...
@@ -3000,7 +2994,7 @@ static void test_join(void)
MsiCloseHandle
(
hrec
);
}
todo_wine
ok
(
data_correct
,
"data returned in the wrong order
\n
"
);
ok
(
data_correct
,
"data returned in the wrong order
\n
"
);
ok
(
i
==
6
,
"Expected 6 rows, got %d
\n
"
,
i
);
ok
(
r
==
ERROR_NO_MORE_ITEMS
,
"expected no more items: %d
\n
"
,
r
);
...
...
@@ -3048,7 +3042,7 @@ static void test_join(void)
i
++
;
MsiCloseHandle
(
hrec
);
}
todo_wine
ok
(
data_correct
,
"data returned in the wrong order
\n
"
);
ok
(
data_correct
,
"data returned in the wrong order
\n
"
);
ok
(
i
==
6
,
"Expected 6 rows, got %d
\n
"
,
i
);
ok
(
r
==
ERROR_NO_MORE_ITEMS
,
"expected no more items: %d
\n
"
,
r
);
...
...
@@ -3058,10 +3052,10 @@ static void test_join(void)
query
=
"SELECT * FROM `One`, `Two`, `Three` "
;
r
=
MsiDatabaseOpenView
(
hdb
,
query
,
&
hview
);
todo_wine
ok
(
r
==
ERROR_SUCCESS
,
"failed to open view: %d
\n
"
,
r
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to open view: %d
\n
"
,
r
);
r
=
MsiViewExecute
(
hview
,
0
);
todo_wine
ok
(
r
==
ERROR_SUCCESS
,
"failed to execute view: %d
\n
"
,
r
);
ok
(
r
==
ERROR_SUCCESS
,
"failed to execute view: %d
\n
"
,
r
);
i
=
0
;
data_correct
=
TRUE
;
...
...
@@ -3099,11 +3093,8 @@ static void test_join(void)
}
ok
(
data_correct
,
"data returned in the wrong order
\n
"
);
todo_wine
{
ok
(
i
==
6
,
"Expected 6 rows, got %d
\n
"
,
i
);
ok
(
r
==
ERROR_NO_MORE_ITEMS
,
"expected no more items: %d
\n
"
,
r
);
}
ok
(
i
==
6
,
"Expected 6 rows, got %d
\n
"
,
i
);
ok
(
r
==
ERROR_NO_MORE_ITEMS
,
"expected no more items: %d
\n
"
,
r
);
MsiViewClose
(
hview
);
MsiCloseHandle
(
hview
);
...
...
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