Commit 7eefcb75 authored by unknown's avatar unknown

dict0dict.c:

  Cleanup


innobase/dict/dict0dict.c:
  Cleanup
parent ef55f2dc
...@@ -2139,27 +2139,31 @@ dict_scan_col( ...@@ -2139,27 +2139,31 @@ dict_scan_col(
} }
if (*ptr == '`' || *ptr == '"') { if (*ptr == '`' || *ptr == '"') {
/* /* The identifier is quoted. Search for the end quote. We
The identifier is quoted. Search for end quote. cannot use the general code here as the name may contain
We can't use the general code here as the name may contain special characters like the space. */
special characters like space.
*/ char quote = *ptr;
char quote= *ptr++;
ptr++; /* Skip the quote */
old_ptr= ptr;
/* old_ptr = ptr;
The colum name should always end with 'quote' but we check for
end zero just to be safe if this is called outside of MySQL /* The column name should always end with 'quote' but we check
*/ for an end zero just to be safe if this is called outside of
while (*ptr && *ptr != quote) MySQL. */
while (*ptr && *ptr != quote) {
ptr++; ptr++;
}
*column_name_len = (ulint)(ptr - old_ptr); *column_name_len = (ulint)(ptr - old_ptr);
if (*ptr) /* Skip end quote */ if (*ptr) { /* Skip end quote */
ptr++; ptr++;
} else {
return(ptr); /* Syntax error */
} }
else } else {
{
old_ptr = ptr; old_ptr = ptr;
while (!isspace(*ptr) && *ptr != ',' && *ptr != ')' while (!isspace(*ptr) && *ptr != ',' && *ptr != ')'
...@@ -2169,7 +2173,6 @@ dict_scan_col( ...@@ -2169,7 +2173,6 @@ dict_scan_col(
*column_name_len = (ulint)(ptr - old_ptr); *column_name_len = (ulint)(ptr - old_ptr);
} }
if (table == NULL) { if (table == NULL) {
*success = TRUE; *success = TRUE;
*column = NULL; *column = NULL;
...@@ -2213,8 +2216,8 @@ dict_scan_table_name( ...@@ -2213,8 +2216,8 @@ dict_scan_table_name(
{ {
char* dot_ptr = NULL; char* dot_ptr = NULL;
char* old_ptr; char* old_ptr;
char quote = '\0';
ulint i; ulint i;
char quote = 0;
*success = FALSE; *success = FALSE;
*table = NULL; *table = NULL;
...@@ -2229,22 +2232,33 @@ dict_scan_table_name( ...@@ -2229,22 +2232,33 @@ dict_scan_table_name(
} }
if (*ptr == '`' || *ptr == '"') { if (*ptr == '`' || *ptr == '"') {
quote= *ptr++; quote = *ptr;
ptr++;
} }
old_ptr = ptr; old_ptr = ptr;
while (*ptr != quote && if (quote) {
(quote || (!isspace(*ptr) && *ptr != '(')) && while (*ptr != quote && *ptr != '\0') {
*ptr != '\0') { ptr++;
if (!quote && *ptr == '.') {
dot_ptr = ptr;
} }
if (*ptr == '\0') {
return(old_ptr); /* Syntax error */
}
} else {
while (!isspace(*ptr) && *ptr != '(' && *ptr != '\0') {
if (*ptr == '.') {
dot_ptr = ptr;
}
ptr++; ptr++;
} }
}
if (ptr - old_ptr > 2000) { if (ptr - old_ptr > 2000) {
return(old_ptr); return(old_ptr);
} }
...@@ -2290,7 +2304,7 @@ dict_scan_table_name( ...@@ -2290,7 +2304,7 @@ dict_scan_table_name(
*table = dict_table_get_low(second_table_name); *table = dict_table_get_low(second_table_name);
if (*ptr && *ptr == quote) { if (quote && *ptr == quote) {
ptr++; ptr++;
} }
...@@ -2310,7 +2324,7 @@ dict_scan_id( ...@@ -2310,7 +2324,7 @@ dict_scan_id(
scannable */ scannable */
ulint* len) /* out: length of the id */ ulint* len) /* out: length of the id */
{ {
char quote = 0; char quote = '\0';
*start = NULL; *start = NULL;
...@@ -2329,12 +2343,17 @@ dict_scan_id( ...@@ -2329,12 +2343,17 @@ dict_scan_id(
*start = ptr; *start = ptr;
while (*ptr != quote && if (quote) {
(!quote || (!isspace(*ptr) && *ptr != ',' && *ptr != '(' && while (*ptr != quote && *ptr != '\0') {
*ptr != ')'))
&& *ptr != '\0') {
ptr++; ptr++;
} }
} else {
while (!isspace(*ptr) && *ptr != '(' && *ptr != ')'
&& *ptr != ',' && *ptr != '\0') {
ptr++;
}
}
*len = (ulint) (ptr - *start); *len = (ulint) (ptr - *start);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment