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
ec6d8dad
Commit
ec6d8dad
authored
Dec 22, 2016
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce code duplication a little
parent
e7d7910b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
42 deletions
+27
-42
sql/event_db_repository.cc
sql/event_db_repository.cc
+7
-8
sql/sp_head.cc
sql/sp_head.cc
+1
-5
sql/sql_parse.cc
sql/sql_parse.cc
+14
-9
sql/sql_parse.h
sql/sql_parse.h
+1
-0
sql/sql_table.cc
sql/sql_table.cc
+1
-5
sql/sql_udf.cc
sql/sql_udf.cc
+1
-5
sql/sql_yacc.yy
sql/sql_yacc.yy
+2
-10
No files found.
sql/event_db_repository.cc
View file @
ec6d8dad
...
...
@@ -17,6 +17,7 @@
#include "sql_priv.h"
#include "unireg.h"
#include "sql_base.h" // close_thread_tables
#include "sql_parse.h"
#include "event_db_repository.h"
#include "key.h" // key_copy
#include "sql_db.h" // get_default_db_collation
...
...
@@ -702,19 +703,17 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
restore_record
(
table
,
s
->
default_values
);
// Get default values for fields
if
(
system_charset_info
->
cset
->
numchars
(
system_charset_info
,
parse_data
->
dbname
.
str
,
parse_data
->
dbname
.
str
+
parse_data
->
dbname
.
length
)
>
table
->
field
[
ET_FIELD_DB
]
->
char_length
())
if
(
check_string_char_length
(
&
parse_data
->
dbname
,
0
,
table
->
field
[
ET_FIELD_DB
]
->
char_length
(),
system_charset_info
,
1
))
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
parse_data
->
dbname
.
str
);
goto
end
;
}
if
(
system_charset_info
->
cset
->
numchars
(
system_charset_info
,
parse_data
->
name
.
str
,
parse_data
->
name
.
str
+
parse_data
->
name
.
length
)
>
table
->
field
[
ET_FIELD_NAME
]
->
char_length
())
if
(
check_string_char_length
(
&
parse_data
->
name
,
0
,
table
->
field
[
ET_FIELD_NAME
]
->
char_length
(),
system_charset_info
,
1
))
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
parse_data
->
name
.
str
);
goto
end
;
...
...
sql/sp_head.cc
View file @
ec6d8dad
...
...
@@ -488,12 +488,8 @@ check_routine_name(LEX_STRING *ident)
my_error
(
ER_SP_WRONG_NAME
,
MYF
(
0
),
ident
->
str
);
return
TRUE
;
}
if
(
check_string_char_length
(
ident
,
""
,
NAME_CHAR_LEN
,
system_charset_info
,
1
))
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
ident
->
str
);
if
(
check_ident_length
(
ident
))
return
TRUE
;
}
return
FALSE
;
}
...
...
sql/sql_parse.cc
View file @
ec6d8dad
...
...
@@ -4329,11 +4329,8 @@ case SQLCOM_PREPARE:
}
case
SQLCOM_SHOW_CREATE_TRIGGER
:
{
if
(
lex
->
spname
->
m_name
.
length
>
NAME_LEN
)
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
lex
->
spname
->
m_name
.
str
);
if
(
check_ident_length
(
&
lex
->
spname
->
m_name
))
goto
error
;
}
if
(
show_create_trigger
(
thd
,
lex
->
spname
))
goto
error
;
/* Error has been already logged. */
...
...
@@ -6019,12 +6016,9 @@ bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
LEX
*
lex
=
thd
->
lex
;
DBUG_ENTER
(
"add_field_to_list"
);
if
(
check_string_char_length
(
field_name
,
""
,
NAME_CHAR_LEN
,
system_charset_info
,
1
))
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
field_name
->
str
);
/* purecov: inspected */
if
(
check_ident_length
(
field_name
))
DBUG_RETURN
(
1
);
/* purecov: inspected */
}
if
(
type_modifier
&
PRI_KEY_FLAG
)
{
Key
*
key
;
...
...
@@ -7688,6 +7682,17 @@ bool check_string_char_length(LEX_STRING *str, const char *err_msg,
}
bool
check_ident_length
(
LEX_STRING
*
ident
)
{
if
(
check_string_char_length
(
ident
,
0
,
NAME_CHAR_LEN
,
system_charset_info
,
1
))
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
ident
->
str
);
return
1
;
}
return
0
;
}
/*
Check if path does not contain mysql data home directory
...
...
sql/sql_parse.h
View file @
ec6d8dad
...
...
@@ -75,6 +75,7 @@ bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
bool
check_string_char_length
(
LEX_STRING
*
str
,
const
char
*
err_msg
,
uint
max_char_length
,
CHARSET_INFO
*
cs
,
bool
no_error
);
bool
check_ident_length
(
LEX_STRING
*
ident
);
CHARSET_INFO
*
merge_charset_and_collation
(
CHARSET_INFO
*
cs
,
CHARSET_INFO
*
cl
);
bool
check_host_name
(
LEX_STRING
*
str
);
bool
check_identifier_name
(
LEX_STRING
*
str
,
uint
max_char_length
,
...
...
sql/sql_table.cc
View file @
ec6d8dad
...
...
@@ -3312,12 +3312,8 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
my_error
(
ER_TOO_MANY_KEY_PARTS
,
MYF
(
0
),
tmp
);
DBUG_RETURN
(
TRUE
);
}
if
(
check_string_char_length
(
&
key
->
name
,
""
,
NAME_CHAR_LEN
,
system_charset_info
,
1
))
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
key
->
name
.
str
);
if
(
check_ident_length
(
&
key
->
name
))
DBUG_RETURN
(
TRUE
);
}
key_iterator2
.
rewind
();
if
(
key
->
type
!=
Key
::
FOREIGN_KEY
)
{
...
...
sql/sql_udf.cc
View file @
ec6d8dad
...
...
@@ -455,12 +455,8 @@ int mysql_create_function(THD *thd,udf_func *udf)
my_message
(
ER_UDF_NO_PATHS
,
ER
(
ER_UDF_NO_PATHS
),
MYF
(
0
));
DBUG_RETURN
(
1
);
}
if
(
check_string_char_length
(
&
udf
->
name
,
""
,
NAME_CHAR_LEN
,
system_charset_info
,
1
))
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
udf
->
name
.
str
);
if
(
check_ident_length
(
&
udf
->
name
))
DBUG_RETURN
(
1
);
}
/*
Turn off row binlogging of this statement and use statement-based
...
...
sql/sql_yacc.yy
View file @
ec6d8dad
...
...
@@ -4670,12 +4670,8 @@ part_name:
{
partition_info *part_info= Lex->part_info;
partition_element *p_elem= part_info->curr_part_elem;
if (check_string_char_length(&$1, "", NAME_CHAR_LEN,
system_charset_info, true))
{
my_error(ER_TOO_LONG_IDENT, MYF(0), $1.str);
if (check_ident_length(&$1))
MYSQL_YYABORT;
}
p_elem->partition_name= $1.str;
}
;
...
...
@@ -4971,12 +4967,8 @@ sub_part_definition:
sub_name:
ident_or_text
{
if (check_string_char_length(&$1, "", NAME_CHAR_LEN,
system_charset_info, true))
{
my_error(ER_TOO_LONG_IDENT, MYF(0), $1.str);
if (check_ident_length(&$1))
MYSQL_YYABORT;
}
Lex->part_info->curr_part_elem->partition_name= $1.str;
}
;
...
...
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