Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
29f61620
Commit
29f61620
authored
Jun 25, 2004
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
af
parent
6fa845d7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1677 additions
and
410 deletions
+1677
-410
sql/sql_select.cc
sql/sql_select.cc
+1610
-379
sql/sql_yacc.yy
sql/sql_yacc.yy
+67
-31
No files found.
sql/sql_select.cc
View file @
29f61620
This source diff could not be displayed because it is too large. You can
view the blob
instead.
sql/sql_yacc.yy
View file @
29f61620
...
...
@@ -700,6 +700,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%type <table_list>
join_table_list join_table
table_factor table_ref
%type <date_time_type> date_time_type;
%type <interval> interval
...
...
@@ -4430,59 +4431,80 @@ when_list2:
sel->when_list.head()->push_back($5);
};
join_table_list
:
'(' join_table_list ')' { $$=$2
; }
table_ref
:
table_factor { $$=$1
; }
| join_table { $$=$1; }
| join_table_list ',' join_table_list { $$=$3; }
| join_table_list normal_join join_table_list { $$=$3; }
| join_table_list STRAIGHT_JOIN join_table_list
{ $$=$3 ; $1->next->straight=1; }
| join_table_list normal_join join_table_list ON expr
{
LEX *lex= Lex;
if (!($$= lex->current_select->nest_last_join(lex->thd)))
YYABORT;
}
;
join_table_list:
table_ref { $$=$1; }
| join_table_list ',' table_ref { $$=$3; }
;
join_table:
table_ref normal_join table_ref { $$=$3; }
| table_ref STRAIGHT_JOIN table_factor
{ $3->straight=1; $$=$3 ; }
| table_ref normal_join table_ref ON expr
{ add_join_on($3,$5); $$=$3; }
|
join_table_list normal_join join_table_list
|
table_ref normal_join table_ref
USING
{
SELECT_LEX *sel= Select;
sel->db1=$1->db; sel->table1=$1->alias;
sel->db2=$3->db; sel->table2=$3->alias;
sel->save_names_for_using_list($1, $3);
}
'(' using_list ')'
{ add_join_on($3,$7); $$=$3; }
|
join_table_list LEFT opt_outer JOIN_SYM join_table_list
ON expr
|
table_ref LEFT opt_outer JOIN_SYM table_factor
ON expr
{ add_join_on($5,$7); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
|
join_table_list LEFT opt_outer JOIN_SYM join_table_list
|
table_ref LEFT opt_outer JOIN_SYM table_factor
{
SELECT_LEX *sel= Select;
sel->db1=$1->db; sel->table1=$1->alias;
sel->db2=$5->db; sel->table2=$5->alias;
sel->save_names_for_using_list($1, $5);
}
USING '(' using_list ')'
{ add_join_on($5,$9); $5->outer_join|=JOIN_TYPE_LEFT; $$=$5; }
|
join_table_list NATURAL LEFT opt_outer JOIN_SYM join_table_list
|
table_ref NATURAL LEFT opt_outer JOIN_SYM table_factor
{
add_join_natural($1,$
1->next
);
$
1->next
->outer_join|=JOIN_TYPE_LEFT;
add_join_natural($1,$
6
);
$
6
->outer_join|=JOIN_TYPE_LEFT;
$$=$6;
}
| join_table_list RIGHT opt_outer JOIN_SYM join_table_list ON expr
{ add_join_on($1,$7); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$5; }
| join_table_list RIGHT opt_outer JOIN_SYM join_table_list
| table_ref RIGHT opt_outer JOIN_SYM table_factor ON expr
{
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
YYABORT;
add_join_on($$, $7);
}
| table_ref RIGHT opt_outer JOIN_SYM table_factor
{
SELECT_LEX *sel= Select;
sel->db1=$1->db; sel->table1=$1->alias;
sel->db2=$5->db; sel->table2=$5->alias;
sel->save_names_for_using_list($1, $5);
}
USING '(' using_list ')'
{ add_join_on($1,$9); $1->outer_join|=JOIN_TYPE_RIGHT; $$=$5; }
| join_table_list NATURAL RIGHT opt_outer JOIN_SYM join_table_list
{
add_join_natural($1->next,$1);
$1->outer_join|=JOIN_TYPE_RIGHT;
$$=$6;
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
YYABORT;
add_join_on($$, $9);
}
| table_ref NATURAL RIGHT opt_outer JOIN_SYM table_factor
{
add_join_natural($6,$1);
LEX *lex= Lex;
if (!($$= lex->current_select->convert_right_join()))
YYABORT;
}
| join_table_list NATURAL JOIN_SYM join_table_list
{ add_join_natural($1,$1->next); $$=$4; };
| table_ref NATURAL JOIN_SYM table_factor
{ add_join_natural($1,$4); $$=$4; };
normal_join:
JOIN_SYM {}
...
...
@@ -4490,7 +4512,7 @@ normal_join:
| CROSS JOIN_SYM {}
;
join_table
:
table_factor
:
{
SELECT_LEX *sel= Select;
sel->use_index_ptr=sel->ignore_index_ptr=0;
...
...
@@ -4506,8 +4528,21 @@ join_table:
sel->get_use_index(),
sel->get_ignore_index())))
YYABORT;
sel->add_joined_table($$);
}
| '('
{
LEX *lex= Lex;
if (lex->current_select->init_nested_join(lex->thd))
YYABORT;
}
join_table_list ')'
{
LEX *lex= Lex;
if (!($$= lex->current_select->end_nested_join(lex->thd)))
YYABORT;
}
| '{' ident
join_table LEFT OUTER JOIN_SYM join_table
ON expr '}'
| '{' ident
table_ref LEFT OUTER JOIN_SYM table_ref
ON expr '}'
{ add_join_on($7,$9); $7->outer_join|=JOIN_TYPE_LEFT; $$=$7; }
| '(' SELECT_SYM select_derived ')' opt_table_alias
{
...
...
@@ -4520,6 +4555,7 @@ join_table:
(List<String> *)0)))
YYABORT;
lex->current_select->add_joined_table($$);
};
select_derived:
...
...
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