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
a644b1f6
Commit
a644b1f6
authored
Sep 21, 2002
by
heikki@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dict0dict.c:
Fix a crash introduced when we grew foreign key comment to 16000 chars
parent
1f64f8d0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
6 deletions
+26
-6
innobase/dict/dict0dict.c
innobase/dict/dict0dict.c
+26
-6
No files found.
innobase/dict/dict0dict.c
View file @
a644b1f6
...
@@ -3109,7 +3109,7 @@ static
...
@@ -3109,7 +3109,7 @@ static
void
void
dict_print_info_on_foreign_keys_in_create_format
(
dict_print_info_on_foreign_keys_in_create_format
(
/*=============================================*/
/*=============================================*/
char
*
buf
,
/* in: auxiliary buffer
of 10000 chars
*/
char
*
buf
,
/* in: auxiliary buffer */
char
*
str
,
/* in/out: pointer to a string */
char
*
str
,
/* in/out: pointer to a string */
ulint
len
,
/* in: space in str available for info */
ulint
len
,
/* in: space in str available for info */
dict_table_t
*
table
)
/* in: table */
dict_table_t
*
table
)
/* in: table */
...
@@ -3135,6 +3135,9 @@ dict_print_info_on_foreign_keys_in_create_format(
...
@@ -3135,6 +3135,9 @@ dict_print_info_on_foreign_keys_in_create_format(
buf2
+=
sprintf
(
buf2
,
",
\n
FOREIGN KEY ("
);
buf2
+=
sprintf
(
buf2
,
",
\n
FOREIGN KEY ("
);
for
(
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
for
(
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
if
((
ulint
)(
buf2
-
buf
)
>=
len
)
{
goto
no_space
;
}
buf2
+=
sprintf
(
buf2
,
"`%s`"
,
buf2
+=
sprintf
(
buf2
,
"`%s`"
,
foreign
->
foreign_col_names
[
i
]);
foreign
->
foreign_col_names
[
i
]);
...
@@ -3157,6 +3160,9 @@ dict_print_info_on_foreign_keys_in_create_format(
...
@@ -3157,6 +3160,9 @@ dict_print_info_on_foreign_keys_in_create_format(
}
}
for
(
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
for
(
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
if
((
ulint
)(
buf2
-
buf
)
>=
len
)
{
goto
no_space
;
}
buf2
+=
sprintf
(
buf2
,
"`%s`"
,
buf2
+=
sprintf
(
buf2
,
"`%s`"
,
foreign
->
referenced_col_names
[
i
]);
foreign
->
referenced_col_names
[
i
]);
if
(
i
+
1
<
foreign
->
n_fields
)
{
if
(
i
+
1
<
foreign
->
n_fields
)
{
...
@@ -3176,7 +3182,7 @@ dict_print_info_on_foreign_keys_in_create_format(
...
@@ -3176,7 +3182,7 @@ dict_print_info_on_foreign_keys_in_create_format(
foreign
=
UT_LIST_GET_NEXT
(
foreign_list
,
foreign
);
foreign
=
UT_LIST_GET_NEXT
(
foreign_list
,
foreign
);
}
}
no_space:
mutex_exit
(
&
(
dict_sys
->
mutex
));
mutex_exit
(
&
(
dict_sys
->
mutex
));
buf
[
len
-
1
]
=
'\0'
;
buf
[
len
-
1
]
=
'\0'
;
...
@@ -3200,16 +3206,17 @@ dict_print_info_on_foreign_keys(
...
@@ -3200,16 +3206,17 @@ dict_print_info_on_foreign_keys(
dict_foreign_t
*
foreign
;
dict_foreign_t
*
foreign
;
ulint
i
;
ulint
i
;
char
*
buf2
;
char
*
buf2
;
char
buf
[
10000
];
char
*
buf
;
buf
=
mem_alloc
(
len
+
5000
);
if
(
create_table_format
)
{
if
(
create_table_format
)
{
dict_print_info_on_foreign_keys_in_create_format
(
dict_print_info_on_foreign_keys_in_create_format
(
buf
,
str
,
len
,
table
);
buf
,
str
,
len
,
table
);
mem_free
(
buf
);
return
;
return
;
}
}
buf2
=
buf
;
mutex_enter
(
&
(
dict_sys
->
mutex
));
mutex_enter
(
&
(
dict_sys
->
mutex
));
foreign
=
UT_LIST_GET_FIRST
(
table
->
foreign_list
);
foreign
=
UT_LIST_GET_FIRST
(
table
->
foreign_list
);
...
@@ -3217,13 +3224,21 @@ dict_print_info_on_foreign_keys(
...
@@ -3217,13 +3224,21 @@ dict_print_info_on_foreign_keys(
if
(
foreign
==
NULL
)
{
if
(
foreign
==
NULL
)
{
mutex_exit
(
&
(
dict_sys
->
mutex
));
mutex_exit
(
&
(
dict_sys
->
mutex
));
mem_free
(
buf
);
return
;
return
;
}
}
buf2
=
buf
;
while
(
foreign
!=
NULL
)
{
while
(
foreign
!=
NULL
)
{
buf2
+=
sprintf
(
buf2
,
"; ("
);
buf2
+=
sprintf
(
buf2
,
"; ("
);
for
(
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
for
(
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
if
((
ulint
)(
buf2
-
buf
)
>=
len
)
{
goto
no_space
;
}
buf2
+=
sprintf
(
buf2
,
"%s"
,
buf2
+=
sprintf
(
buf2
,
"%s"
,
foreign
->
foreign_col_names
[
i
]);
foreign
->
foreign_col_names
[
i
]);
...
@@ -3236,6 +3251,9 @@ dict_print_info_on_foreign_keys(
...
@@ -3236,6 +3251,9 @@ dict_print_info_on_foreign_keys(
foreign
->
referenced_table_name
);
foreign
->
referenced_table_name
);
for
(
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
for
(
i
=
0
;
i
<
foreign
->
n_fields
;
i
++
)
{
if
((
ulint
)(
buf2
-
buf
)
>=
len
)
{
goto
no_space
;
}
buf2
+=
sprintf
(
buf2
,
"%s"
,
buf2
+=
sprintf
(
buf2
,
"%s"
,
foreign
->
referenced_col_names
[
i
]);
foreign
->
referenced_col_names
[
i
]);
if
(
i
+
1
<
foreign
->
n_fields
)
{
if
(
i
+
1
<
foreign
->
n_fields
)
{
...
@@ -3255,9 +3273,11 @@ dict_print_info_on_foreign_keys(
...
@@ -3255,9 +3273,11 @@ dict_print_info_on_foreign_keys(
foreign
=
UT_LIST_GET_NEXT
(
foreign_list
,
foreign
);
foreign
=
UT_LIST_GET_NEXT
(
foreign_list
,
foreign
);
}
}
no_space:
mutex_exit
(
&
(
dict_sys
->
mutex
));
mutex_exit
(
&
(
dict_sys
->
mutex
));
buf
[
len
-
1
]
=
'\0'
;
buf
[
len
-
1
]
=
'\0'
;
ut_memcpy
(
str
,
buf
,
len
);
ut_memcpy
(
str
,
buf
,
len
);
mem_free
(
buf
);
}
}
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