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
86a4272a
Commit
86a4272a
authored
Feb 12, 2013
by
Annamalai Gurusami
Browse files
Options
Browse Files
Download
Plain Diff
Merge from mysql-5.1 to mysql-5.5.
parents
f0cf4b08
b39370bc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
1 deletion
+61
-1
storage/innobase/dict/dict0crea.c
storage/innobase/dict/dict0crea.c
+9
-0
storage/innobase/dict/dict0dict.c
storage/innobase/dict/dict0dict.c
+4
-1
storage/innobase/handler/ha_innodb.cc
storage/innobase/handler/ha_innodb.cc
+34
-0
storage/innobase/include/db0err.h
storage/innobase/include/db0err.h
+1
-0
storage/innobase/include/ha_prototypes.h
storage/innobase/include/ha_prototypes.h
+11
-0
storage/innobase/ut/ut0ut.c
storage/innobase/ut/ut0ut.c
+2
-0
No files found.
storage/innobase/dict/dict0crea.c
View file @
86a4272a
...
...
@@ -42,6 +42,7 @@ Created 1/8/1996 Heikki Tuuri
#include "trx0roll.h"
#include "usr0sess.h"
#include "ut0vec.h"
#include "ha_prototypes.h"
/*****************************************************************//**
Based on a table object, this function builds the entry to be inserted
...
...
@@ -1427,12 +1428,20 @@ dict_create_add_foreign_to_dictionary(
pars_info_t
*
info
=
pars_info_create
();
if
(
foreign
->
id
==
NULL
)
{
char
*
stripped_name
;
/* Generate a new constraint id */
ulint
namelen
=
strlen
(
table
->
name
);
char
*
id
=
mem_heap_alloc
(
foreign
->
heap
,
namelen
+
20
);
/* no overflow if number < 1e13 */
sprintf
(
id
,
"%s_ibfk_%lu"
,
table
->
name
,
(
ulong
)
(
*
id_nr
)
++
);
foreign
->
id
=
id
;
stripped_name
=
strchr
(
foreign
->
id
,
'/'
)
+
1
;
if
(
innobase_check_identifier_length
(
stripped_name
))
{
fprintf
(
stderr
,
"InnoDB: Generated foreign key "
"name (%s) is too long
\n
"
,
foreign
->
id
);
return
(
DB_IDENTIFIER_TOO_LONG
);
}
}
pars_info_add_str_literal
(
info
,
"id"
,
foreign
->
id
);
...
...
storage/innobase/dict/dict0dict.c
View file @
86a4272a
...
...
@@ -4679,6 +4679,7 @@ dict_print_info_on_foreign_key_in_create_format(
dict_foreign_t
*
foreign
,
/*!< in: foreign key constraint */
ibool
add_newline
)
/*!< in: whether to add a newline */
{
char
constraint_name
[
MAX_TABLE_NAME_LEN
];
const
char
*
stripped_id
;
ulint
i
;
...
...
@@ -4700,7 +4701,9 @@ dict_print_info_on_foreign_key_in_create_format(
}
fputs
(
" CONSTRAINT "
,
file
);
ut_print_name
(
file
,
trx
,
FALSE
,
stripped_id
);
innobase_convert_from_id
(
&
my_charset_filename
,
constraint_name
,
stripped_id
,
MAX_TABLE_NAME_LEN
);
ut_print_name
(
file
,
trx
,
FALSE
,
constraint_name
);
fputs
(
" FOREIGN KEY ("
,
file
);
for
(
i
=
0
;;)
{
...
...
storage/innobase/handler/ha_innodb.cc
View file @
86a4272a
...
...
@@ -1075,6 +1075,9 @@ convert_error_code_to_mysql(
return
(
HA_ERR_UNDO_REC_TOO_BIG
);
case
DB_OUT_OF_MEMORY
:
return
(
HA_ERR_OUT_OF_MEM
);
case
DB_IDENTIFIER_TOO_LONG
:
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
));
return
(
HA_ERR_INTERNAL_ERROR
);
}
}
...
...
@@ -1155,6 +1158,37 @@ innobase_convert_from_table_id(
strconvert
(
cs
,
from
,
&
my_charset_filename
,
to
,
(
uint
)
len
,
&
errors
);
}
/**********************************************************************
Check if the length of the identifier exceeds the maximum allowed.
The input to this function is an identifier in charset my_charset_filename.
return true when length of identifier is too long. */
extern
"C"
UNIV_INTERN
my_bool
innobase_check_identifier_length
(
/*=============================*/
const
char
*
id
)
/* in: identifier to check. it must belong
to charset my_charset_filename */
{
char
tmp
[
MAX_TABLE_NAME_LEN
+
10
];
uint
errors
;
uint
len
;
int
well_formed_error
=
0
;
CHARSET_INFO
*
cs1
=
&
my_charset_filename
;
CHARSET_INFO
*
cs2
=
thd_charset
(
current_thd
);
len
=
strconvert
(
cs1
,
id
,
cs2
,
tmp
,
MAX_TABLE_NAME_LEN
+
10
,
&
errors
);
uint
res
=
cs2
->
cset
->
well_formed_len
(
cs2
,
tmp
,
tmp
+
len
,
NAME_CHAR_LEN
,
&
well_formed_error
);
if
(
well_formed_error
||
res
!=
len
)
{
my_error
(
ER_TOO_LONG_IDENT
,
MYF
(
0
),
tmp
);
return
(
true
);
}
return
(
false
);
}
/******************************************************************//**
Converts an identifier to UTF-8. */
extern
"C"
UNIV_INTERN
...
...
storage/innobase/include/db0err.h
View file @
86a4272a
...
...
@@ -114,6 +114,7 @@ enum db_err {
DB_UNDO_RECORD_TOO_BIG
,
/* the undo log record is too big */
DB_TABLE_IN_FK_CHECK
,
/* table is being used in foreign
key check */
DB_IDENTIFIER_TOO_LONG
,
/* Identifier name too long */
/* The following are partial failure codes */
DB_FAIL
=
1000
,
...
...
storage/innobase/include/ha_prototypes.h
View file @
86a4272a
...
...
@@ -296,4 +296,15 @@ ulint
innobase_get_lower_case_table_names
(
void
);
/*=====================================*/
/**********************************************************************
Check if the length of the identifier exceeds the maximum allowed.
The input to this function is an identifier in charset my_charset_filename.
return true when length of identifier is too long. */
UNIV_INTERN
my_bool
innobase_check_identifier_length
(
/*=============================*/
const
char
*
id
);
/* in: identifier to check. it must belong
to charset my_charset_filename */
#endif
storage/innobase/ut/ut0ut.c
View file @
86a4272a
...
...
@@ -728,6 +728,8 @@ ut_strerr(
return
(
"End of index"
);
case
DB_TABLE_IN_FK_CHECK
:
return
(
"Table is being used in foreign key check"
);
case
DB_IDENTIFIER_TOO_LONG
:
return
(
"Identifier name is too long"
);
/* do not add default: in order to produce a warning if new code
is added to the enum but not added here */
}
...
...
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