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
ed39181a
Commit
ed39181a
authored
May 21, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19533 Add methods make() and append_uniq() to Row_definition_list
parent
fae13194
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
44 additions
and
24 deletions
+44
-24
sql/field.h
sql/field.h
+8
-0
sql/sp_rcontext.cc
sql/sp_rcontext.cc
+13
-0
sql/sql_lex.cc
sql/sql_lex.cc
+16
-0
sql/sql_lex.h
sql/sql_lex.h
+1
-0
sql/sql_yacc.yy
sql/sql_yacc.yy
+3
-12
sql/sql_yacc_ora.yy
sql/sql_yacc_ora.yy
+3
-12
No files found.
sql/field.h
View file @
ed39181a
...
...
@@ -4852,6 +4852,14 @@ class Row_definition_list: public List<class Spvar_definition>
}
return
0
;
}
static
Row_definition_list
*
make
(
MEM_ROOT
*
mem_root
,
Spvar_definition
*
var
)
{
Row_definition_list
*
list
;
if
(
!
(
list
=
new
(
mem_root
)
Row_definition_list
()))
return
NULL
;
return
list
->
push_back
(
var
,
mem_root
)
?
NULL
:
list
;
}
bool
append_uniq
(
MEM_ROOT
*
thd
,
Spvar_definition
*
var
);
bool
adjust_formal_params_to_actual_params
(
THD
*
thd
,
List
<
Item
>
*
args
);
bool
adjust_formal_params_to_actual_params
(
THD
*
thd
,
Item
**
args
,
uint
arg_count
);
...
...
sql/sp_rcontext.cc
View file @
ed39181a
...
...
@@ -119,6 +119,19 @@ sp_rcontext *sp_rcontext::create(THD *thd,
}
bool
Row_definition_list
::
append_uniq
(
MEM_ROOT
*
mem_root
,
Spvar_definition
*
var
)
{
DBUG_ASSERT
(
elements
);
uint
unused
;
if
(
unlikely
(
find_row_field_by_name
(
&
var
->
field_name
,
&
unused
)))
{
my_error
(
ER_DUP_FIELDNAME
,
MYF
(
0
),
var
->
field_name
.
str
);
return
true
;
}
return
push_back
(
var
,
mem_root
);
}
bool
Row_definition_list
::
adjust_formal_params_to_actual_params
(
THD
*
thd
,
List
<
Item
>
*
args
)
{
...
...
sql/sql_lex.cc
View file @
ed39181a
...
...
@@ -10416,3 +10416,19 @@ bool LEX::stmt_create_stored_function_start(const DDL_options_st &options,
return
true
;
return
false
;
}
Spvar_definition
*
LEX
::
row_field_name
(
THD
*
thd
,
const
Lex_ident_sys_st
&
name
)
{
Spvar_definition
*
res
;
if
(
unlikely
(
check_string_char_length
(
&
name
,
0
,
NAME_CHAR_LEN
,
system_charset_info
,
1
)))
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
name
.
str
);
return
NULL
;
}
if
(
unlikely
(
!
(
res
=
new
(
thd
->
mem_root
)
Spvar_definition
())))
return
NULL
;
init_last_field
(
res
,
&
name
,
thd
->
variables
.
collation_database
);
return
res
;
}
sql/sql_lex.h
View file @
ed39181a
...
...
@@ -4506,6 +4506,7 @@ struct LEX: public Query_tables_list
const
Lex_ident_sys_st
&
name
,
Item_result
return_type
,
const
LEX_CSTRING
&
soname
);
Spvar_definition
*
row_field_name
(
THD
*
thd
,
const
Lex_ident_sys_st
&
name
);
};
...
...
sql/sql_yacc.yy
View file @
ed39181a
...
...
@@ -3508,12 +3508,8 @@ optionally_qualified_column_ident:
row_field_name:
ident
{
if (unlikely(check_string_char_length(&$1, 0, NAME_CHAR_LEN,
system_charset_info, 1)))
my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str));
if (unlikely(!($$= new (thd->mem_root) Spvar_definition())))
if (!($$= Lex->row_field_name(thd, $1)))
MYSQL_YYABORT;
Lex->init_last_field($$, &$1, thd->variables.collation_database);
}
;
...
...
@@ -3524,17 +3520,12 @@ row_field_definition:
row_field_definition_list:
row_field_definition
{
if (unlikely(!($$= new (thd->mem_root) Row_definition_list())) ||
unlikely($$->push_back($1, thd->mem_root)))
if (!($$= Row_definition_list::make(thd->mem_root, $1)))
MYSQL_YYABORT;
}
| row_field_definition_list ',' row_field_definition
{
uint unused;
if (unlikely($1->find_row_field_by_name(&$3->field_name, &unused)))
my_yyabort_error((ER_DUP_FIELDNAME, MYF(0), $3->field_name.str));
$$= $1;
if (unlikely($$->push_back($3, thd->mem_root)))
if (($$= $1)->append_uniq(thd->mem_root, $3))
MYSQL_YYABORT;
}
;
...
...
sql/sql_yacc_ora.yy
View file @
ed39181a
...
...
@@ -3411,12 +3411,8 @@ optionally_qualified_column_ident:
row_field_name:
ident_directly_assignable
{
if (unlikely(check_string_char_length(&$1, 0, NAME_CHAR_LEN,
system_charset_info, 1)))
my_yyabort_error((ER_TOO_LONG_IDENT, MYF(0), $1.str));
if (unlikely(!($$= new (thd->mem_root) Spvar_definition())))
if (!($$= Lex->row_field_name(thd, $1)))
MYSQL_YYABORT;
Lex->init_last_field($$, &$1, thd->variables.collation_database);
}
;
...
...
@@ -3427,17 +3423,12 @@ row_field_definition:
row_field_definition_list:
row_field_definition
{
if (unlikely(!($$= new (thd->mem_root) Row_definition_list())) ||
unlikely($$->push_back($1, thd->mem_root)))
if (!($$= Row_definition_list::make(thd->mem_root, $1)))
MYSQL_YYABORT;
}
| row_field_definition_list ',' row_field_definition
{
uint unused;
if (unlikely($1->find_row_field_by_name(&$3->field_name, &unused)))
my_yyabort_error((ER_DUP_FIELDNAME, MYF(0), $3->field_name.str));
$$= $1;
if (unlikely($$->push_back($3, thd->mem_root)))
if (($$= $1)->append_uniq(thd->mem_root, $3))
MYSQL_YYABORT;
}
;
...
...
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