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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
def2ac20
Commit
def2ac20
authored
Nov 09, 2018
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-17652 Add sql_mode specific tokens for some keywords
parent
aa4772e7
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
370 additions
and
146 deletions
+370
-146
sql/gen_lex_token.cc
sql/gen_lex_token.cc
+2
-1
sql/lex.h
sql/lex.h
+12
-12
sql/sp_pcontext.cc
sql/sp_pcontext.cc
+13
-0
sql/sp_pcontext.h
sql/sp_pcontext.h
+1
-7
sql/sql_lex.cc
sql/sql_lex.cc
+18
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+193
-42
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+131
-84
No files found.
sql/gen_lex_token.cc
View file @
def2ac20
...
...
@@ -255,7 +255,8 @@ void compute_tokens()
set_start_expr_token
(
STARTS_SYM
);
set_start_expr_token
(
ENDS_SYM
);
set_start_expr_token
(
DEFAULT
);
set_start_expr_token
(
RETURN_SYM
);
set_start_expr_token
(
RETURN_MARIADB_SYM
);
set_start_expr_token
(
RETURN_ORACLE_SYM
);
set_start_expr_token
(
IF_SYM
);
set_start_expr_token
(
ELSEIF_SYM
);
set_start_expr_token
(
CASE_SYM
);
...
...
sql/lex.h
View file @
def2ac20
...
...
@@ -82,7 +82,7 @@ static SYMBOL symbols[] = {
{
"AVG_ROW_LENGTH"
,
SYM
(
AVG_ROW_LENGTH
)},
{
"BACKUP"
,
SYM
(
BACKUP_SYM
)},
{
"BEFORE"
,
SYM
(
BEFORE_SYM
)},
{
"BEGIN"
,
SYM
(
BEGIN_SYM
)},
{
"BEGIN"
,
SYM
(
BEGIN_
MARIADB_
SYM
)},
{
"BETWEEN"
,
SYM
(
BETWEEN_SYM
)},
{
"BIGINT"
,
SYM
(
BIGINT
)},
{
"BINARY"
,
SYM
(
BINARY
)},
...
...
@@ -90,7 +90,7 @@ static SYMBOL symbols[] = {
{
"BIT"
,
SYM
(
BIT_SYM
)},
{
"BLOB"
,
SYM
(
BLOB_SYM
)},
{
"BLOCK"
,
SYM
(
BLOCK_SYM
)},
{
"BODY"
,
SYM
(
BODY_SYM
)},
{
"BODY"
,
SYM
(
BODY_
MARIADB_
SYM
)},
{
"BOOL"
,
SYM
(
BOOL_SYM
)},
{
"BOOLEAN"
,
SYM
(
BOOLEAN_SYM
)},
{
"BOTH"
,
SYM
(
BOTH
)},
...
...
@@ -145,7 +145,7 @@ static SYMBOL symbols[] = {
{
"CONSTRAINT_SCHEMA"
,
SYM
(
CONSTRAINT_SCHEMA_SYM
)},
{
"CONTAINS"
,
SYM
(
CONTAINS_SYM
)},
{
"CONTEXT"
,
SYM
(
CONTEXT_SYM
)},
{
"CONTINUE"
,
SYM
(
CONTINUE_SYM
)},
{
"CONTINUE"
,
SYM
(
CONTINUE_
MARIADB_
SYM
)},
{
"CONTRIBUTORS"
,
SYM
(
CONTRIBUTORS_SYM
)},
{
"CONVERT"
,
SYM
(
CONVERT_SYM
)},
{
"CPU"
,
SYM
(
CPU_SYM
)},
...
...
@@ -206,7 +206,7 @@ static SYMBOL symbols[] = {
{
"EACH"
,
SYM
(
EACH_SYM
)},
{
"ELSE"
,
SYM
(
ELSE
)},
{
"ELSEIF"
,
SYM
(
ELSEIF_SYM
)},
{
"ELSIF"
,
SYM
(
ELSIF_SYM
)},
{
"ELSIF"
,
SYM
(
ELSIF_
MARIADB_
SYM
)},
{
"ENABLE"
,
SYM
(
ENABLE_SYM
)},
{
"ENCLOSED"
,
SYM
(
ENCLOSED
)},
{
"END"
,
SYM
(
END
)},
...
...
@@ -226,9 +226,9 @@ static SYMBOL symbols[] = {
{
"EXCHANGE"
,
SYM
(
EXCHANGE_SYM
)},
{
"EXCLUDE"
,
SYM
(
EXCLUDE_SYM
)},
{
"EXECUTE"
,
SYM
(
EXECUTE_SYM
)},
{
"EXCEPTION"
,
SYM
(
EXCEPTION_SYM
)},
{
"EXCEPTION"
,
SYM
(
EXCEPTION_
MARIADB_
SYM
)},
{
"EXISTS"
,
SYM
(
EXISTS
)},
{
"EXIT"
,
SYM
(
EXIT_SYM
)},
{
"EXIT"
,
SYM
(
EXIT_
MARIADB_
SYM
)},
{
"EXPANSION"
,
SYM
(
EXPANSION_SYM
)},
{
"EXPORT"
,
SYM
(
EXPORT_SYM
)},
{
"EXPLAIN"
,
SYM
(
DESCRIBE
)},
...
...
@@ -264,7 +264,7 @@ static SYMBOL symbols[] = {
{
"GET_FORMAT"
,
SYM
(
GET_FORMAT
)},
{
"GET"
,
SYM
(
GET_SYM
)},
{
"GLOBAL"
,
SYM
(
GLOBAL_SYM
)},
{
"GOTO"
,
SYM
(
GOTO
_SYM
)},
{
"GOTO"
,
SYM
(
GOTO_MARIADB
_SYM
)},
{
"GRANT"
,
SYM
(
GRANT
)},
{
"GRANTS"
,
SYM
(
GRANTS
)},
{
"GROUP"
,
SYM
(
GROUP_SYM
)},
...
...
@@ -451,13 +451,13 @@ static SYMBOL symbols[] = {
{
"OPTIONALLY"
,
SYM
(
OPTIONALLY
)},
{
"OR"
,
SYM
(
OR_SYM
)},
{
"ORDER"
,
SYM
(
ORDER_SYM
)},
{
"OTHERS"
,
SYM
(
OTHERS_SYM
)},
{
"OTHERS"
,
SYM
(
OTHERS_
MARIADB_
SYM
)},
{
"OUT"
,
SYM
(
OUT_SYM
)},
{
"OUTER"
,
SYM
(
OUTER
)},
{
"OUTFILE"
,
SYM
(
OUTFILE
)},
{
"OVER"
,
SYM
(
OVER_SYM
)},
{
"OWNER"
,
SYM
(
OWNER_SYM
)},
{
"PACKAGE"
,
SYM
(
PACKAGE_SYM
)},
{
"PACKAGE"
,
SYM
(
PACKAGE_
MARIADB_
SYM
)},
{
"PACK_KEYS"
,
SYM
(
PACK_KEYS_SYM
)},
{
"PAGE"
,
SYM
(
PAGE_SYM
)},
{
"PAGE_CHECKSUM"
,
SYM
(
PAGE_CHECKSUM_SYM
)},
...
...
@@ -495,7 +495,7 @@ static SYMBOL symbols[] = {
{
"QUARTER"
,
SYM
(
QUARTER_SYM
)},
{
"QUERY"
,
SYM
(
QUERY_SYM
)},
{
"QUICK"
,
SYM
(
QUICK
)},
{
"RAISE"
,
SYM
(
RAISE_SYM
)},
{
"RAISE"
,
SYM
(
RAISE_
MARIADB_
SYM
)},
{
"RANGE"
,
SYM
(
RANGE_SYM
)},
{
"RAW"
,
SYM
(
RAW
)},
{
"READ"
,
SYM
(
READ_SYM
)},
...
...
@@ -534,7 +534,7 @@ static SYMBOL symbols[] = {
{
"RESTRICT"
,
SYM
(
RESTRICT
)},
{
"RESUME"
,
SYM
(
RESUME_SYM
)},
{
"RETURNED_SQLSTATE"
,
SYM
(
RETURNED_SQLSTATE_SYM
)},
{
"RETURN"
,
SYM
(
RETURN_SYM
)},
{
"RETURN"
,
SYM
(
RETURN_
MARIADB_
SYM
)},
{
"RETURNING"
,
SYM
(
RETURNING_SYM
)},
{
"RETURNS"
,
SYM
(
RETURNS_SYM
)},
{
"REUSE"
,
SYM
(
REUSE_SYM
)},
...
...
@@ -549,7 +549,7 @@ static SYMBOL symbols[] = {
{
"ROW"
,
SYM
(
ROW_SYM
)},
{
"ROWCOUNT"
,
SYM
(
ROWCOUNT_SYM
)},
/* Oracle-N */
{
"ROWS"
,
SYM
(
ROWS_SYM
)},
{
"ROWTYPE"
,
SYM
(
ROWTYPE_SYM
)},
{
"ROWTYPE"
,
SYM
(
ROWTYPE_
MARIADB_
SYM
)},
{
"ROW_COUNT"
,
SYM
(
ROW_COUNT_SYM
)},
{
"ROW_FORMAT"
,
SYM
(
ROW_FORMAT_SYM
)},
{
"RTREE"
,
SYM
(
RTREE_SYM
)},
...
...
sql/sp_pcontext.cc
View file @
def2ac20
...
...
@@ -409,6 +409,19 @@ sp_condition_value *sp_pcontext::find_condition(const LEX_CSTRING *name,
NULL
;
}
sp_condition_value
*
sp_pcontext
::
find_declared_or_predefined_condition
(
THD
*
thd
,
const
LEX_CSTRING
*
name
)
const
{
sp_condition_value
*
p
=
find_condition
(
name
,
false
);
if
(
p
)
return
p
;
if
(
thd
->
variables
.
sql_mode
&
MODE_ORACLE
)
return
find_predefined_condition
(
name
);
return
NULL
;
}
static
sp_condition_value
// Warnings
...
...
sql/sp_pcontext.h
View file @
def2ac20
...
...
@@ -592,13 +592,7 @@ class sp_pcontext : public Sql_alloc
bool
current_scope_only
)
const
;
sp_condition_value
*
find_declared_or_predefined_condition
(
const
LEX_CSTRING
*
name
)
const
{
sp_condition_value
*
p
=
find_condition
(
name
,
false
);
if
(
p
)
return
p
;
return
find_predefined_condition
(
name
);
}
find_declared_or_predefined_condition
(
THD
*
thd
,
const
LEX_CSTRING
*
name
)
const
;
bool
declare_condition
(
THD
*
thd
,
const
LEX_CSTRING
*
name
,
sp_condition_value
*
val
)
...
...
sql/sql_lex.cc
View file @
def2ac20
...
...
@@ -838,6 +838,24 @@ int Lex_input_stream::find_keyword(Lex_ident_cli_st *kwd,
DBUG_ASSERT
(
tok
>=
get_buf
());
DBUG_ASSERT
(
tok
<
get_end_of_query
());
if
(
m_thd
->
variables
.
sql_mode
&
MODE_ORACLE
)
{
switch
(
symbol
->
tok
)
{
case
BEGIN_MARIADB_SYM
:
return
BEGIN_ORACLE_SYM
;
case
BODY_MARIADB_SYM
:
return
BODY_ORACLE_SYM
;
case
CONTINUE_MARIADB_SYM
:
return
CONTINUE_ORACLE_SYM
;
case
ELSIF_MARIADB_SYM
:
return
ELSIF_ORACLE_SYM
;
case
EXCEPTION_MARIADB_SYM
:
return
EXCEPTION_ORACLE_SYM
;
case
EXIT_MARIADB_SYM
:
return
EXIT_ORACLE_SYM
;
case
GOTO_MARIADB_SYM
:
return
GOTO_ORACLE_SYM
;
case
OTHERS_MARIADB_SYM
:
return
OTHERS_ORACLE_SYM
;
case
PACKAGE_MARIADB_SYM
:
return
PACKAGE_ORACLE_SYM
;
case
RAISE_MARIADB_SYM
:
return
RAISE_ORACLE_SYM
;
case
RETURN_MARIADB_SYM
:
return
RETURN_ORACLE_SYM
;
case
ROWTYPE_MARIADB_SYM
:
return
ROWTYPE_ORACLE_SYM
;
}
}
if
((
symbol
->
tok
==
NOT_SYM
)
&&
(
m_thd
->
variables
.
sql_mode
&
MODE_HIGH_NOT_PRECEDENCE
))
return
NOT2_SYM
;
...
...
sql/sql_yacc.yy
View file @
def2ac20
This diff is collapsed.
Click to expand it.
sql/sql_yacc_ora.yy
View file @
def2ac20
This diff is collapsed.
Click to expand it.
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