mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Cleanups during review
This commit is contained in:
@ -402,33 +402,48 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* Configuration File Directives */
|
/* Configuration File Directives */
|
||||||
if ((*ptr == '!') && (recursion_level < max_recursion_level))
|
if ((*ptr == '!'))
|
||||||
{
|
{
|
||||||
|
if (recursion_level >= max_recursion_level)
|
||||||
|
{
|
||||||
|
for (end= ptr + strlen(ptr) - 1;
|
||||||
|
my_isspace(&my_charset_latin1, *(end - 1));
|
||||||
|
end--)
|
||||||
|
{}
|
||||||
|
end[0]= 0;
|
||||||
|
fprintf(stderr,
|
||||||
|
"Warning: skipping '%s' directive as maximum include"
|
||||||
|
"recursion level was reached in file %s at line %d\n",
|
||||||
|
ptr, name, line);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* skip over `!' and following whitespace */
|
/* skip over `!' and following whitespace */
|
||||||
for (++ptr; my_isspace(&my_charset_latin1, ptr[0]); ptr++)
|
for (++ptr; my_isspace(&my_charset_latin1, ptr[0]); ptr++)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
if ((!strncmp(ptr, includedir_keyword, sizeof(includedir_keyword) - 1))
|
if ((!strncmp(ptr, includedir_keyword,
|
||||||
&& my_isspace(&my_charset_latin1, ptr[sizeof(includedir_keyword) - 1]))
|
sizeof(includedir_keyword) - 1)) &&
|
||||||
|
my_isspace(&my_charset_latin1, ptr[sizeof(includedir_keyword) - 1]))
|
||||||
{
|
{
|
||||||
/* skip over "includedir" and following whitespace */
|
/* skip over "includedir" and following whitespace */
|
||||||
for (ptr+= sizeof(includedir_keyword) - 1;
|
for (ptr+= sizeof(includedir_keyword) - 1;
|
||||||
my_isspace(&my_charset_latin1, ptr[0]); ptr++)
|
my_isspace(&my_charset_latin1, ptr[0]); ptr++)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/* trim trailing whitespace from directory name */
|
/*
|
||||||
end= ptr + strlen(ptr) - 1;
|
trim trailing whitespace from directory name
|
||||||
/* fgets() stores the newline character in the buffer */
|
The -1 below is for the newline added by fgets()
|
||||||
if ((end[0] == '\n') || (end[0] == '\r') ||
|
Note that my_isspace() is true for \r and \n
|
||||||
my_isspace(&my_charset_latin1, end[0]))
|
*/
|
||||||
{
|
for (end= ptr + strlen(ptr) - 1;
|
||||||
for (; my_isspace(&my_charset_latin1, *(end - 1)); end--)
|
my_isspace(&my_charset_latin1, *(end - 1));
|
||||||
{}
|
end--)
|
||||||
end[0]= 0;
|
{}
|
||||||
}
|
end[0]= 0;
|
||||||
|
|
||||||
/* print error msg if there is nothing after !includedir directive */
|
/* print error msg if there is nothing after !includedir directive */
|
||||||
if (end == ptr)
|
if (end <= ptr)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"error: Wrong !includedir directive in config "
|
"error: Wrong !includedir directive in config "
|
||||||
@ -468,8 +483,8 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
|
|
||||||
my_dirend(search_dir);
|
my_dirend(search_dir);
|
||||||
}
|
}
|
||||||
else if ((!strncmp(ptr, include_keyword, sizeof(include_keyword) - 1))
|
else if ((!strncmp(ptr, include_keyword, sizeof(include_keyword) - 1)) &&
|
||||||
&& my_isspace(&my_charset_latin1, ptr[sizeof(include_keyword) - 1]))
|
my_isspace(&my_charset_latin1, ptr[sizeof(include_keyword)-1]))
|
||||||
{
|
{
|
||||||
/* skip over `include' and following whitespace */
|
/* skip over `include' and following whitespace */
|
||||||
for (ptr+= sizeof(include_keyword) - 1;
|
for (ptr+= sizeof(include_keyword) - 1;
|
||||||
@ -477,12 +492,13 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
/* trim trailing whitespace from filename */
|
/* trim trailing whitespace from filename */
|
||||||
end= ptr + strlen(ptr) - 1;
|
for (end= ptr + strlen(ptr) - 1;
|
||||||
for (; my_isspace(&my_charset_latin1, *(end - 1)) ; end--)
|
my_isspace(&my_charset_latin1, *(end - 1));
|
||||||
|
end--)
|
||||||
{}
|
{}
|
||||||
end[0]= 0;
|
end[0]= 0;
|
||||||
|
|
||||||
if (end == ptr)
|
if (end <= ptr)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"error: Wrong !include directive in config "
|
"error: Wrong !include directive in config "
|
||||||
@ -497,14 +513,6 @@ static int search_default_file_with_ext(DYNAMIC_ARRAY *args, MEM_ROOT *alloc,
|
|||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
if (recursion_level >= max_recursion_level)
|
|
||||||
{
|
|
||||||
fprintf(stderr,
|
|
||||||
"warning: skipping !include directive as maximum include"
|
|
||||||
"recursion level was reached in file %s at line %d\n",
|
|
||||||
name, line);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*ptr == '[') /* Group name */
|
if (*ptr == '[') /* Group name */
|
||||||
{
|
{
|
||||||
|
@ -72,7 +72,7 @@ static int check_insert_fields(THD *thd, TABLE *table, List<Item> &fields,
|
|||||||
{
|
{
|
||||||
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
|
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
|
||||||
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
|
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
|
||||||
MYF(0), 1);
|
MYF(0), 1L);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||||
@ -89,7 +89,7 @@ static int check_insert_fields(THD *thd, TABLE *table, List<Item> &fields,
|
|||||||
{
|
{
|
||||||
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
|
my_printf_error(ER_WRONG_VALUE_COUNT_ON_ROW,
|
||||||
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
|
ER(ER_WRONG_VALUE_COUNT_ON_ROW),
|
||||||
MYF(0), 1);
|
MYF(0), 1L);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
TABLE_LIST table_list;
|
TABLE_LIST table_list;
|
||||||
|
@ -2055,8 +2055,8 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
|
|||||||
KEY_OPTIMIZE_EXISTS) |
|
KEY_OPTIMIZE_EXISTS) |
|
||||||
((old->optimize | new_fields->optimize) &
|
((old->optimize | new_fields->optimize) &
|
||||||
KEY_OPTIMIZE_REF_OR_NULL));
|
KEY_OPTIMIZE_REF_OR_NULL));
|
||||||
old->null_rejecting= old->null_rejecting &&
|
old->null_rejecting= (old->null_rejecting &&
|
||||||
new_fields->null_rejecting;
|
new_fields->null_rejecting);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (old->eq_func && new_fields->eq_func &&
|
else if (old->eq_func && new_fields->eq_func &&
|
||||||
@ -2068,8 +2068,8 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
|
|||||||
KEY_OPTIMIZE_EXISTS) |
|
KEY_OPTIMIZE_EXISTS) |
|
||||||
((old->optimize | new_fields->optimize) &
|
((old->optimize | new_fields->optimize) &
|
||||||
KEY_OPTIMIZE_REF_OR_NULL));
|
KEY_OPTIMIZE_REF_OR_NULL));
|
||||||
old->null_rejecting= old->null_rejecting &&
|
old->null_rejecting= (old->null_rejecting &&
|
||||||
new_fields->null_rejecting;
|
new_fields->null_rejecting);
|
||||||
}
|
}
|
||||||
else if (old->eq_func && new_fields->eq_func &&
|
else if (old->eq_func && new_fields->eq_func &&
|
||||||
(old->val->is_null() || new_fields->val->is_null()))
|
(old->val->is_null() || new_fields->val->is_null()))
|
||||||
@ -2081,7 +2081,7 @@ merge_key_fields(KEY_FIELD *start,KEY_FIELD *new_fields,KEY_FIELD *end,
|
|||||||
if (old->val->is_null())
|
if (old->val->is_null())
|
||||||
old->val= new_fields->val;
|
old->val= new_fields->val;
|
||||||
/* The referred expression can be NULL: */
|
/* The referred expression can be NULL: */
|
||||||
old->null_rejecting= false;
|
old->null_rejecting= 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2242,6 +2242,8 @@ add_key_field(KEY_FIELD **key_fields,uint and_level, Item_func *cond,
|
|||||||
If the condition has form "tbl.keypart = othertbl.field" and
|
If the condition has form "tbl.keypart = othertbl.field" and
|
||||||
othertbl.field can be NULL, there will be no matches if othertbl.field
|
othertbl.field can be NULL, there will be no matches if othertbl.field
|
||||||
has NULL value.
|
has NULL value.
|
||||||
|
We use null_rejecting in add_not_null_conds() to add
|
||||||
|
'othertbl.field IS NOT NULL' to tab->select_cond.
|
||||||
*/
|
*/
|
||||||
(*key_fields)->null_rejecting= (cond->functype() == Item_func::EQ_FUNC) &&
|
(*key_fields)->null_rejecting= (cond->functype() == Item_func::EQ_FUNC) &&
|
||||||
((*value)->type() == Item::FIELD_ITEM) &&
|
((*value)->type() == Item::FIELD_ITEM) &&
|
||||||
|
Reference in New Issue
Block a user