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
63a49b78
Commit
63a49b78
authored
Jul 16, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Just making commit in order to stop getting erors.
Will do a push when it starts working ..
parent
f0403106
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
8 deletions
+64
-8
sql/Makefile.am
sql/Makefile.am
+1
-1
sql/lex.h
sql/lex.h
+2
-0
sql/sql_lex.h
sql/sql_lex.h
+9
-3
sql/sql_parse.cc
sql/sql_parse.cc
+3
-0
sql/sql_select.cc
sql/sql_select.cc
+18
-1
sql/sql_union.cc
sql/sql_union.cc
+7
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+23
-2
sql/table.h
sql/table.h
+1
-0
No files found.
sql/Makefile.am
View file @
63a49b78
...
@@ -81,7 +81,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
...
@@ -81,7 +81,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc
\
sql_udf.cc sql_analyse.cc sql_analyse.h sql_cache.cc
\
slave.cc sql_repl.cc sql_union.cc
\
slave.cc sql_repl.cc sql_union.cc
\
mini_client.cc mini_client_errors.c
\
mini_client.cc mini_client_errors.c
\
stacktrace.c repl_failsafe.h repl_failsafe.cc
stacktrace.c repl_failsafe.h repl_failsafe.cc
sql_olap.cc
gen_lex_hash_SOURCES
=
gen_lex_hash.cc
gen_lex_hash_SOURCES
=
gen_lex_hash.cc
gen_lex_hash_LDADD
=
$(LDADD)
$(CXXLDFLAGS)
gen_lex_hash_LDADD
=
$(LDADD)
$(CXXLDFLAGS)
...
...
sql/lex.h
View file @
63a49b78
...
@@ -98,6 +98,7 @@ static SYMBOL symbols[] = {
...
@@ -98,6 +98,7 @@ static SYMBOL symbols[] = {
{
"CONSTRAINT"
,
SYM
(
CONSTRAINT
),
0
,
0
},
{
"CONSTRAINT"
,
SYM
(
CONSTRAINT
),
0
,
0
},
{
"CREATE"
,
SYM
(
CREATE
),
0
,
0
},
{
"CREATE"
,
SYM
(
CREATE
),
0
,
0
},
{
"CROSS"
,
SYM
(
CROSS
),
0
,
0
},
{
"CROSS"
,
SYM
(
CROSS
),
0
,
0
},
{
"CUBE"
,
SYM
(
CUBE
),
0
,
0
},
{
"CURRENT_DATE"
,
SYM
(
CURDATE
),
0
,
0
},
{
"CURRENT_DATE"
,
SYM
(
CURDATE
),
0
,
0
},
{
"CURRENT_TIME"
,
SYM
(
CURTIME
),
0
,
0
},
{
"CURRENT_TIME"
,
SYM
(
CURTIME
),
0
,
0
},
{
"CURRENT_TIMESTAMP"
,
SYM
(
NOW_SYM
),
0
,
0
},
{
"CURRENT_TIMESTAMP"
,
SYM
(
NOW_SYM
),
0
,
0
},
...
@@ -303,6 +304,7 @@ static SYMBOL symbols[] = {
...
@@ -303,6 +304,7 @@ static SYMBOL symbols[] = {
{
"RIGHT"
,
SYM
(
RIGHT
),
0
,
0
},
{
"RIGHT"
,
SYM
(
RIGHT
),
0
,
0
},
{
"RLIKE"
,
SYM
(
REGEXP
),
0
,
0
},
/* Like in mSQL2 */
{
"RLIKE"
,
SYM
(
REGEXP
),
0
,
0
},
/* Like in mSQL2 */
{
"ROLLBACK"
,
SYM
(
ROLLBACK_SYM
),
0
,
0
},
{
"ROLLBACK"
,
SYM
(
ROLLBACK_SYM
),
0
,
0
},
{
"ROLLUP"
,
SYM
(
ROLLUP
),
0
,
0
},
{
"ROW"
,
SYM
(
ROW_SYM
),
0
,
0
},
{
"ROW"
,
SYM
(
ROW_SYM
),
0
,
0
},
{
"ROWS"
,
SYM
(
ROWS_SYM
),
0
,
0
},
{
"ROWS"
,
SYM
(
ROWS_SYM
),
0
,
0
},
{
"SECOND"
,
SYM
(
SECOND_SYM
),
0
,
0
},
{
"SECOND"
,
SYM
(
SECOND_SYM
),
0
,
0
},
...
...
sql/sql_lex.h
View file @
63a49b78
...
@@ -89,7 +89,12 @@ typedef struct st_lex_master_info
...
@@ -89,7 +89,12 @@ typedef struct st_lex_master_info
enum
sub_select_type
enum
sub_select_type
{
{
UNSPECIFIED_TYPE
,
UNION_TYPE
,
INTERSECT_TYPE
,
EXCEPT_TYPE
,
NOT_A_SELECT
UNSPECIFIED_TYPE
,
UNION_TYPE
,
INTERSECT_TYPE
,
EXCEPT_TYPE
,
OLAP_TYPE
,
NOT_A_SELECT
};
enum
olap_type
{
NON_EXISTING_ONE
,
CUBE_TYPE
,
ROLLUP_TYPE
};
};
/* The state of the lex parsing for selects */
/* The state of the lex parsing for selects */
...
@@ -97,6 +102,7 @@ enum sub_select_type
...
@@ -97,6 +102,7 @@ enum sub_select_type
typedef
struct
st_select_lex
typedef
struct
st_select_lex
{
{
enum
sub_select_type
linkage
;
enum
sub_select_type
linkage
;
enum
olap_type
olap
;
char
*
db
,
*
db1
,
*
table1
,
*
db2
,
*
table2
;
/* For outer join using .. */
char
*
db
,
*
db1
,
*
table1
,
*
db2
,
*
table2
;
/* For outer join using .. */
Item
*
where
,
*
having
;
Item
*
where
,
*
having
;
ha_rows
select_limit
,
offset_limit
;
ha_rows
select_limit
,
offset_limit
;
...
@@ -133,7 +139,7 @@ typedef struct st_lex
...
@@ -133,7 +139,7 @@ typedef struct st_lex
{
{
uint
yylineno
,
yytoklen
;
/* Simulate lex */
uint
yylineno
,
yytoklen
;
/* Simulate lex */
LEX_YYSTYPE
yylval
;
LEX_YYSTYPE
yylval
;
SELECT_LEX
select_lex
,
*
select
;
SELECT_LEX
select_lex
,
*
select
,
*
last_selects
;
uchar
*
ptr
,
*
tok_start
,
*
tok_end
,
*
end_of_query
;
uchar
*
ptr
,
*
tok_start
,
*
tok_end
,
*
end_of_query
;
char
*
length
,
*
dec
,
*
change
,
*
name
;
char
*
length
,
*
dec
,
*
change
,
*
name
;
char
*
backup_dir
;
/* For RESTORE/BACKUP */
char
*
backup_dir
;
/* For RESTORE/BACKUP */
...
@@ -178,7 +184,7 @@ typedef struct st_lex
...
@@ -178,7 +184,7 @@ typedef struct st_lex
uint
grant
,
grant_tot_col
,
which_columns
,
union_option
;
uint
grant
,
grant_tot_col
,
which_columns
,
union_option
;
thr_lock_type
lock_option
;
thr_lock_type
lock_option
;
bool
drop_primary
,
drop_if_exists
,
local_file
;
bool
drop_primary
,
drop_if_exists
,
local_file
;
bool
in_comment
,
ignore_space
,
verbose
,
simple_alter
,
option_type
;
bool
in_comment
,
ignore_space
,
verbose
,
simple_alter
,
option_type
,
olap
;
uint
slave_thd_opt
;
uint
slave_thd_opt
;
}
LEX
;
}
LEX
;
...
...
sql/sql_parse.cc
View file @
63a49b78
...
@@ -2728,7 +2728,9 @@ mysql_init_select(LEX *lex)
...
@@ -2728,7 +2728,9 @@ mysql_init_select(LEX *lex)
select_lex
->
offset_limit
=
0
;
select_lex
->
offset_limit
=
0
;
select_lex
->
options
=
0
;
select_lex
->
options
=
0
;
select_lex
->
linkage
=
UNSPECIFIED_TYPE
;
select_lex
->
linkage
=
UNSPECIFIED_TYPE
;
select_lex
->
olap
=
NON_EXISTING_ONE
;
lex
->
exchange
=
0
;
lex
->
exchange
=
0
;
lex
->
olap
=
0
;
lex
->
proc_list
.
first
=
0
;
lex
->
proc_list
.
first
=
0
;
select_lex
->
order_list
.
elements
=
select_lex
->
group_list
.
elements
=
0
;
select_lex
->
order_list
.
elements
=
select_lex
->
group_list
.
elements
=
0
;
select_lex
->
order_list
.
first
=
0
;
select_lex
->
order_list
.
first
=
0
;
...
@@ -3270,6 +3272,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
...
@@ -3270,6 +3272,7 @@ static bool create_total_list(THD *thd, LEX *lex, TABLE_LIST **result)
for
(;
aux
;
aux
=
next
)
for
(;
aux
;
aux
=
next
)
{
{
TABLE_LIST
*
cursor
;
TABLE_LIST
*
cursor
;
aux
->
do_redirect
=
true
;
next
=
aux
->
next
;
next
=
aux
->
next
;
for
(
cursor
=
*
result
;
cursor
;
cursor
=
cursor
->
next
)
for
(
cursor
=
*
result
;
cursor
;
cursor
=
cursor
->
next
)
if
(
!
strcmp
(
cursor
->
db
,
aux
->
db
)
&&
if
(
!
strcmp
(
cursor
->
db
,
aux
->
db
)
&&
...
...
sql/sql_select.cc
View file @
63a49b78
...
@@ -146,7 +146,7 @@ static bool update_sum_func(Item_sum **func);
...
@@ -146,7 +146,7 @@ static bool update_sum_func(Item_sum **func);
static
void
select_describe
(
JOIN
*
join
,
bool
need_tmp_table
,
bool
need_order
,
static
void
select_describe
(
JOIN
*
join
,
bool
need_tmp_table
,
bool
need_order
,
bool
distinct
,
const
char
*
message
=
NullS
);
bool
distinct
,
const
char
*
message
=
NullS
);
static
void
describe_info
(
JOIN
*
join
,
const
char
*
info
);
static
void
describe_info
(
JOIN
*
join
,
const
char
*
info
);
extern
int
handle_olaps
(
LEX
*
lex
,
SELECT_LEX
*
select
);
/*
/*
This handles SELECT with and without UNION
This handles SELECT with and without UNION
*/
*/
...
@@ -155,6 +155,23 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
...
@@ -155,6 +155,23 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
{
{
int
res
;
int
res
;
register
SELECT_LEX
*
select_lex
=
&
lex
->
select_lex
;
register
SELECT_LEX
*
select_lex
=
&
lex
->
select_lex
;
if
(
lex
->
olap
)
{
SELECT_LEX
*
sl
,
*
last_sl
;
int
returned
;
for
(
sl
=
&
lex
->
select_lex
;
sl
;
sl
=
sl
->
next
)
{
if
(
sl
->
olap
!=
NON_EXISTING_ONE
)
{
last_sl
=
sl
->
next
;
if
((
returned
=
handle_olaps
(
lex
,
sl
)))
return
returned
;
lex
->
last_selects
->
next
=
sl
=
last_sl
;
if
(
!
sl
)
break
;
}
}
lex
->
select
=
select_lex
;
}
if
(
select_lex
->
next
)
if
(
select_lex
->
next
)
res
=
mysql_union
(
thd
,
lex
,
result
);
res
=
mysql_union
(
thd
,
lex
,
result
);
else
else
...
...
sql/sql_union.cc
View file @
63a49b78
...
@@ -49,7 +49,13 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
...
@@ -49,7 +49,13 @@ int mysql_union(THD *thd, LEX *lex,select_result *result)
for
(
TABLE_LIST
*
cursor
=
(
TABLE_LIST
*
)
sl
->
table_list
.
first
;
for
(
TABLE_LIST
*
cursor
=
(
TABLE_LIST
*
)
sl
->
table_list
.
first
;
cursor
;
cursor
;
cursor
=
cursor
->
next
)
cursor
=
cursor
->
next
)
{
if
(
cursor
->
do_redirect
)
{
cursor
->
table
=
((
TABLE_LIST
*
)
cursor
->
table
)
->
table
;
cursor
->
table
=
((
TABLE_LIST
*
)
cursor
->
table
)
->
table
;
cursor
->
do_redirect
=
false
;
}
}
}
}
/* last_sel now points at the last select where the ORDER BY is stored */
/* last_sel now points at the last select where the ORDER BY is stored */
...
...
sql/sql_yacc.yy
View file @
63a49b78
...
@@ -109,6 +109,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -109,6 +109,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token COUNT_SYM
%token COUNT_SYM
%token CREATE
%token CREATE
%token CROSS
%token CROSS
%token CUBE
%token DELETE_SYM
%token DELETE_SYM
%token DO_SYM
%token DO_SYM
%token DROP
%token DROP
...
@@ -130,6 +131,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
...
@@ -130,6 +131,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b,int *yystacksize);
%token REPLICATION
%token REPLICATION
%token RESET_SYM
%token RESET_SYM
%token ROLLBACK_SYM
%token ROLLBACK_SYM
%token ROLLUP
%token SELECT_SYM
%token SELECT_SYM
%token SHOW
%token SHOW
%token SLAVE
%token SLAVE
...
@@ -2160,7 +2162,7 @@ opt_escape:
...
@@ -2160,7 +2162,7 @@ opt_escape:
group_clause:
group_clause:
/* empty */
/* empty */
| GROUP BY group_list;
| GROUP BY group_list
olap_opt
;
group_list:
group_list:
group_list ',' order_ident order_dir
group_list ',' order_ident order_dir
...
@@ -2168,6 +2170,19 @@ group_list:
...
@@ -2168,6 +2170,19 @@ group_list:
| order_ident order_dir
| order_ident order_dir
{ if (add_group_to_list($1,(bool) $2)) YYABORT; };
{ if (add_group_to_list($1,(bool) $2)) YYABORT; };
olap_opt:
/* empty */ {}
| WITH CUBE
{
Lex->olap = true;
Select->olap= CUBE_TYPE;
}
| WITH ROLLUP
{
Lex->olap = true;
Select->olap= ROLLUP_TYPE;
}
/*
/*
Order by statement in select
Order by statement in select
*/
*/
...
@@ -2180,7 +2195,7 @@ order_clause:
...
@@ -2180,7 +2195,7 @@ order_clause:
ORDER_SYM BY
ORDER_SYM BY
{
{
LEX *lex=Lex;
LEX *lex=Lex;
if (lex->sql_command == SQLCOM_MULTI_UPDATE)
if (lex->sql_command == SQLCOM_MULTI_UPDATE
|| lex->olap
)
YYABORT;
YYABORT;
lex->select->sort_default=1;
lex->select->sort_default=1;
} order_list;
} order_list;
...
@@ -2201,12 +2216,16 @@ limit_clause:
...
@@ -2201,12 +2216,16 @@ limit_clause:
/* empty */ {}
/* empty */ {}
| LIMIT ULONG_NUM
| LIMIT ULONG_NUM
{
{
if (Lex->olap)
YYABORT;
SELECT_LEX *sel=Select;
SELECT_LEX *sel=Select;
sel->select_limit= $2;
sel->select_limit= $2;
sel->offset_limit=0L;
sel->offset_limit=0L;
}
}
| LIMIT ULONG_NUM ',' ULONG_NUM
| LIMIT ULONG_NUM ',' ULONG_NUM
{
{
if (Lex->olap)
YYABORT;
SELECT_LEX *sel=Select;
SELECT_LEX *sel=Select;
sel->select_limit= $4; sel->offset_limit=$2;
sel->select_limit= $4; sel->offset_limit=$2;
};
};
...
@@ -3011,6 +3030,7 @@ keyword:
...
@@ -3011,6 +3030,7 @@ keyword:
| COMMIT_SYM {}
| COMMIT_SYM {}
| COMPRESSED_SYM {}
| COMPRESSED_SYM {}
| CONCURRENT {}
| CONCURRENT {}
| CUBE {}
| DATA_SYM {}
| DATA_SYM {}
| DATETIME {}
| DATETIME {}
| DATE_SYM {}
| DATE_SYM {}
...
@@ -3104,6 +3124,7 @@ keyword:
...
@@ -3104,6 +3124,7 @@ keyword:
| RESOURCES {}
| RESOURCES {}
| RESTORE_SYM {}
| RESTORE_SYM {}
| ROLLBACK_SYM {}
| ROLLBACK_SYM {}
| ROLLUP {}
| ROWS_SYM {}
| ROWS_SYM {}
| ROW_FORMAT_SYM {}
| ROW_FORMAT_SYM {}
| ROW_SYM {}
| ROW_SYM {}
...
...
sql/table.h
View file @
63a49b78
...
@@ -151,6 +151,7 @@ typedef struct st_table_list
...
@@ -151,6 +151,7 @@ typedef struct st_table_list
bool
straight
;
/* optimize with prev table */
bool
straight
;
/* optimize with prev table */
bool
updating
;
/* for replicate-do/ignore table */
bool
updating
;
/* for replicate-do/ignore table */
bool
shared
;
/* Used twice in union */
bool
shared
;
/* Used twice in union */
bool
do_redirect
;
/* To get the struct in UNION's */
}
TABLE_LIST
;
}
TABLE_LIST
;
...
...
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