mirror of
https://github.com/zebrajr/server.git
synced 2025-12-06 12:20:40 +01:00
Reduce usage of strlen()
Changes: - To detect automatic strlen() I removed the methods in String that uses 'const char *' without a length: - String::append(const char*) - Binary_string(const char *str) - String(const char *str, CHARSET_INFO *cs) - append_for_single_quote(const char *) All usage of append(const char*) is changed to either use String::append(char), String::append(const char*, size_t length) or String::append(LEX_CSTRING) - Added STRING_WITH_LEN() around constant string arguments to String::append() - Added overflow argument to escape_string_for_mysql() and escape_quotes_for_mysql() instead of returning (size_t) -1 on overflow. This was needed as most usage of the above functions never tested the result for -1 and would have given wrong results or crashes in case of overflows. - Added Item_func_or_sum::func_name_cstring(), which returns LEX_CSTRING. Changed all Item_func::func_name()'s to func_name_cstring()'s. The old Item_func_or_sum::func_name() is now an inline function that returns func_name_cstring().str. - Changed Item::mode_name() and Item::func_name_ext() to return LEX_CSTRING. - Changed for some functions the name argument from const char * to to const LEX_CSTRING &: - Item::Item_func_fix_attributes() - Item::check_type_...() - Type_std_attributes::agg_item_collations() - Type_std_attributes::agg_item_set_converter() - Type_std_attributes::agg_arg_charsets...() - Type_handler_hybrid_field_type::aggregate_for_result() - Type_handler_geometry::check_type_geom_or_binary() - Type_handler::Item_func_or_sum_illegal_param() - Predicant_to_list_comparator::add_value_skip_null() - Predicant_to_list_comparator::add_value() - cmp_item_row::prepare_comparators() - cmp_item_row::aggregate_row_elements_for_comparison() - Cursor_ref::print_func() - Removes String_space() as it was only used in one cases and that could be simplified to not use String_space(), thanks to the fixed my_vsnprintf(). - Added some const LEX_CSTRING's for common strings: - NULL_clex_str, DATA_clex_str, INDEX_clex_str. - Changed primary_key_name to a LEX_CSTRING - Renamed String::set_quick() to String::set_buffer_if_not_allocated() to clarify what the function really does. - Rename of protocol function: bool store(const char *from, CHARSET_INFO *cs) to bool store_string_or_null(const char *from, CHARSET_INFO *cs). This was done to both clarify the difference between this 'store' function and also to make it easier to find unoptimal usage of store() calls. - Added Protocol::store(const LEX_CSTRING*, CHARSET_INFO*) - Changed some 'const char*' arrays to instead be of type LEX_CSTRING. - class Item_func_units now used LEX_CSTRING for name. Other things: - Fixed a bug in mysql.cc:construct_prompt() where a wrong escape character in the prompt would cause some part of the prompt to be duplicated. - Fixed a lot of instances where the length of the argument to append is known or easily obtain but was not used. - Removed some not needed 'virtual' definition for functions that was inherited from the parent. I added override to these. - Fixed Ordered_key::print() to preallocate needed buffer. Old code could case memory overruns. - Simplified some loops when adding char * to a String with delimiters.
This commit is contained in:
parent
b3bc02f923
commit
b6ff139aa3
123
client/mysql.cc
123
client/mysql.cc
|
|
@ -2062,13 +2062,14 @@ static int read_and_execute(bool interactive)
|
|||
{
|
||||
status.exit_status= 1;
|
||||
String msg;
|
||||
msg.append("ASCII '\\0' appeared in the statement, but this is not "
|
||||
"allowed unless option --binary-mode is enabled and mysql is "
|
||||
"run in non-interactive mode. Set --binary-mode to 1 if ASCII "
|
||||
"'\\0' is expected. Query: '");
|
||||
msg.append(STRING_WITH_LEN(
|
||||
"ASCII '\\0' appeared in the statement, but this is not "
|
||||
"allowed unless option --binary-mode is enabled and mysql is "
|
||||
"run in non-interactive mode. Set --binary-mode to 1 if ASCII "
|
||||
"'\\0' is expected. Query: '"));
|
||||
msg.append(glob_buffer);
|
||||
msg.append(line);
|
||||
msg.append("'.");
|
||||
msg.append(line, strlen(line));
|
||||
msg.append(STRING_WITH_LEN("'."));
|
||||
put_info(msg.c_ptr(), INFO_ERROR);
|
||||
break;
|
||||
}
|
||||
|
|
@ -2462,8 +2463,9 @@ static bool add_line(String &buffer, char *line, size_t line_length,
|
|||
my_isspace(charset_info, pos[2]))))
|
||||
{
|
||||
// Add trailing single line comments to this statement
|
||||
buffer.append(pos);
|
||||
pos+= strlen(pos);
|
||||
size_t length= strlen(pos);
|
||||
buffer.append(pos, length);
|
||||
pos+= length;
|
||||
}
|
||||
|
||||
pos--;
|
||||
|
|
@ -2509,7 +2511,7 @@ static bool add_line(String &buffer, char *line, size_t line_length,
|
|||
{
|
||||
bool started_with_nothing= !buffer.length();
|
||||
|
||||
buffer.append(pos);
|
||||
buffer.append(pos, strlen(pos));
|
||||
|
||||
/*
|
||||
A single-line comment by itself gets sent immediately so that
|
||||
|
|
@ -2667,7 +2669,7 @@ static void fix_history(String *final_command)
|
|||
not in string, change to space
|
||||
if in string, leave it alone
|
||||
*/
|
||||
fixed_buffer.append(str_char == '\0' ? " " : "\n");
|
||||
fixed_buffer.append(str_char == '\0' ? ' ' : '\n');
|
||||
total_lines++;
|
||||
break;
|
||||
case '\\':
|
||||
|
|
@ -3313,7 +3315,8 @@ com_go(String *buffer,char *line __attribute__((unused)))
|
|||
#ifdef HAVE_READLINE
|
||||
if (status.add_to_history)
|
||||
{
|
||||
buffer->append(vertical ? "\\G" : delimiter);
|
||||
const char *delim= vertical ? "\\G" : delimiter;
|
||||
buffer->append(delim, strlen(delim));
|
||||
/* Append final command onto history */
|
||||
fix_history(buffer);
|
||||
}
|
||||
|
|
@ -5227,20 +5230,27 @@ static const char *construct_prompt()
|
|||
add_int_to_prompt(++prompt_counter);
|
||||
break;
|
||||
case 'v':
|
||||
if (connected)
|
||||
processed_prompt.append(mysql_get_server_info(&mysql));
|
||||
else
|
||||
processed_prompt.append("not_connected");
|
||||
{
|
||||
const char *info= (connected ?
|
||||
mysql_get_server_info(&mysql) :
|
||||
"not_connected");
|
||||
processed_prompt.append(info, strlen(info));
|
||||
break;
|
||||
}
|
||||
case 'd':
|
||||
processed_prompt.append(current_db ? current_db : "(none)");
|
||||
break;
|
||||
case 'N':
|
||||
if (connected)
|
||||
processed_prompt.append(mysql_get_server_name(&mysql));
|
||||
else
|
||||
processed_prompt.append("unknown");
|
||||
{
|
||||
const char *db= current_db ? current_db : "(none)";
|
||||
processed_prompt.append(db, strlen(db));
|
||||
break;
|
||||
}
|
||||
case 'N':
|
||||
{
|
||||
const char *name= (connected ?
|
||||
mysql_get_server_name(&mysql) :
|
||||
"unknown");
|
||||
processed_prompt.append(name, strlen(name));
|
||||
break;
|
||||
}
|
||||
case 'h':
|
||||
case 'H':
|
||||
{
|
||||
|
|
@ -5249,16 +5259,20 @@ static const char *construct_prompt()
|
|||
if (strstr(prompt, "Localhost") || strstr(prompt, "localhost "))
|
||||
{
|
||||
if (*c == 'h')
|
||||
processed_prompt.append("localhost");
|
||||
processed_prompt.append(STRING_WITH_LEN("localhost"));
|
||||
else
|
||||
{
|
||||
static char hostname[FN_REFLEN];
|
||||
if (hostname[0])
|
||||
processed_prompt.append(hostname);
|
||||
static size_t hostname_length;
|
||||
if (hostname_length)
|
||||
processed_prompt.append(hostname, hostname_length);
|
||||
else if (gethostname(hostname, sizeof(hostname)) == 0)
|
||||
processed_prompt.append(hostname);
|
||||
{
|
||||
hostname_length= strlen(hostname);
|
||||
processed_prompt.append(hostname, hostname_length);
|
||||
}
|
||||
else
|
||||
processed_prompt.append("gethostname(2) failed");
|
||||
processed_prompt.append(STRING_WITH_LEN("gethostname(2) failed"));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -5273,38 +5287,47 @@ static const char *construct_prompt()
|
|||
#ifndef EMBEDDED_LIBRARY
|
||||
if (!connected)
|
||||
{
|
||||
processed_prompt.append("not_connected");
|
||||
processed_prompt.append(STRING_WITH_LEN("not_connected"));
|
||||
break;
|
||||
}
|
||||
|
||||
const char *host_info = mysql_get_host_info(&mysql);
|
||||
if (strstr(host_info, "memory"))
|
||||
{
|
||||
processed_prompt.append( mysql.host );
|
||||
processed_prompt.append( mysql.host, strlen(mysql.host));
|
||||
}
|
||||
else if (strstr(host_info,"TCP/IP") ||
|
||||
!mysql.unix_socket)
|
||||
add_int_to_prompt(mysql.port);
|
||||
else
|
||||
{
|
||||
char *pos=strrchr(mysql.unix_socket,'/');
|
||||
processed_prompt.append(pos ? pos+1 : mysql.unix_socket);
|
||||
char *pos= strrchr(mysql.unix_socket,'/');
|
||||
const char *tmp= pos ? pos+1 : mysql.unix_socket;
|
||||
processed_prompt.append(tmp, strlen(tmp));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
case 'U':
|
||||
{
|
||||
const char *name;
|
||||
if (!full_username)
|
||||
init_username();
|
||||
processed_prompt.append(full_username ? full_username :
|
||||
(current_user ? current_user : "(unknown)"));
|
||||
name= (full_username ? full_username :
|
||||
(current_user ? current_user : "(unknown)"));
|
||||
processed_prompt.append(name, strlen(name));
|
||||
break;
|
||||
}
|
||||
case 'u':
|
||||
{
|
||||
const char *name;
|
||||
if (!full_username)
|
||||
init_username();
|
||||
processed_prompt.append(part_username ? part_username :
|
||||
(current_user ? current_user : "(unknown)"));
|
||||
name= (part_username ? part_username :
|
||||
(current_user ? current_user : "(unknown)"));
|
||||
processed_prompt.append(name, strlen(name));
|
||||
break;
|
||||
}
|
||||
case PROMPT_CHAR:
|
||||
processed_prompt.append(PROMPT_CHAR);
|
||||
break;
|
||||
|
|
@ -5345,29 +5368,39 @@ static const char *construct_prompt()
|
|||
add_int_to_prompt(t->tm_year+1900);
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
char* dateTime;
|
||||
const char *tmp;
|
||||
dateTime = ctime(&lclock);
|
||||
processed_prompt.append(strtok(dateTime,"\n"));
|
||||
tmp= strtok(dateTime,"\n");
|
||||
processed_prompt.append(tmp, strlen(tmp));
|
||||
break;
|
||||
}
|
||||
case 's':
|
||||
if (t->tm_sec < 10)
|
||||
processed_prompt.append('0');
|
||||
add_int_to_prompt(t->tm_sec);
|
||||
break;
|
||||
case 'w':
|
||||
processed_prompt.append(day_names[t->tm_wday]);
|
||||
break;
|
||||
{
|
||||
const char *name= day_names[t->tm_wday];
|
||||
processed_prompt.append(name, strlen(name));
|
||||
break;
|
||||
}
|
||||
case 'P':
|
||||
processed_prompt.append(t->tm_hour < 12 ? "am" : "pm");
|
||||
processed_prompt.append(t->tm_hour < 12 ? "am" : "pm", 2);
|
||||
break;
|
||||
case 'o':
|
||||
add_int_to_prompt(t->tm_mon+1);
|
||||
break;
|
||||
case 'O':
|
||||
processed_prompt.append(month_names[t->tm_mon]);
|
||||
{
|
||||
const char *name= month_names[t->tm_mon];
|
||||
processed_prompt.append(name, strlen(name));
|
||||
break;
|
||||
}
|
||||
case '\'':
|
||||
processed_prompt.append("'");
|
||||
processed_prompt.append('\'');
|
||||
break;
|
||||
case '"':
|
||||
processed_prompt.append('"');
|
||||
|
|
@ -5379,10 +5412,10 @@ static const char *construct_prompt()
|
|||
processed_prompt.append('\t');
|
||||
break;
|
||||
case 'l':
|
||||
processed_prompt.append(delimiter_str);
|
||||
processed_prompt.append(delimiter_str, strlen(delimiter_str));
|
||||
break;
|
||||
default:
|
||||
processed_prompt.append(c);
|
||||
processed_prompt.append(*c);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5394,8 +5427,8 @@ static const char *construct_prompt()
|
|||
static void add_int_to_prompt(int toadd)
|
||||
{
|
||||
char buffer[16];
|
||||
int10_to_str(toadd,buffer,10);
|
||||
processed_prompt.append(buffer);
|
||||
size_t length= (size_t) (int10_to_str(toadd,buffer,10) - buffer);
|
||||
processed_prompt.append(buffer, length);
|
||||
}
|
||||
|
||||
static void init_username()
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ static void usage()
|
|||
static my_bool
|
||||
get_one_option(const struct my_option *opt __attribute__((unused)),
|
||||
const char *argument __attribute__((unused)),
|
||||
const char *filename)
|
||||
const char *filename __attribute__((unused)))
|
||||
{
|
||||
switch (opt->id) {
|
||||
case 'c':
|
||||
|
|
|
|||
|
|
@ -1059,7 +1059,8 @@ extern void add_compiled_collation(struct charset_info_st *cs);
|
|||
extern void add_compiled_extra_collation(struct charset_info_st *cs);
|
||||
extern size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
|
||||
char *to, size_t to_length,
|
||||
const char *from, size_t length);
|
||||
const char *from, size_t length,
|
||||
my_bool *overflow);
|
||||
extern char *get_tty_password(const char *opt_message);
|
||||
#ifdef _WIN32
|
||||
#define BACKSLASH_MBTAIL
|
||||
|
|
@ -1069,7 +1070,8 @@ extern CHARSET_INFO *fs_character_set(void);
|
|||
extern const char *my_default_csname(void);
|
||||
extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
|
||||
char *to, size_t to_length,
|
||||
const char *from, size_t length);
|
||||
const char *from, size_t length,
|
||||
my_bool *overflow);
|
||||
|
||||
extern void thd_increment_bytes_sent(void *thd, size_t length);
|
||||
extern void thd_increment_bytes_received(void *thd, size_t length);
|
||||
|
|
|
|||
|
|
@ -1210,16 +1210,21 @@ mysql_hex_string(char *to, const char *from, ulong length)
|
|||
ulong STDCALL
|
||||
mysql_escape_string(char *to,const char *from,ulong length)
|
||||
{
|
||||
return (uint) escape_string_for_mysql(default_charset_info, to, 0, from, length);
|
||||
my_bool overflow;
|
||||
return (uint) escape_string_for_mysql(default_charset_info, to, 0, from,
|
||||
length, &overflow);
|
||||
}
|
||||
|
||||
ulong STDCALL
|
||||
mysql_real_escape_string(MYSQL *mysql, char *to,const char *from,
|
||||
ulong length)
|
||||
{
|
||||
my_bool overflow;
|
||||
if (mysql->server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES)
|
||||
return (uint) escape_quotes_for_mysql(mysql->charset, to, 0, from, length);
|
||||
return (uint) escape_string_for_mysql(mysql->charset, to, 0, from, length);
|
||||
return (ulong) escape_quotes_for_mysql(mysql->charset, to, 0, from, length,
|
||||
&overflow);
|
||||
return (ulong) escape_string_for_mysql(mysql->charset, to, 0, from, length,
|
||||
&overflow);
|
||||
}
|
||||
|
||||
void STDCALL
|
||||
|
|
|
|||
|
|
@ -1080,6 +1080,8 @@ my_bool resolve_collation(const char *cl_name,
|
|||
to_length Length of destination buffer, or 0
|
||||
from The string to escape
|
||||
length The length of the string to escape
|
||||
overflow Set to 1 if the escaped string did not fit in
|
||||
the to buffer
|
||||
|
||||
DESCRIPTION
|
||||
This escapes the contents of a string by adding backslashes before special
|
||||
|
|
@ -1091,17 +1093,17 @@ my_bool resolve_collation(const char *cl_name,
|
|||
"big enough"
|
||||
|
||||
RETURN VALUES
|
||||
(size_t) -1 The escaped string did not fit in the to buffer
|
||||
# The length of the escaped string
|
||||
*/
|
||||
|
||||
size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
|
||||
char *to, size_t to_length,
|
||||
const char *from, size_t length)
|
||||
const char *from, size_t length,
|
||||
my_bool *overflow)
|
||||
{
|
||||
const char *to_start= to;
|
||||
const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length);
|
||||
my_bool overflow= FALSE;
|
||||
*overflow= FALSE;
|
||||
for (end= from + length; from < end; from++)
|
||||
{
|
||||
char escape= 0;
|
||||
|
|
@ -1111,7 +1113,7 @@ size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
|
|||
{
|
||||
if (to + tmp_length > to_end)
|
||||
{
|
||||
overflow= TRUE;
|
||||
*overflow= TRUE;
|
||||
break;
|
||||
}
|
||||
while (tmp_length--)
|
||||
|
|
@ -1161,7 +1163,7 @@ size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
|
|||
{
|
||||
if (to + 2 > to_end)
|
||||
{
|
||||
overflow= TRUE;
|
||||
*overflow= TRUE;
|
||||
break;
|
||||
}
|
||||
*to++= '\\';
|
||||
|
|
@ -1171,14 +1173,14 @@ size_t escape_string_for_mysql(CHARSET_INFO *charset_info,
|
|||
{
|
||||
if (to + 1 > to_end)
|
||||
{
|
||||
overflow= TRUE;
|
||||
*overflow= TRUE;
|
||||
break;
|
||||
}
|
||||
*to++= *from;
|
||||
}
|
||||
}
|
||||
*to= 0;
|
||||
return overflow ? (size_t) -1 : (size_t) (to - to_start);
|
||||
return (size_t) (to - to_start);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1220,6 +1222,7 @@ CHARSET_INFO *fs_character_set()
|
|||
to_length Length of destination buffer, or 0
|
||||
from The string to escape
|
||||
length The length of the string to escape
|
||||
overflow Set to 1 if the buffer overflows
|
||||
|
||||
DESCRIPTION
|
||||
This escapes the contents of a string by doubling up any apostrophes that
|
||||
|
|
@ -1231,20 +1234,20 @@ CHARSET_INFO *fs_character_set()
|
|||
mean "big enough"
|
||||
|
||||
RETURN VALUES
|
||||
~0 The escaped string did not fit in the to buffer
|
||||
>=0 The length of the escaped string
|
||||
The length of the escaped string
|
||||
*/
|
||||
|
||||
size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
|
||||
char *to, size_t to_length,
|
||||
const char *from, size_t length)
|
||||
const char *from, size_t length,
|
||||
my_bool *overflow)
|
||||
{
|
||||
const char *to_start= to;
|
||||
const char *end, *to_end=to_start + (to_length ? to_length-1 : 2*length);
|
||||
my_bool overflow= FALSE;
|
||||
#ifdef USE_MB
|
||||
my_bool use_mb_flag= my_ci_use_mb(charset_info);
|
||||
#endif
|
||||
*overflow= FALSE;
|
||||
for (end= from + length; from < end; from++)
|
||||
{
|
||||
#ifdef USE_MB
|
||||
|
|
@ -1253,7 +1256,7 @@ size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
|
|||
{
|
||||
if (to + tmp_length > to_end)
|
||||
{
|
||||
overflow= TRUE;
|
||||
*overflow= TRUE;
|
||||
break;
|
||||
}
|
||||
while (tmp_length--)
|
||||
|
|
@ -1271,7 +1274,7 @@ size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
|
|||
{
|
||||
if (to + 2 > to_end)
|
||||
{
|
||||
overflow= TRUE;
|
||||
*overflow= TRUE;
|
||||
break;
|
||||
}
|
||||
*to++= '\'';
|
||||
|
|
@ -1281,14 +1284,14 @@ size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info,
|
|||
{
|
||||
if (to + 1 > to_end)
|
||||
{
|
||||
overflow= TRUE;
|
||||
*overflow= TRUE;
|
||||
break;
|
||||
}
|
||||
*to++= *from;
|
||||
}
|
||||
}
|
||||
*to= 0;
|
||||
return overflow ? (ulong)~0 : (ulong) (to - to_start);
|
||||
return (size_t) (to - to_start);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -183,15 +183,15 @@ static void send_report(const char *when)
|
|||
str.length(0);
|
||||
str.append(STRING_WITH_LEN("FEEDBACK_SERVER_UID"));
|
||||
str.append('\t');
|
||||
str.append(server_uid_buf);
|
||||
str.append(server_uid_buf, sizeof(server_uid_buf)-1);
|
||||
str.append('\n');
|
||||
str.append(STRING_WITH_LEN("FEEDBACK_WHEN"));
|
||||
str.append('\t');
|
||||
str.append(when);
|
||||
str.append(when, strlen(when));
|
||||
str.append('\n');
|
||||
str.append(STRING_WITH_LEN("FEEDBACK_USER_INFO"));
|
||||
str.append('\t');
|
||||
str.append(user_info);
|
||||
str.append(user_info, strlen(user_info));
|
||||
str.append('\n');
|
||||
str.append('\n');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,11 @@ class Item_func_sysconst_test :public Item_func_sysconst
|
|||
set_maybe_null();
|
||||
return false;
|
||||
}
|
||||
const char *func_name() const { return "sysconst_test"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("sysconst_test") };
|
||||
return name;
|
||||
}
|
||||
const char *fully_qualified_func_name() const { return "sysconst_test()"; }
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_sysconst_test>(thd, this); }
|
||||
|
|
|
|||
|
|
@ -32,7 +32,11 @@ class Item_func_inet_aton : public Item_longlong_func
|
|||
public:
|
||||
Item_func_inet_aton(THD *thd, Item *a): Item_longlong_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "inet_aton"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("inet_aton") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals= 0;
|
||||
|
|
@ -56,7 +60,11 @@ class Item_func_inet_ntoa : public Item_str_func
|
|||
Item_func_inet_ntoa(THD *thd, Item *a): Item_str_func(thd, a)
|
||||
{ }
|
||||
String* val_str(String* str);
|
||||
const char *func_name() const { return "inet_ntoa"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("inet_ntoa") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals= 0;
|
||||
|
|
@ -98,9 +106,11 @@ class Item_func_inet6_aton : public Item_str_func
|
|||
{ }
|
||||
|
||||
public:
|
||||
virtual const char *func_name() const
|
||||
{ return "inet6_aton"; }
|
||||
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("inet6_aton") };
|
||||
return name;
|
||||
}
|
||||
virtual bool fix_length_and_dec()
|
||||
{
|
||||
decimals= 0;
|
||||
|
|
@ -127,8 +137,11 @@ class Item_func_inet6_ntoa : public Item_str_ascii_func
|
|||
{ }
|
||||
|
||||
public:
|
||||
virtual const char *func_name() const
|
||||
{ return "inet6_ntoa"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("inet6_ntoa") };
|
||||
return name;
|
||||
}
|
||||
|
||||
virtual bool fix_length_and_dec()
|
||||
{
|
||||
|
|
@ -160,8 +173,11 @@ class Item_func_is_ipv4 : public Item_func_inet_bool_base
|
|||
{ }
|
||||
|
||||
public:
|
||||
virtual const char *func_name() const
|
||||
{ return "is_ipv4"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_is_ipv4>(thd, this); }
|
||||
|
||||
|
|
@ -180,8 +196,11 @@ class Item_func_is_ipv6 : public Item_func_inet_bool_base
|
|||
Item_func_inet_bool_base(thd, ip_addr)
|
||||
{ }
|
||||
|
||||
virtual const char *func_name() const
|
||||
{ return "is_ipv6"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv6") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_is_ipv6>(thd, this); }
|
||||
|
||||
|
|
@ -199,8 +218,11 @@ class Item_func_is_ipv4_compat : public Item_func_inet_bool_base
|
|||
inline Item_func_is_ipv4_compat(THD *thd, Item *ip_addr):
|
||||
Item_func_inet_bool_base(thd, ip_addr)
|
||||
{ }
|
||||
virtual const char *func_name() const
|
||||
{ return "is_ipv4_compat"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_compat") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_is_ipv4_compat>(thd, this); }
|
||||
longlong val_int();
|
||||
|
|
@ -217,8 +239,11 @@ class Item_func_is_ipv4_mapped : public Item_func_inet_bool_base
|
|||
inline Item_func_is_ipv4_mapped(THD *thd, Item *ip_addr):
|
||||
Item_func_inet_bool_base(thd, ip_addr)
|
||||
{ }
|
||||
virtual const char *func_name() const
|
||||
{ return "is_ipv4_mapped"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("is_ipv4_mapped") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_is_ipv4_mapped>(thd, this); }
|
||||
longlong val_int();
|
||||
|
|
|
|||
|
|
@ -1044,7 +1044,11 @@ class Item_typecast_inet6: public Item_func
|
|||
Item_typecast_inet6 *cast= (Item_typecast_inet6*) item;
|
||||
return args[0]->eq(cast->args[0], binary_cmp);
|
||||
}
|
||||
const char *func_name() const override { return "cast_as_inet6"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_inet6") };
|
||||
return name;
|
||||
}
|
||||
void print(String *str, enum_query_type query_type) override
|
||||
{
|
||||
str->append(STRING_WITH_LEN("cast("));
|
||||
|
|
@ -1212,7 +1216,7 @@ class Item_literal_inet6: public Item_literal
|
|||
{
|
||||
StringBufferInet6 tmp;
|
||||
m_value.to_string(&tmp);
|
||||
str->append("INET6'");
|
||||
str->append(STRING_WITH_LEN("INET6'"));
|
||||
str->append(tmp);
|
||||
str->append('\'');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -714,7 +714,7 @@ class Type_handler_inet6: public Type_handler
|
|||
return !na.is_null() && !nb.is_null() && !na.cmp(nb);
|
||||
}
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *h,
|
||||
Type_all_attributes *attr,
|
||||
Item **items,
|
||||
|
|
@ -747,7 +747,7 @@ class Type_handler_inet6: public Type_handler
|
|||
Item **items,
|
||||
uint nitems) const override
|
||||
{
|
||||
return Item_hybrid_func_fix_attributes(thd, func->func_name(),
|
||||
return Item_hybrid_func_fix_attributes(thd, func->func_name_cstring(),
|
||||
func, func, items, nitems);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
||||
|
||||
#include "mysql_json.h"
|
||||
#include "my_global.h"
|
||||
#include "mysql_json.h"
|
||||
#include "compat56.h"
|
||||
#include "my_decimal.h"
|
||||
#include "sql_time.h"
|
||||
|
|
@ -169,25 +169,25 @@ static bool append_string_json(String *buffer, const uchar *data, size_t len)
|
|||
const uchar c= *data;
|
||||
switch (c) {
|
||||
case '\\':
|
||||
buffer->append("\\\\");
|
||||
buffer->append(STRING_WITH_LEN("\\\\"));
|
||||
break;
|
||||
case '\n':
|
||||
buffer->append("\\n");
|
||||
buffer->append(STRING_WITH_LEN("\\n"));
|
||||
break;
|
||||
case '\r':
|
||||
buffer->append("\\r");
|
||||
buffer->append(STRING_WITH_LEN("\\r"));
|
||||
break;
|
||||
case '"':
|
||||
buffer->append("\\\"");
|
||||
buffer->append(STRING_WITH_LEN("\\\""));
|
||||
break;
|
||||
case '\b':
|
||||
buffer->append("\\b");
|
||||
buffer->append(STRING_WITH_LEN("\\b"));
|
||||
break;
|
||||
case '\f':
|
||||
buffer->append("\\f");
|
||||
buffer->append(STRING_WITH_LEN("\\f"));
|
||||
break;
|
||||
case '\t':
|
||||
buffer->append("\\t");
|
||||
buffer->append(STRING_WITH_LEN("\\t"));
|
||||
break;
|
||||
default:
|
||||
buffer->append(c);
|
||||
|
|
@ -242,11 +242,11 @@ static bool parse_mysql_scalar(String *buffer, size_t value_json_type,
|
|||
return true;
|
||||
switch (static_cast<JSONB_LITERAL_TYPES>(*data)) {
|
||||
case JSONB_NULL_LITERAL:
|
||||
return buffer->append("null");
|
||||
return buffer->append(STRING_WITH_LEN("null"));
|
||||
case JSONB_TRUE_LITERAL:
|
||||
return buffer->append("true");
|
||||
return buffer->append(STRING_WITH_LEN("true"));
|
||||
case JSONB_FALSE_LITERAL:
|
||||
return buffer->append("false");
|
||||
return buffer->append(STRING_WITH_LEN("false"));
|
||||
default: /* Invalid literal constant, malformed JSON. */
|
||||
return true;
|
||||
}
|
||||
|
|
@ -326,7 +326,7 @@ static bool parse_mysql_scalar(String *buffer, size_t value_json_type,
|
|||
default:
|
||||
{
|
||||
/* Any other MySQL type is presented as a base64 encoded string. */
|
||||
if (buffer->append("\"base64:type") ||
|
||||
if (buffer->append(STRING_WITH_LEN("\"base64:type")) ||
|
||||
buffer->append_longlong(field_type) ||
|
||||
buffer->append(':'))
|
||||
return true;
|
||||
|
|
@ -455,7 +455,7 @@ static bool parse_array_or_object(String *buffer, const uchar *data, size_t len,
|
|||
/* First print the key. */
|
||||
if (buffer->append('"') ||
|
||||
append_string_json(buffer, data + key_start, key_len) ||
|
||||
buffer->append("\": "))
|
||||
buffer->append(STRING_WITH_LEN("\": ")))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -478,7 +478,7 @@ static bool parse_array_or_object(String *buffer, const uchar *data, size_t len,
|
|||
return true;
|
||||
}
|
||||
|
||||
if (i != element_count - 1 && buffer->append(", "))
|
||||
if (i != element_count - 1 && buffer->append(STRING_WITH_LEN(", ")))
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -402,7 +402,7 @@ static bool resolve_sysvars(handlerton *hton, ha_create_table_option *rules)
|
|||
str.length(0);
|
||||
for (const char **s= optp.typelib->type_names; *s; s++)
|
||||
{
|
||||
if (str.append(*s) || str.append(','))
|
||||
if (str.append(*s, strlen(*s)) || str.append(','))
|
||||
return 1;
|
||||
}
|
||||
DBUG_ASSERT(str.length());
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ Event_basic::load_string_fields(Field **fields, ...)
|
|||
bool
|
||||
Event_basic::load_time_zone(THD *thd, const LEX_CSTRING *tz_name)
|
||||
{
|
||||
String str(tz_name->str, &my_charset_latin1);
|
||||
String str(tz_name->str, strlen(tz_name->str), &my_charset_latin1);
|
||||
time_zone= my_tz_find(thd, &str);
|
||||
|
||||
return (time_zone == NULL);
|
||||
|
|
|
|||
|
|
@ -89,11 +89,11 @@ Event_worker_thread::print_warnings(THD *thd, Event_job_data *et)
|
|||
prefix.append(STRING_WITH_LEN("Event Scheduler: ["));
|
||||
|
||||
prefix.append(et->definer.str, et->definer.length, system_charset_info);
|
||||
prefix.append("][", 2);
|
||||
prefix.append(STRING_WITH_LEN("]["));
|
||||
prefix.append(et->dbname.str, et->dbname.length, system_charset_info);
|
||||
prefix.append('.');
|
||||
prefix.append(et->name.str, et->name.length, system_charset_info);
|
||||
prefix.append("] ", 2);
|
||||
prefix.append(STRING_WITH_LEN("] "));
|
||||
|
||||
Diagnostics_area::Sql_condition_iterator it=
|
||||
thd->get_stmt_da()->sql_conditions();
|
||||
|
|
|
|||
|
|
@ -11361,7 +11361,7 @@ Field::print_key_part_value(String *out, const uchar* key, uint32 length)
|
|||
*/
|
||||
if (*key)
|
||||
{
|
||||
out->append(STRING_WITH_LEN("NULL"));
|
||||
out->append(NULL_clex_str);
|
||||
return;
|
||||
}
|
||||
null_byte++; // Skip null byte
|
||||
|
|
|
|||
|
|
@ -385,7 +385,7 @@ void Field_enum::do_field_enum(Copy_field *copy)
|
|||
static void do_field_varbinary_pre50(Copy_field *copy)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
copy->tmp.set_quick(buff,sizeof(buff),copy->tmp.charset());
|
||||
copy->tmp.set_buffer_if_not_allocated(buff,sizeof(buff),copy->tmp.charset());
|
||||
copy->from_field->val_str(©->tmp);
|
||||
|
||||
/* Use the same function as in 4.1 to trim trailing spaces */
|
||||
|
|
|
|||
|
|
@ -668,24 +668,25 @@ const char* dbug_print_table_row(TABLE *table)
|
|||
|
||||
output.length(0);
|
||||
output.append(table->alias);
|
||||
output.append("(");
|
||||
output.append('(');
|
||||
bool first= true;
|
||||
|
||||
for (pfield= table->field; *pfield ; pfield++)
|
||||
{
|
||||
const LEX_CSTRING *name;
|
||||
if (table->read_set && !bitmap_is_set(table->read_set, (*pfield)->field_index))
|
||||
continue;
|
||||
|
||||
if (first)
|
||||
first= false;
|
||||
else
|
||||
output.append(",");
|
||||
output.append(',');
|
||||
|
||||
output.append((*pfield)->field_name.str ?
|
||||
(*pfield)->field_name.str: "NULL");
|
||||
name= (*pfield)->field_name.str ? &(*pfield)->field_name: &NULL_clex_str;
|
||||
output.append(name);
|
||||
}
|
||||
|
||||
output.append(")=(");
|
||||
output.append(STRING_WITH_LEN(")=("));
|
||||
|
||||
first= true;
|
||||
for (pfield= table->field; *pfield ; pfield++)
|
||||
|
|
@ -698,10 +699,10 @@ const char* dbug_print_table_row(TABLE *table)
|
|||
if (first)
|
||||
first= false;
|
||||
else
|
||||
output.append(",");
|
||||
output.append(',');
|
||||
|
||||
if (field->is_null())
|
||||
output.append("NULL");
|
||||
output.append(&NULL_clex_str);
|
||||
else
|
||||
{
|
||||
if (field->type() == MYSQL_TYPE_BIT)
|
||||
|
|
@ -711,7 +712,7 @@ const char* dbug_print_table_row(TABLE *table)
|
|||
output.append(tmp.ptr(), tmp.length());
|
||||
}
|
||||
}
|
||||
output.append(")");
|
||||
output.append(')');
|
||||
|
||||
return output.c_ptr_safe();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1183,9 +1183,22 @@ int ha_partition::rename_partitions(const char *path)
|
|||
#define ASSIGN_KEYCACHE_PARTS 5
|
||||
#define PRELOAD_KEYS_PARTS 6
|
||||
|
||||
static const char *opt_op_name[]= {NULL,
|
||||
"optimize", "analyze", "check", "repair",
|
||||
"assign_to_keycache", "preload_keys"};
|
||||
static const LEX_CSTRING opt_op_name[]=
|
||||
{
|
||||
{ NULL, 0},
|
||||
{ STRING_WITH_LEN("optimize") },
|
||||
{ STRING_WITH_LEN("analyze") },
|
||||
{ STRING_WITH_LEN("check") },
|
||||
{ STRING_WITH_LEN("repair") },
|
||||
{ STRING_WITH_LEN("assign_to_keycache") },
|
||||
{ STRING_WITH_LEN("preload_keys") }
|
||||
};
|
||||
|
||||
|
||||
static const LEX_CSTRING msg_note= { STRING_WITH_LEN("note") };
|
||||
static const LEX_CSTRING msg_warning= { STRING_WITH_LEN("warning") };
|
||||
#define msg_error error_clex_str
|
||||
|
||||
|
||||
/*
|
||||
Optimize table
|
||||
|
|
@ -1389,14 +1402,14 @@ int ha_partition::handle_opt_part(THD *thd, HA_CHECK_OPT *check_opt,
|
|||
TODO: move this into the handler, or rewrite mysql_admin_table.
|
||||
*/
|
||||
bool print_admin_msg(THD* thd, uint len,
|
||||
const char* msg_type,
|
||||
const char* db_name, String &table_name,
|
||||
const char* op_name, const char *fmt, ...)
|
||||
const LEX_CSTRING *msg_type,
|
||||
const char* db_name, String &table_name,
|
||||
const LEX_CSTRING *op_name, const char *fmt, ...)
|
||||
ATTRIBUTE_FORMAT(printf, 7, 8);
|
||||
bool print_admin_msg(THD* thd, uint len,
|
||||
const char* msg_type,
|
||||
const char* db_name, String &table_name,
|
||||
const char* op_name, const char *fmt, ...)
|
||||
const LEX_CSTRING *msg_type,
|
||||
const char* db_name, String &table_name,
|
||||
const LEX_CSTRING *op_name, const char *fmt, ...)
|
||||
{
|
||||
va_list args;
|
||||
Protocol *protocol= thd->protocol;
|
||||
|
|
@ -1504,9 +1517,9 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
|
|||
error != HA_ADMIN_ALREADY_DONE &&
|
||||
error != HA_ADMIN_TRY_ALTER)
|
||||
{
|
||||
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, "error",
|
||||
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, &msg_error,
|
||||
table_share->db.str, table->alias,
|
||||
opt_op_name[flag],
|
||||
&opt_op_name[flag],
|
||||
"Subpartition %s returned error",
|
||||
sub_elem->partition_name);
|
||||
}
|
||||
|
|
@ -1531,9 +1544,9 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt,
|
|||
error != HA_ADMIN_ALREADY_DONE &&
|
||||
error != HA_ADMIN_TRY_ALTER)
|
||||
{
|
||||
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, "error",
|
||||
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, &msg_error,
|
||||
table_share->db.str, table->alias,
|
||||
opt_op_name[flag], "Partition %s returned error",
|
||||
&opt_op_name[flag], "Partition %s returned error",
|
||||
part_elem->partition_name);
|
||||
}
|
||||
/* reset part_state for the remaining partitions */
|
||||
|
|
@ -9947,9 +9960,9 @@ void ha_partition::append_row_to_str(String &str)
|
|||
for (; key_part != key_part_end; key_part++)
|
||||
{
|
||||
Field *field= key_part->field;
|
||||
str.append(" ");
|
||||
str.append(' ');
|
||||
str.append(&field->field_name);
|
||||
str.append(":");
|
||||
str.append(':');
|
||||
field_unpack(&str, field, rec, 0, false);
|
||||
}
|
||||
if (!is_rec0)
|
||||
|
|
@ -9967,9 +9980,9 @@ void ha_partition::append_row_to_str(String &str)
|
|||
field_ptr++)
|
||||
{
|
||||
Field *field= *field_ptr;
|
||||
str.append(" ");
|
||||
str.append(' ');
|
||||
str.append(&field->field_name);
|
||||
str.append(":");
|
||||
str.append(':');
|
||||
field_unpack(&str, field, rec, 0, false);
|
||||
}
|
||||
if (!is_rec0)
|
||||
|
|
@ -10007,14 +10020,14 @@ void ha_partition::print_error(int error, myf errflag)
|
|||
String str(buf,sizeof(buf),system_charset_info);
|
||||
uint32 part_id;
|
||||
str.length(0);
|
||||
str.append("(");
|
||||
str.append('(');
|
||||
str.append_ulonglong(m_last_part);
|
||||
str.append(" != ");
|
||||
str.append(STRING_WITH_LEN(" != "));
|
||||
if (get_part_for_buf(m_err_rec, m_rec0, m_part_info, &part_id))
|
||||
str.append("?");
|
||||
str.append('?');
|
||||
else
|
||||
str.append_ulonglong(part_id);
|
||||
str.append(")");
|
||||
str.append(')');
|
||||
append_row_to_str(str);
|
||||
|
||||
/* Log this error, so the DBA can notice it and fix it! */
|
||||
|
|
@ -10967,9 +10980,9 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
|
|||
read_part_id != m_part_info->vers_info->now_part->id &&
|
||||
!m_part_info->vers_info->interval.is_set())
|
||||
{
|
||||
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, "note",
|
||||
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, &msg_note,
|
||||
table_share->db.str, table->alias,
|
||||
opt_op_name[CHECK_PARTS],
|
||||
&opt_op_name[CHECK_PARTS],
|
||||
"Not supported for non-INTERVAL history partitions");
|
||||
DBUG_RETURN(HA_ADMIN_NOT_IMPLEMENTED);
|
||||
}
|
||||
|
|
@ -10998,9 +11011,9 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
|
|||
|
||||
if (num_misplaced_rows > 0)
|
||||
{
|
||||
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, "warning",
|
||||
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, &msg_warning,
|
||||
table_share->db.str, table->alias,
|
||||
opt_op_name[REPAIR_PARTS],
|
||||
&opt_op_name[REPAIR_PARTS],
|
||||
"Moved %lld misplaced rows",
|
||||
num_misplaced_rows);
|
||||
}
|
||||
|
|
@ -11020,9 +11033,9 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
|
|||
if (!do_repair)
|
||||
{
|
||||
/* Check. */
|
||||
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, "error",
|
||||
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, &msg_error,
|
||||
table_share->db.str, table->alias,
|
||||
opt_op_name[CHECK_PARTS],
|
||||
&opt_op_name[CHECK_PARTS],
|
||||
"Found a misplaced row");
|
||||
/* Break on first misplaced row! */
|
||||
result= HA_ADMIN_NEEDS_UPGRADE;
|
||||
|
|
@ -11047,8 +11060,9 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
|
|||
str.length(0);
|
||||
if (result == HA_ERR_FOUND_DUPP_KEY)
|
||||
{
|
||||
str.append("Duplicate key found, "
|
||||
"please update or delete the record:\n");
|
||||
str.append(STRING_WITH_LEN("Duplicate key found, "
|
||||
"please update or delete the "
|
||||
"record:\n"));
|
||||
result= HA_ADMIN_CORRUPT;
|
||||
}
|
||||
m_err_rec= NULL;
|
||||
|
|
@ -11068,9 +11082,9 @@ int ha_partition::check_misplaced_rows(uint read_part_id, bool do_repair)
|
|||
(uint) correct_part_id,
|
||||
str.c_ptr_safe());
|
||||
}
|
||||
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, "error",
|
||||
print_admin_msg(ha_thd(), MYSQL_ERRMSG_SIZE, &msg_error,
|
||||
table_share->db.str, table->alias,
|
||||
opt_op_name[REPAIR_PARTS],
|
||||
&opt_op_name[REPAIR_PARTS],
|
||||
"Failed to move/insert a row"
|
||||
" from part %u into part %u:\n%s",
|
||||
(uint) read_part_id,
|
||||
|
|
@ -11195,19 +11209,19 @@ int ha_partition::check_for_upgrade(HA_CHECK_OPT *check_opt)
|
|||
!(part_buf= generate_partition_syntax_for_frm(thd, m_part_info,
|
||||
&part_buf_len,
|
||||
NULL, NULL)) ||
|
||||
print_admin_msg(thd, SQL_ADMIN_MSG_TEXT_SIZE + 1, "error",
|
||||
print_admin_msg(thd, SQL_ADMIN_MSG_TEXT_SIZE + 1, &msg_error,
|
||||
table_share->db.str,
|
||||
table->alias,
|
||||
opt_op_name[CHECK_PARTS],
|
||||
&opt_op_name[CHECK_PARTS],
|
||||
KEY_PARTITIONING_CHANGED_STR,
|
||||
db_name.c_ptr_safe(),
|
||||
table_name.c_ptr_safe(),
|
||||
part_buf))
|
||||
{
|
||||
/* Error creating admin message (too long string?). */
|
||||
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, "error",
|
||||
print_admin_msg(thd, MYSQL_ERRMSG_SIZE, &msg_error,
|
||||
table_share->db.str, table->alias,
|
||||
opt_op_name[CHECK_PARTS],
|
||||
&opt_op_name[CHECK_PARTS],
|
||||
KEY_PARTITIONING_CHANGED_STR,
|
||||
db_name.c_ptr_safe(), table_name.c_ptr_safe(),
|
||||
"<old partition clause>, but add ALGORITHM = 1"
|
||||
|
|
|
|||
|
|
@ -136,11 +136,18 @@ static const LEX_CSTRING sys_table_aliases[]=
|
|||
{NullS, 0}
|
||||
};
|
||||
|
||||
const char *ha_row_type[] = {
|
||||
"", "FIXED", "DYNAMIC", "COMPRESSED", "REDUNDANT", "COMPACT", "PAGE"
|
||||
const LEX_CSTRING ha_row_type[]=
|
||||
{
|
||||
{ STRING_WITH_LEN("") },
|
||||
{ STRING_WITH_LEN("FIXED") },
|
||||
{ STRING_WITH_LEN("DYNAMIC") },
|
||||
{ STRING_WITH_LEN("COMPRESSED") },
|
||||
{ STRING_WITH_LEN("REDUNDANT") },
|
||||
{ STRING_WITH_LEN("COMPACT") },
|
||||
{ STRING_WITH_LEN("PAGE") }
|
||||
};
|
||||
|
||||
const char *tx_isolation_names[] =
|
||||
const char *tx_isolation_names[]=
|
||||
{ "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ", "SERIALIZABLE",
|
||||
NullS};
|
||||
TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
|
||||
|
|
@ -4117,7 +4124,9 @@ void handler::print_error(int error, myf errflag)
|
|||
break;
|
||||
case HA_ERR_LOCK_DEADLOCK:
|
||||
{
|
||||
String str, full_err_msg(ER_DEFAULT(ER_LOCK_DEADLOCK), system_charset_info);
|
||||
String str, full_err_msg(ER_DEFAULT(ER_LOCK_DEADLOCK),
|
||||
strlen(ER_DEFAULT(ER_LOCK_DEADLOCK)),
|
||||
system_charset_info);
|
||||
|
||||
get_error_message(error, &str);
|
||||
full_err_msg.append(str);
|
||||
|
|
|
|||
|
|
@ -5114,7 +5114,7 @@ bool key_uses_partial_cols(TABLE_SHARE *table, uint keyno);
|
|||
|
||||
/* Some extern variables used with handlers */
|
||||
|
||||
extern const char *ha_row_type[];
|
||||
extern const LEX_CSTRING ha_row_type[];
|
||||
extern MYSQL_PLUGIN_IMPORT const char *tx_isolation_names[];
|
||||
extern MYSQL_PLUGIN_IMPORT const char *binlog_format_names[];
|
||||
extern TYPELIB tx_isolation_typelib;
|
||||
|
|
|
|||
106
sql/item.cc
106
sql/item.cc
|
|
@ -501,7 +501,8 @@ void Item::print_parenthesised(String *str, enum_query_type query_type,
|
|||
|
||||
void Item::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(full_name());
|
||||
const char *name= full_name();
|
||||
str->append(name, strlen(name));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -525,7 +526,7 @@ void Item::print_value(String *str)
|
|||
String *ptr, tmp(buff,sizeof(buff),str->charset());
|
||||
ptr= val_str(&tmp);
|
||||
if (!ptr)
|
||||
str->append("NULL");
|
||||
str->append(NULL_clex_str);
|
||||
else
|
||||
{
|
||||
switch (cmp_type()) {
|
||||
|
|
@ -993,7 +994,7 @@ bool Item::check_cols(uint c)
|
|||
}
|
||||
|
||||
|
||||
bool Item::check_type_or_binary(const char *opname,
|
||||
bool Item::check_type_or_binary(const LEX_CSTRING &opname,
|
||||
const Type_handler *expect) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
|
|
@ -1002,111 +1003,111 @@ bool Item::check_type_or_binary(const char *opname,
|
|||
collation.collation == &my_charset_bin))
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_general_purpose_string(const char *opname) const
|
||||
bool Item::check_type_general_purpose_string(const LEX_CSTRING &opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->is_general_purpose_string_type())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_traditional_scalar(const char *opname) const
|
||||
bool Item::check_type_traditional_scalar(const LEX_CSTRING &opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->is_traditional_scalar_type())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_can_return_int(const char *opname) const
|
||||
bool Item::check_type_can_return_int(const LEX_CSTRING &opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->can_return_int())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_can_return_decimal(const char *opname) const
|
||||
bool Item::check_type_can_return_decimal(const LEX_CSTRING &opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->can_return_decimal())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_can_return_real(const char *opname) const
|
||||
bool Item::check_type_can_return_real(const LEX_CSTRING &opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->can_return_real())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_can_return_date(const char *opname) const
|
||||
bool Item::check_type_can_return_date(const LEX_CSTRING &opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->can_return_date())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_can_return_time(const char *opname) const
|
||||
bool Item::check_type_can_return_time(const LEX_CSTRING &opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->can_return_time())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_can_return_str(const char *opname) const
|
||||
bool Item::check_type_can_return_str(const LEX_CSTRING &opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->can_return_str())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_can_return_text(const char *opname) const
|
||||
bool Item::check_type_can_return_text(const LEX_CSTRING &opname) const
|
||||
{
|
||||
const Type_handler *handler= type_handler();
|
||||
if (handler->can_return_text())
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Item::check_type_scalar(const char *opname) const
|
||||
bool Item::check_type_scalar(const LEX_CSTRING &opname) const
|
||||
{
|
||||
/*
|
||||
fixed==true usually means than the Item has an initialized
|
||||
|
|
@ -2509,7 +2510,8 @@ void my_coll_agg_error(Item** args, uint count, const char *fname,
|
|||
}
|
||||
|
||||
|
||||
bool Type_std_attributes::agg_item_collations(DTCollation &c, const char *fname,
|
||||
bool Type_std_attributes::agg_item_collations(DTCollation &c,
|
||||
const LEX_CSTRING &fname,
|
||||
Item **av, uint count,
|
||||
uint flags, int item_sep)
|
||||
{
|
||||
|
|
@ -2528,7 +2530,7 @@ bool Type_std_attributes::agg_item_collations(DTCollation &c, const char *fname,
|
|||
unknown_cs= 1;
|
||||
continue;
|
||||
}
|
||||
my_coll_agg_error(av, count, fname, item_sep);
|
||||
my_coll_agg_error(av, count, fname.str, item_sep);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
|
@ -2536,14 +2538,14 @@ bool Type_std_attributes::agg_item_collations(DTCollation &c, const char *fname,
|
|||
if (unknown_cs &&
|
||||
c.derivation != DERIVATION_EXPLICIT)
|
||||
{
|
||||
my_coll_agg_error(av, count, fname, item_sep);
|
||||
my_coll_agg_error(av, count, fname.str, item_sep);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if ((flags & MY_COLL_DISALLOW_NONE) &&
|
||||
c.derivation == DERIVATION_NONE)
|
||||
{
|
||||
my_coll_agg_error(av, count, fname, item_sep);
|
||||
my_coll_agg_error(av, count, fname.str, item_sep);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -2557,7 +2559,7 @@ bool Type_std_attributes::agg_item_collations(DTCollation &c, const char *fname,
|
|||
|
||||
|
||||
bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
|
||||
const char *fname,
|
||||
const LEX_CSTRING &fname,
|
||||
Item **args, uint nargs,
|
||||
uint flags, int item_sep)
|
||||
{
|
||||
|
|
@ -2598,7 +2600,7 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
|
|||
args[0]= safe_args[0];
|
||||
args[item_sep]= safe_args[1];
|
||||
}
|
||||
my_coll_agg_error(args, nargs, fname, item_sep);
|
||||
my_coll_agg_error(args, nargs, fname.str, item_sep);
|
||||
res= TRUE;
|
||||
break; // we cannot return here, we need to restore "arena".
|
||||
}
|
||||
|
|
@ -2685,8 +2687,7 @@ Item_sp::Item_sp(THD *thd, Item_sp *item):
|
|||
memset(&sp_mem_root, 0, sizeof(sp_mem_root));
|
||||
}
|
||||
|
||||
const char *
|
||||
Item_sp::func_name(THD *thd) const
|
||||
LEX_CSTRING Item_sp::func_name_cstring(THD *thd) const
|
||||
{
|
||||
/* Calculate length to avoid reallocation of string for sure */
|
||||
size_t len= (((m_name->m_explicit_name ? m_name->m_db.length : 0) +
|
||||
|
|
@ -2706,7 +2707,7 @@ Item_sp::func_name(THD *thd) const
|
|||
qname.append('.');
|
||||
}
|
||||
append_identifier(thd, &qname, &m_name->m_name);
|
||||
return qname.c_ptr_safe();
|
||||
return { qname.c_ptr_safe(), qname.length() };
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -3794,7 +3795,8 @@ void Item_string::print(String *str, enum_query_type query_type)
|
|||
if (print_introducer)
|
||||
{
|
||||
str->append('_');
|
||||
str->append(collation.collation->csname);
|
||||
str->append(collation.collation->csname,
|
||||
strlen(collation.collation->csname));
|
||||
}
|
||||
|
||||
str->append('\'');
|
||||
|
|
@ -4753,11 +4755,11 @@ void Item_param::print(String *str, enum_query_type query_type)
|
|||
}
|
||||
else if (state == DEFAULT_VALUE)
|
||||
{
|
||||
str->append("default");
|
||||
str->append(STRING_WITH_LEN("default"));
|
||||
}
|
||||
else if (state == IGNORE_VALUE)
|
||||
{
|
||||
str->append("ignore");
|
||||
str->append(STRING_WITH_LEN("ignore"));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -6642,11 +6644,11 @@ int Item::save_str_in_field(Field *field, bool no_conversions)
|
|||
String *result;
|
||||
CHARSET_INFO *cs= collation.collation;
|
||||
char buff[MAX_FIELD_WIDTH]; // Alloc buffer for small columns
|
||||
str_value.set_quick(buff, sizeof(buff), cs);
|
||||
str_value.set_buffer_if_not_allocated(buff, sizeof(buff), cs);
|
||||
result=val_str(&str_value);
|
||||
if (null_value)
|
||||
{
|
||||
str_value.set_quick(0, 0, cs);
|
||||
str_value.set_buffer_if_not_allocated(0, 0, cs);
|
||||
return set_field_to_null_with_conversions(field, no_conversions);
|
||||
}
|
||||
|
||||
|
|
@ -6654,7 +6656,7 @@ int Item::save_str_in_field(Field *field, bool no_conversions)
|
|||
|
||||
field->set_notnull();
|
||||
int error= field->store(result->ptr(),result->length(),cs);
|
||||
str_value.set_quick(0, 0, cs);
|
||||
str_value.set_buffer_if_not_allocated(0, 0, cs);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
|
@ -6972,7 +6974,7 @@ void Item_float::print(String *str, enum_query_type query_type)
|
|||
{
|
||||
if (presentation)
|
||||
{
|
||||
str->append(presentation);
|
||||
str->append(presentation, strlen(presentation));
|
||||
return;
|
||||
}
|
||||
char buffer[20];
|
||||
|
|
@ -7018,7 +7020,7 @@ void Item_hex_hybrid::print(String *str, enum_query_type query_type)
|
|||
{
|
||||
uint32 len= MY_MIN(str_value.length(), sizeof(longlong));
|
||||
const char *ptr= str_value.ptr() + str_value.length() - len;
|
||||
str->append("0x");
|
||||
str->append("0x",2);
|
||||
str->append_hex(ptr, len);
|
||||
}
|
||||
|
||||
|
|
@ -7041,9 +7043,9 @@ decimal_digits_t Item_hex_hybrid::decimal_precision() const
|
|||
|
||||
void Item_hex_string::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append("X'");
|
||||
str->append("X'",2);
|
||||
str->append_hex(str_value.ptr(), str_value.length());
|
||||
str->append("'");
|
||||
str->append('\'');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -7093,10 +7095,10 @@ Item_bin_string::Item_bin_string(THD *thd, const char *str, size_t str_length):
|
|||
|
||||
void Item_date_literal::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append("DATE'");
|
||||
str->append(STRING_WITH_LEN("DATE'"));
|
||||
char buf[MAX_DATE_STRING_REP_LENGTH];
|
||||
my_date_to_str(cached_time.get_mysql_time(), buf);
|
||||
str->append(buf);
|
||||
int length= my_date_to_str(cached_time.get_mysql_time(), buf);
|
||||
str->append(buf, length);
|
||||
str->append('\'');
|
||||
}
|
||||
|
||||
|
|
@ -7118,10 +7120,10 @@ bool Item_date_literal::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzyd
|
|||
|
||||
void Item_datetime_literal::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append("TIMESTAMP'");
|
||||
str->append(STRING_WITH_LEN("TIMESTAMP'"));
|
||||
char buf[MAX_DATE_STRING_REP_LENGTH];
|
||||
my_datetime_to_str(cached_time.get_mysql_time(), buf, decimals);
|
||||
str->append(buf);
|
||||
int length= my_datetime_to_str(cached_time.get_mysql_time(), buf, decimals);
|
||||
str->append(buf, length);
|
||||
str->append('\'');
|
||||
}
|
||||
|
||||
|
|
@ -7143,10 +7145,10 @@ bool Item_datetime_literal::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fu
|
|||
|
||||
void Item_time_literal::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append("TIME'");
|
||||
str->append(STRING_WITH_LEN("TIME'"));
|
||||
char buf[MAX_DATE_STRING_REP_LENGTH];
|
||||
my_time_to_str(cached_time.get_mysql_time(), buf, decimals);
|
||||
str->append(buf);
|
||||
int length= my_time_to_str(cached_time.get_mysql_time(), buf, decimals);
|
||||
str->append(buf, length);
|
||||
str->append('\'');
|
||||
}
|
||||
|
||||
|
|
@ -8590,7 +8592,7 @@ void Item_cache_wrapper::print(String *str, enum_query_type query_type)
|
|||
return;
|
||||
}
|
||||
|
||||
str->append("<expr_cache>");
|
||||
str->append(STRING_WITH_LEN("<expr_cache>"));
|
||||
if (expr_cache)
|
||||
{
|
||||
init_on_demand();
|
||||
|
|
|
|||
58
sql/item.h
58
sql/item.h
|
|
@ -1886,7 +1886,6 @@ class Item :public Value_source,
|
|||
LOWEST_PRECEDENCE);
|
||||
}
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
|
||||
class Print: public String
|
||||
{
|
||||
public:
|
||||
|
|
@ -2358,17 +2357,18 @@ class Item :public Value_source,
|
|||
virtual Item* element_index(uint i) { return this; }
|
||||
virtual Item** addr(uint i) { return 0; }
|
||||
virtual bool check_cols(uint c);
|
||||
bool check_type_traditional_scalar(const char *opname) const;
|
||||
bool check_type_scalar(const char *opname) const;
|
||||
bool check_type_or_binary(const char *opname, const Type_handler *handler) const;
|
||||
bool check_type_general_purpose_string(const char *opname) const;
|
||||
bool check_type_can_return_int(const char *opname) const;
|
||||
bool check_type_can_return_decimal(const char *opname) const;
|
||||
bool check_type_can_return_real(const char *opname) const;
|
||||
bool check_type_can_return_str(const char *opname) const;
|
||||
bool check_type_can_return_text(const char *opname) const;
|
||||
bool check_type_can_return_date(const char *opname) const;
|
||||
bool check_type_can_return_time(const char *opname) const;
|
||||
bool check_type_traditional_scalar(const LEX_CSTRING &opname) const;
|
||||
bool check_type_scalar(const LEX_CSTRING &opname) const;
|
||||
bool check_type_or_binary(const LEX_CSTRING &opname,
|
||||
const Type_handler *handler) const;
|
||||
bool check_type_general_purpose_string(const LEX_CSTRING &opname) const;
|
||||
bool check_type_can_return_int(const LEX_CSTRING &opname) const;
|
||||
bool check_type_can_return_decimal(const LEX_CSTRING &opname) const;
|
||||
bool check_type_can_return_real(const LEX_CSTRING &opname) const;
|
||||
bool check_type_can_return_str(const LEX_CSTRING &opname) const;
|
||||
bool check_type_can_return_text(const LEX_CSTRING &opname) const;
|
||||
bool check_type_can_return_date(const LEX_CSTRING &opname) const;
|
||||
bool check_type_can_return_time(const LEX_CSTRING &opname) const;
|
||||
// It is not row => null inside is impossible
|
||||
virtual bool null_inside() { return 0; }
|
||||
// used in row subselects to get value of elements
|
||||
|
|
@ -2650,7 +2650,8 @@ class DbugStringItemTypeValue: public StringBuffer<128>
|
|||
DbugStringItemTypeValue(THD *thd, const Item *item)
|
||||
{
|
||||
append('(');
|
||||
append(item->type_handler()->name().ptr());
|
||||
Name Item_name= item->type_handler()->name();
|
||||
append(Item_name.ptr(), Item_name.length());
|
||||
append(')');
|
||||
const_cast<Item*>(item)->print(this, QT_EXPLAIN);
|
||||
/* Append end \0 to allow usage of c_ptr() */
|
||||
|
|
@ -3808,7 +3809,7 @@ class Item_null :public Item_basic_constant
|
|||
|
||||
void print(String *str, enum_query_type) override
|
||||
{
|
||||
str->append(STRING_WITH_LEN("NULL"));
|
||||
str->append(NULL_clex_str);
|
||||
}
|
||||
|
||||
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override;
|
||||
|
|
@ -4515,7 +4516,7 @@ class Item_static_float_func :public Item_float
|
|||
|
||||
void print(String *str, enum_query_type) override
|
||||
{
|
||||
str->append(func_name);
|
||||
str->append(func_name, strlen(func_name));
|
||||
}
|
||||
|
||||
Item *safe_charset_converter(THD *thd, CHARSET_INFO *tocs) override
|
||||
|
|
@ -5299,7 +5300,7 @@ class Item_func_or_sum: public Item_result_field,
|
|||
bool agg_arg_charsets(DTCollation &c, Item **items, uint nitems,
|
||||
uint flags, int item_sep)
|
||||
{
|
||||
return Type_std_attributes::agg_arg_charsets(c, func_name(),
|
||||
return Type_std_attributes::agg_arg_charsets(c, func_name_cstring(),
|
||||
items, nitems,
|
||||
flags, item_sep);
|
||||
}
|
||||
|
|
@ -5308,7 +5309,7 @@ class Item_func_or_sum: public Item_result_field,
|
|||
int item_sep= 1)
|
||||
{
|
||||
return Type_std_attributes::
|
||||
agg_arg_charsets_for_string_result(c, func_name(),
|
||||
agg_arg_charsets_for_string_result(c, func_name_cstring(),
|
||||
items, nitems, item_sep);
|
||||
}
|
||||
bool agg_arg_charsets_for_string_result_with_comparison(DTCollation &c,
|
||||
|
|
@ -5317,7 +5318,7 @@ class Item_func_or_sum: public Item_result_field,
|
|||
int item_sep= 1)
|
||||
{
|
||||
return Type_std_attributes::
|
||||
agg_arg_charsets_for_string_result_with_comparison(c, func_name(),
|
||||
agg_arg_charsets_for_string_result_with_comparison(c, func_name_cstring(),
|
||||
items, nitems,
|
||||
item_sep);
|
||||
}
|
||||
|
|
@ -5332,7 +5333,7 @@ class Item_func_or_sum: public Item_result_field,
|
|||
int item_sep= 1)
|
||||
{
|
||||
return Type_std_attributes::
|
||||
agg_arg_charsets_for_comparison(c, func_name(), items, nitems, item_sep);
|
||||
agg_arg_charsets_for_comparison(c, func_name_cstring(), items, nitems, item_sep);
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
@ -5351,9 +5352,9 @@ class Item_func_or_sum: public Item_result_field,
|
|||
func_name());
|
||||
return true;
|
||||
}
|
||||
if (agg_item_set_converter(tmp, func_name(),
|
||||
if (agg_item_set_converter(tmp, func_name_cstring(),
|
||||
a, 1, MY_COLL_CMP_CONV, 1) ||
|
||||
agg_item_set_converter(tmp, func_name(),
|
||||
agg_item_set_converter(tmp, func_name_cstring(),
|
||||
b, 1, MY_COLL_CMP_CONV, 1))
|
||||
return true;
|
||||
*cs= tmp.collation;
|
||||
|
|
@ -5393,12 +5394,15 @@ class Item_func_or_sum: public Item_result_field,
|
|||
instead.
|
||||
Added here, to the parent class of both Item_func and Item_sum.
|
||||
|
||||
NOTE: for Items inherited from Item_sum, func_name() return part of
|
||||
function name till first argument (including '(') to make difference in
|
||||
names for functions with 'distinct' clause and without 'distinct' and
|
||||
also to make printing of items inherited from Item_sum uniform.
|
||||
NOTE: for Items inherited from Item_sum, func_name() and
|
||||
func_name_cstring() returns part of function name till first
|
||||
argument (including '(') to make difference in names for functions
|
||||
with 'distinct' clause and without 'distinct' and also to make
|
||||
printing of items inherited from Item_sum uniform.
|
||||
*/
|
||||
virtual const char *func_name() const= 0;
|
||||
inline const char *func_name() const
|
||||
{ return (char*) func_name_cstring().str; }
|
||||
virtual LEX_CSTRING func_name_cstring() const= 0;
|
||||
virtual bool fix_length_and_dec()= 0;
|
||||
bool const_item() const override { return const_item_cache; }
|
||||
table_map used_tables() const override { return used_tables_cache; }
|
||||
|
|
@ -5433,7 +5437,7 @@ class Item_sp
|
|||
Field *sp_result_field;
|
||||
Item_sp(THD *thd, Name_resolution_context *context_arg, sp_name *name_arg);
|
||||
Item_sp(THD *thd, Item_sp *item);
|
||||
const char *func_name(THD *thd) const;
|
||||
LEX_CSTRING func_name_cstring(THD *thd) const;
|
||||
void cleanup();
|
||||
bool sp_check_access(THD *thd);
|
||||
bool execute(THD *thd, bool *null_value, Item **args, uint arg_count);
|
||||
|
|
|
|||
|
|
@ -90,11 +90,11 @@ static int cmp_row_type(Item* item1, Item* item2)
|
|||
@retval false otherwise
|
||||
*/
|
||||
|
||||
bool
|
||||
Type_handler_hybrid_field_type::aggregate_for_comparison(const char *funcname,
|
||||
Item **items,
|
||||
uint nitems,
|
||||
bool int_uint_as_dec)
|
||||
bool Type_handler_hybrid_field_type::
|
||||
aggregate_for_comparison(const LEX_CSTRING &funcname,
|
||||
Item **items,
|
||||
uint nitems,
|
||||
bool int_uint_as_dec)
|
||||
{
|
||||
uint unsigned_count= items[0]->unsigned_flag;
|
||||
/*
|
||||
|
|
@ -120,7 +120,7 @@ Type_handler_hybrid_field_type::aggregate_for_comparison(const char *funcname,
|
|||
i == 1 ? items[0]->type_handler()->name().ptr() :
|
||||
type_handler()->name().ptr(),
|
||||
items[i]->type_handler()->name().ptr(),
|
||||
funcname);
|
||||
funcname.str);
|
||||
return true;
|
||||
}
|
||||
/*
|
||||
|
|
@ -476,7 +476,8 @@ int Arg_comparator::set_cmp_func(THD *thd, Item_func_or_sum *owner_arg,
|
|||
b= a2;
|
||||
Item *tmp_args[2]= {*a1, *a2};
|
||||
Type_handler_hybrid_field_type tmp;
|
||||
if (tmp.aggregate_for_comparison(owner_arg->func_name(), tmp_args, 2, false))
|
||||
if (tmp.aggregate_for_comparison(owner_arg->func_name_cstring(), tmp_args, 2,
|
||||
false))
|
||||
{
|
||||
DBUG_ASSERT(thd->is_error());
|
||||
return 1;
|
||||
|
|
@ -2114,7 +2115,8 @@ bool Item_func_between::fix_length_and_dec()
|
|||
*/
|
||||
if (!args[0] || !args[1] || !args[2])
|
||||
return TRUE;
|
||||
if (m_comparator.aggregate_for_comparison(Item_func_between::func_name(),
|
||||
if (m_comparator.aggregate_for_comparison(Item_func_between::
|
||||
func_name_cstring(),
|
||||
args, 3, false))
|
||||
{
|
||||
DBUG_ASSERT(current_thd->is_error());
|
||||
|
|
@ -2801,7 +2803,7 @@ void Item_func_nullif::print(String *str, enum_query_type query_type)
|
|||
*/
|
||||
DBUG_ASSERT(arg_count == 2 ||
|
||||
args[0] == args[2] || current_thd->lex->context_analysis_only);
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
if (arg_count == 2)
|
||||
args[0]->print(str, query_type);
|
||||
|
|
@ -3163,9 +3165,10 @@ bool Item_func_case_simple::prepare_predicant_and_values(THD *thd,
|
|||
add_predicant(this, 0);
|
||||
for (uint i= 0 ; i < ncases; i++)
|
||||
{
|
||||
static LEX_CSTRING case_when= { STRING_WITH_LEN("case..when") };
|
||||
if (nulls_equal ?
|
||||
add_value("case..when", this, i + 1) :
|
||||
add_value_skip_null("case..when", this, i + 1, &have_null))
|
||||
add_value(case_when, this, i + 1) :
|
||||
add_value_skip_null(case_when, this, i + 1, &have_null))
|
||||
return true;
|
||||
}
|
||||
all_values_added(&tmp, &type_cnt, &m_found_types);
|
||||
|
|
@ -3208,7 +3211,8 @@ bool Item_func_decode_oracle::fix_length_and_dec()
|
|||
*/
|
||||
bool Item_func_case::aggregate_then_and_else_arguments(THD *thd, uint start)
|
||||
{
|
||||
if (aggregate_for_result(func_name(), args + start, arg_count - start, true))
|
||||
if (aggregate_for_result(func_name_cstring(), args + start,
|
||||
arg_count - start, true))
|
||||
return true;
|
||||
|
||||
if (fix_attributes(args + start, arg_count - start))
|
||||
|
|
@ -3392,7 +3396,7 @@ void Item_func_case_simple::print(String *str, enum_query_type query_type)
|
|||
|
||||
void Item_func_decode_oracle::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
args[0]->print(str, query_type);
|
||||
for (uint i= 1, count= when_count() ; i <= count; i++)
|
||||
|
|
@ -3926,7 +3930,7 @@ bool Predicant_to_list_comparator::alloc_comparators(THD *thd, uint nargs)
|
|||
}
|
||||
|
||||
|
||||
bool Predicant_to_list_comparator::add_value(const char *funcname,
|
||||
bool Predicant_to_list_comparator::add_value(const LEX_CSTRING &funcname,
|
||||
Item_args *args,
|
||||
uint value_index)
|
||||
{
|
||||
|
|
@ -3948,10 +3952,11 @@ bool Predicant_to_list_comparator::add_value(const char *funcname,
|
|||
}
|
||||
|
||||
|
||||
bool Predicant_to_list_comparator::add_value_skip_null(const char *funcname,
|
||||
Item_args *args,
|
||||
uint value_index,
|
||||
bool *nulls_found)
|
||||
bool Predicant_to_list_comparator::
|
||||
add_value_skip_null(const LEX_CSTRING &funcname,
|
||||
Item_args *args,
|
||||
uint value_index,
|
||||
bool *nulls_found)
|
||||
{
|
||||
/*
|
||||
Skip explicit NULL constant items.
|
||||
|
|
@ -4377,7 +4382,8 @@ bool Item_func_in::prepare_predicant_and_values(THD *thd, uint *found_types)
|
|||
add_predicant(this, 0);
|
||||
for (uint i= 1 ; i < arg_count; i++)
|
||||
{
|
||||
if (add_value_skip_null(Item_func_in::func_name(), this, i, &have_null))
|
||||
if (add_value_skip_null(Item_func_in::func_name_cstring(), this, i,
|
||||
&have_null))
|
||||
return true;
|
||||
}
|
||||
all_values_added(&m_comparator, &type_cnt, found_types);
|
||||
|
|
@ -4504,7 +4510,7 @@ bool cmp_item_row::
|
|||
aggregate_row_elements_for_comparison(THD *thd,
|
||||
Type_handler_hybrid_field_type *cmp,
|
||||
Item_args *tmp,
|
||||
const char *funcname,
|
||||
const LEX_CSTRING &funcname,
|
||||
uint col,
|
||||
uint level)
|
||||
{
|
||||
|
|
@ -4514,8 +4520,8 @@ bool cmp_item_row::
|
|||
{
|
||||
Item *arg= tmp->arguments()[i];
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_UNKNOWN_ERROR, "DBUG: %s[%d,%d] handler=%s",
|
||||
String_space(level).c_ptr(), col, i,
|
||||
ER_UNKNOWN_ERROR, "DBUG: %*s[%d,%d] handler=%s",
|
||||
level, "", col, i,
|
||||
arg->type_handler()->name().ptr());
|
||||
}
|
||||
}
|
||||
|
|
@ -4526,8 +4532,8 @@ bool cmp_item_row::
|
|||
{
|
||||
if (!err)
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_UNKNOWN_ERROR, "DBUG: %s=> handler=%s",
|
||||
String_space(level).c_ptr(),
|
||||
ER_UNKNOWN_ERROR, "DBUG: %*s=> handler=%s",
|
||||
level,"",
|
||||
cmp->type_handler()->name().ptr());
|
||||
}
|
||||
);
|
||||
|
|
@ -4535,13 +4541,13 @@ bool cmp_item_row::
|
|||
}
|
||||
|
||||
|
||||
bool cmp_item_row::prepare_comparators(THD *thd, const char *funcname,
|
||||
bool cmp_item_row::prepare_comparators(THD *thd, const LEX_CSTRING &funcname,
|
||||
const Item_args *args, uint level)
|
||||
{
|
||||
DBUG_EXECUTE_IF("cmp_item",
|
||||
push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE,
|
||||
ER_UNKNOWN_ERROR, "DBUG: %sROW(%d args) level=%d",
|
||||
String_space(level).c_ptr(),
|
||||
ER_UNKNOWN_ERROR, "DBUG: %*sROW(%d args) level=%d",
|
||||
level,"",
|
||||
args->argument_count(), level););
|
||||
DBUG_ASSERT(args->argument_count() > 0);
|
||||
if (alloc_comparators(thd, args->arguments()[0]->cols()))
|
||||
|
|
@ -4590,7 +4596,7 @@ bool Item_func_in::fix_for_row_comparison_using_bisection(THD *thd)
|
|||
if (unlikely(!(array= new (thd->mem_root) in_row(thd, arg_count-1, 0))))
|
||||
return true;
|
||||
cmp_item_row *cmp= &((in_row*)array)->tmp;
|
||||
if (cmp->prepare_comparators(thd, func_name(), this, 0))
|
||||
if (cmp->prepare_comparators(thd, func_name_cstring(), this, 0))
|
||||
return true;
|
||||
fix_in_vector();
|
||||
return false;
|
||||
|
|
@ -4629,7 +4635,7 @@ bool Item_func_in::fix_for_row_comparison_using_cmp_items(THD *thd)
|
|||
DBUG_ASSERT(get_comparator_type_handler(0) == &type_handler_row);
|
||||
DBUG_ASSERT(get_comparator_cmp_item(0));
|
||||
cmp_item_row *cmp_row= (cmp_item_row*) get_comparator_cmp_item(0);
|
||||
return cmp_row->prepare_comparators(thd, func_name(), this, 0);
|
||||
return cmp_row->prepare_comparators(thd, func_name_cstring(), this, 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -5281,7 +5287,7 @@ void Item_cond::print(String *str, enum_query_type query_type)
|
|||
while ((item=li++))
|
||||
{
|
||||
str->append(' ');
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append(' ');
|
||||
item->print_parenthesised(str, query_type, precedence());
|
||||
}
|
||||
|
|
@ -5525,7 +5531,7 @@ void Item_func_isnull::print(String *str, enum_query_type query_type)
|
|||
{
|
||||
if (const_item() && !args[0]->maybe_null() &&
|
||||
!(query_type & (QT_NO_DATA_EXPANSION | QT_VIEW_INTERNAL)))
|
||||
str->append("/*always not null*/ 1");
|
||||
str->append(STRING_WITH_LEN("/*always not null*/ 1"));
|
||||
else
|
||||
args[0]->print_parenthesised(str, query_type, precedence());
|
||||
str->append(STRING_WITH_LEN(" is null"));
|
||||
|
|
@ -5586,7 +5592,7 @@ void Item_func_like::print(String *str, enum_query_type query_type)
|
|||
str->append(' ');
|
||||
if (negated)
|
||||
str->append(STRING_WITH_LEN(" not "));
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append(' ');
|
||||
if (escape_used_in_parsing)
|
||||
{
|
||||
|
|
@ -7244,7 +7250,7 @@ void Item_equal::print(String *str, enum_query_type query_type)
|
|||
str->append('0');
|
||||
return;
|
||||
}
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
List_iterator_fast<Item> it(equal_items);
|
||||
Item *item;
|
||||
|
|
|
|||
|
|
@ -274,7 +274,11 @@ class Item_func_istrue : public Item_func_truth
|
|||
public:
|
||||
Item_func_istrue(THD *thd, Item *a): Item_func_truth(thd, a, true, true) {}
|
||||
~Item_func_istrue() {}
|
||||
virtual const char* func_name() const { return "istrue"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("istrue") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_istrue>(thd, this); }
|
||||
};
|
||||
|
|
@ -290,7 +294,11 @@ class Item_func_isnottrue : public Item_func_truth
|
|||
Item_func_isnottrue(THD *thd, Item *a):
|
||||
Item_func_truth(thd, a, true, false) {}
|
||||
~Item_func_isnottrue() {}
|
||||
virtual const char* func_name() const { return "isnottrue"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("isnottrue") };
|
||||
return name;
|
||||
}
|
||||
bool find_not_null_fields(table_map allowed) { return false; }
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_isnottrue>(thd, this); }
|
||||
|
|
@ -307,7 +315,11 @@ class Item_func_isfalse : public Item_func_truth
|
|||
public:
|
||||
Item_func_isfalse(THD *thd, Item *a): Item_func_truth(thd, a, false, true) {}
|
||||
~Item_func_isfalse() {}
|
||||
virtual const char* func_name() const { return "isfalse"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("isfalse") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_isfalse>(thd, this); }
|
||||
};
|
||||
|
|
@ -323,7 +335,11 @@ class Item_func_isnotfalse : public Item_func_truth
|
|||
Item_func_isnotfalse(THD *thd, Item *a):
|
||||
Item_func_truth(thd, a, false, false) {}
|
||||
~Item_func_isnotfalse() {}
|
||||
virtual const char* func_name() const { return "isnotfalse"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("isnotfalse") };
|
||||
return name;
|
||||
}
|
||||
bool find_not_null_fields(table_map allowed) { return false; }
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_isnotfalse>(thd, this); }
|
||||
|
|
@ -377,7 +393,11 @@ class Item_in_optimizer: public Item_bool_func
|
|||
longlong val_int() override;
|
||||
void cleanup() override;
|
||||
enum Functype functype() const override { return IN_OPTIMIZER_FUNC; }
|
||||
const char *func_name() const override { return "<in_optimizer>"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("<in_optimizer>") };
|
||||
return name;
|
||||
}
|
||||
Item_cache **get_cache() { return &cache; }
|
||||
void keep_top_level_cache();
|
||||
Item *transform(THD *thd, Item_transformer transformer, uchar *arg) override;
|
||||
|
|
@ -583,7 +603,11 @@ class Item_func_xor :public Item_bool_func
|
|||
public:
|
||||
Item_func_xor(THD *thd, Item *i1, Item *i2): Item_bool_func(thd, i1, i2) {}
|
||||
enum Functype functype() const { return XOR_FUNC; }
|
||||
const char *func_name() const { return "xor"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("xor") };
|
||||
return name;
|
||||
}
|
||||
enum precedence precedence() const { return XOR_PRECEDENCE; }
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{ Item_func::print_op(str, query_type); }
|
||||
|
|
@ -609,7 +633,11 @@ class Item_func_not :public Item_bool_func
|
|||
bool is_top_level_item() const override { return abort_on_null; }
|
||||
longlong val_int() override;
|
||||
enum Functype functype() const override { return NOT_FUNC; }
|
||||
const char *func_name() const override { return "not"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("not") };
|
||||
return name;
|
||||
}
|
||||
bool find_not_null_fields(table_map allowed) override { return false; }
|
||||
enum precedence precedence() const override { return NEG_PRECEDENCE; }
|
||||
Item *neg_transformer(THD *thd) override;
|
||||
|
|
@ -658,7 +686,11 @@ class Item_func_trig_cond: public Item_bool_func
|
|||
{ trig_var= f; }
|
||||
longlong val_int() { return *trig_var ? args[0]->val_int() : 1; }
|
||||
enum Functype functype() const { return TRIG_COND_FUNC; };
|
||||
const char *func_name() const { return "trigcond"; };
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("trigcond") };
|
||||
return name;
|
||||
}
|
||||
bool const_item() const { return FALSE; }
|
||||
bool *get_trig_var() { return trig_var; }
|
||||
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
|
||||
|
|
@ -683,7 +715,11 @@ class Item_func_not_all :public Item_func_not
|
|||
table_map not_null_tables() const { return 0; }
|
||||
longlong val_int();
|
||||
enum Functype functype() const { return NOT_ALL_FUNC; }
|
||||
const char *func_name() const { return "<not>"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("<not>") };
|
||||
return name;
|
||||
}
|
||||
bool fix_fields(THD *thd, Item **ref)
|
||||
{return Item_func::fix_fields(thd, ref);}
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
|
|
@ -700,7 +736,11 @@ class Item_func_nop_all :public Item_func_not_all
|
|||
|
||||
Item_func_nop_all(THD *thd, Item *a): Item_func_not_all(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "<nop>"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("<nop>") };
|
||||
return name;
|
||||
}
|
||||
Item *neg_transformer(THD *thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_nop_all>(thd, this); }
|
||||
|
|
@ -719,7 +759,11 @@ class Item_func_eq :public Item_bool_rowready_func2
|
|||
enum Functype functype() const { return EQ_FUNC; }
|
||||
enum Functype rev_functype() const { return EQ_FUNC; }
|
||||
cond_result eq_cmp_result() const { return COND_TRUE; }
|
||||
const char *func_name() const { return "="; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("=") };
|
||||
return name;
|
||||
}
|
||||
void top_level_item() { abort_on_null= true; }
|
||||
Item *negated_item(THD *thd);
|
||||
COND *build_equal_items(THD *thd, COND_EQUAL *inherited,
|
||||
|
|
@ -759,7 +803,11 @@ class Item_func_equal final :public Item_bool_rowready_func2
|
|||
enum Functype functype() const { return EQUAL_FUNC; }
|
||||
enum Functype rev_functype() const { return EQUAL_FUNC; }
|
||||
cond_result eq_cmp_result() const { return COND_TRUE; }
|
||||
const char *func_name() const { return "<=>"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("<=>") };
|
||||
return name;
|
||||
}
|
||||
Item *neg_transformer(THD *thd) { return 0; }
|
||||
void add_key_fields(JOIN *join, KEY_FIELD **key_fields,
|
||||
uint *and_level, table_map usable_tables,
|
||||
|
|
@ -782,7 +830,11 @@ class Item_func_ge :public Item_bool_rowready_func2
|
|||
enum Functype functype() const { return GE_FUNC; }
|
||||
enum Functype rev_functype() const { return LE_FUNC; }
|
||||
cond_result eq_cmp_result() const { return COND_TRUE; }
|
||||
const char *func_name() const { return ">="; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN(">=") };
|
||||
return name;
|
||||
}
|
||||
Item *negated_item(THD *thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_ge>(thd, this); }
|
||||
|
|
@ -798,7 +850,11 @@ class Item_func_gt :public Item_bool_rowready_func2
|
|||
enum Functype functype() const { return GT_FUNC; }
|
||||
enum Functype rev_functype() const { return LT_FUNC; }
|
||||
cond_result eq_cmp_result() const { return COND_FALSE; }
|
||||
const char *func_name() const { return ">"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN(">") };
|
||||
return name;
|
||||
}
|
||||
Item *negated_item(THD *thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_gt>(thd, this); }
|
||||
|
|
@ -814,7 +870,11 @@ class Item_func_le :public Item_bool_rowready_func2
|
|||
enum Functype functype() const { return LE_FUNC; }
|
||||
enum Functype rev_functype() const { return GE_FUNC; }
|
||||
cond_result eq_cmp_result() const { return COND_TRUE; }
|
||||
const char *func_name() const { return "<="; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("<=") };
|
||||
return name;
|
||||
}
|
||||
Item *negated_item(THD *thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_le>(thd, this); }
|
||||
|
|
@ -830,7 +890,11 @@ class Item_func_lt :public Item_bool_rowready_func2
|
|||
enum Functype functype() const { return LT_FUNC; }
|
||||
enum Functype rev_functype() const { return GT_FUNC; }
|
||||
cond_result eq_cmp_result() const { return COND_FALSE; }
|
||||
const char *func_name() const { return "<"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("<") };
|
||||
return name;
|
||||
}
|
||||
Item *negated_item(THD *thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_lt>(thd, this); }
|
||||
|
|
@ -849,7 +913,11 @@ class Item_func_ne :public Item_bool_rowready_func2
|
|||
enum Functype functype() const { return NE_FUNC; }
|
||||
enum Functype rev_functype() const { return NE_FUNC; }
|
||||
cond_result eq_cmp_result() const { return COND_FALSE; }
|
||||
const char *func_name() const { return "<>"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("<>") };
|
||||
return name;
|
||||
}
|
||||
Item *negated_item(THD *thd);
|
||||
void add_key_fields(JOIN *join, KEY_FIELD **key_fields, uint *and_level,
|
||||
table_map usable_tables, SARGABLE_PARAM **sargables);
|
||||
|
|
@ -921,7 +989,11 @@ class Item_func_between :public Item_func_opt_neg
|
|||
return m_comparator.type_handler()->Item_func_between_val_int(this);
|
||||
}
|
||||
enum Functype functype() const { return BETWEEN; }
|
||||
const char *func_name() const { return "between"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("between") };
|
||||
return name;
|
||||
}
|
||||
enum precedence precedence() const { return BETWEEN_PRECEDENCE; }
|
||||
bool fix_length_and_dec();
|
||||
bool fix_length_and_dec_string(THD *)
|
||||
|
|
@ -972,7 +1044,11 @@ class Item_func_strcmp :public Item_long_func
|
|||
Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
decimal_digits_t decimal_precision() const override { return 1; }
|
||||
const char *func_name() const { return "strcmp"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("strcmp") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
if (agg_arg_charsets_for_comparison(cmp_collation, args, 2))
|
||||
|
|
@ -1008,11 +1084,15 @@ class Item_func_interval :public Item_long_func
|
|||
bool fix_fields(THD *, Item **);
|
||||
longlong val_int();
|
||||
bool fix_length_and_dec();
|
||||
const char *func_name() const { return "interval"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("interval") };
|
||||
return name;
|
||||
}
|
||||
decimal_digits_t decimal_precision() const override { return 2; }
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
print_args(str, 0, query_type);
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -1036,12 +1116,16 @@ class Item_func_coalesce :public Item_func_case_expression
|
|||
bool native_op(THD *thd, Native *to);
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
if (aggregate_for_result(func_name(), args, arg_count, true))
|
||||
if (aggregate_for_result(func_name_cstring(), args, arg_count, true))
|
||||
return TRUE;
|
||||
fix_attributes(args, arg_count);
|
||||
return FALSE;
|
||||
}
|
||||
const char *func_name() const { return "coalesce"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("coalesce") };
|
||||
return name;
|
||||
}
|
||||
table_map not_null_tables() const { return 0; }
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_coalesce>(thd, this); }
|
||||
|
|
@ -1059,7 +1143,7 @@ class Item_func_case_abbreviation2 :public Item_func_case_expression
|
|||
protected:
|
||||
bool fix_length_and_dec2(Item **items)
|
||||
{
|
||||
if (aggregate_for_result(func_name(), items, 2, true))
|
||||
if (aggregate_for_result(func_name_cstring(), items, 2, true))
|
||||
return TRUE;
|
||||
fix_attributes(items, 2);
|
||||
return FALSE;
|
||||
|
|
@ -1131,7 +1215,11 @@ class Item_func_ifnull :public Item_func_case_abbreviation2
|
|||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
const char *func_name() const { return "ifnull"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("ifnull") };
|
||||
return name;
|
||||
}
|
||||
|
||||
table_map not_null_tables() const { return 0; }
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -1204,7 +1292,11 @@ class Item_func_if :public Item_func_case_abbreviation2_switch
|
|||
{
|
||||
return fix_length_and_dec2_eliminate_null(args + 1);
|
||||
}
|
||||
const char *func_name() const { return "if"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("if") };
|
||||
return name;
|
||||
}
|
||||
bool eval_not_null_tables(void *opt_arg);
|
||||
void fix_after_pullout(st_select_lex *new_parent, Item **ref, bool merge);
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -1223,7 +1315,11 @@ class Item_func_nvl2 :public Item_func_case_abbreviation2_switch
|
|||
Item_func_nvl2(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_func_case_abbreviation2_switch(thd, a, b, c)
|
||||
{}
|
||||
const char *func_name() const { return "nvl2"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("nvl2") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
return fix_length_and_dec2_eliminate_null(args + 1);
|
||||
|
|
@ -1289,7 +1385,11 @@ class Item_func_nullif :public Item_func_case_expression
|
|||
bool native_op(THD *thd, Native *to);
|
||||
bool fix_length_and_dec();
|
||||
bool walk(Item_processor processor, bool walk_subquery, void *arg);
|
||||
const char *func_name() const { return "nullif"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("nullif") };
|
||||
return name;
|
||||
}
|
||||
void print(String *str, enum_query_type query_type);
|
||||
void split_sum_func(THD *thd, Ref_ptr_array ref_pointer_array,
|
||||
List<Item> &fields, uint flags);
|
||||
|
|
@ -1638,7 +1738,7 @@ class cmp_item_sort_string :public cmp_item_string
|
|||
void set_charset(CHARSET_INFO *cs)
|
||||
{
|
||||
cmp_charset= cs;
|
||||
value.set_quick(value_buff, sizeof(value_buff), cs);
|
||||
value.set_buffer_if_not_allocated(value_buff, sizeof(value_buff), cs);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -2064,13 +2164,14 @@ class Predicant_to_list_comparator
|
|||
arguments (e.g. ROWs with size)
|
||||
@retval false - a new element was successfully added.
|
||||
*/
|
||||
bool add_value(const char *funcname, Item_args *args, uint value_index);
|
||||
bool add_value(const LEX_CSTRING &funcname, Item_args *args,
|
||||
uint value_index);
|
||||
|
||||
/**
|
||||
Add a new element into m_comparators[], ignoring explicit NULL values.
|
||||
If the value appeared to be an explicit NULL, nulls_found[0] is set to true.
|
||||
*/
|
||||
bool add_value_skip_null(const char *funcname,
|
||||
bool add_value_skip_null(const LEX_CSTRING &funcname,
|
||||
Item_args *args, uint value_index,
|
||||
bool *nulls_found);
|
||||
|
||||
|
|
@ -2202,7 +2303,11 @@ class Item_func_case :public Item_func_case_expression
|
|||
bool native_op(THD *thd, Native *to);
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
table_map not_null_tables() const { return 0; }
|
||||
const char *func_name() const { return "case"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("case") };
|
||||
return name;
|
||||
}
|
||||
CHARSET_INFO *compare_collation() const { return cmp_collation.collation; }
|
||||
bool need_parentheses_in_default() { return true; }
|
||||
};
|
||||
|
|
@ -2305,7 +2410,11 @@ class Item_func_decode_oracle: public Item_func_case_simple
|
|||
Item_func_decode_oracle(THD *thd, List<Item> &list)
|
||||
:Item_func_case_simple(thd, list)
|
||||
{ }
|
||||
const char *func_name() const { return "decode_oracle"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("decode_oracle") };
|
||||
return name;
|
||||
}
|
||||
void print(String *str, enum_query_type query_type);
|
||||
bool fix_length_and_dec();
|
||||
Item *find_item();
|
||||
|
|
@ -2466,7 +2575,11 @@ class Item_func_in :public Item_func_opt_neg,
|
|||
}
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
enum Functype functype() const { return IN_FUNC; }
|
||||
const char *func_name() const { return "in"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("in") };
|
||||
return name;
|
||||
}
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
bool eval_not_null_tables(void *opt_arg);
|
||||
bool find_not_null_fields(table_map allowed);
|
||||
|
|
@ -2500,14 +2613,14 @@ class cmp_item_row :public cmp_item
|
|||
bool aggregate_row_elements_for_comparison(THD *thd,
|
||||
Type_handler_hybrid_field_type *cmp,
|
||||
Item_args *tmp,
|
||||
const char *funcname,
|
||||
const LEX_CSTRING &funcname,
|
||||
uint col,
|
||||
uint level);
|
||||
public:
|
||||
cmp_item_row(): comparators(0), n(0) {}
|
||||
~cmp_item_row();
|
||||
void store_value(Item *item);
|
||||
bool prepare_comparators(THD *, const char *funcname,
|
||||
bool prepare_comparators(THD *, const LEX_CSTRING &funcname,
|
||||
const Item_args *args, uint level);
|
||||
int cmp(Item *arg);
|
||||
int cmp_not_null(const Value *val)
|
||||
|
|
@ -2580,7 +2693,11 @@ class Item_func_isnull :public Item_func_null_predicate
|
|||
Item_func_isnull(THD *thd, Item *a): Item_func_null_predicate(thd, a) {}
|
||||
longlong val_int();
|
||||
enum Functype functype() const { return ISNULL_FUNC; }
|
||||
const char *func_name() const { return "isnull"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("isnull") };
|
||||
return name;
|
||||
}
|
||||
void print(String *str, enum_query_type query_type);
|
||||
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||
|
||||
|
|
@ -2639,7 +2756,11 @@ class Item_is_not_null_test :public Item_func_isnull
|
|||
{}
|
||||
enum Functype functype() const { return ISNOTNULLTEST_FUNC; }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "<is_not_null_test>"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("<is_not_null_test>") };
|
||||
return name;
|
||||
}
|
||||
void update_used_tables();
|
||||
/*
|
||||
we add RAND_TABLE_BIT to prevent moving this item from HAVING to WHERE
|
||||
|
|
@ -2659,7 +2780,11 @@ class Item_func_isnotnull :public Item_func_null_predicate
|
|||
{ }
|
||||
longlong val_int();
|
||||
enum Functype functype() const { return ISNOTNULL_FUNC; }
|
||||
const char *func_name() const { return "isnotnull"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("isnotnull") };
|
||||
return name;
|
||||
}
|
||||
enum precedence precedence() const { return CMP_PRECEDENCE; }
|
||||
table_map not_null_tables() const
|
||||
{ return abort_on_null ? not_null_tables_cache : 0; }
|
||||
|
|
@ -2794,7 +2919,11 @@ class Item_func_like :public Item_bool_func2
|
|||
cond);
|
||||
return this;
|
||||
}
|
||||
const char *func_name() const { return "like"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("like") };
|
||||
return name;
|
||||
}
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
bool fix_length_and_dec()
|
||||
|
|
@ -2910,7 +3039,11 @@ class Item_func_regex :public Item_bool_func
|
|||
}
|
||||
longlong val_int();
|
||||
bool fix_length_and_dec();
|
||||
const char *func_name() const { return "regexp"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("regexp") };
|
||||
return name;
|
||||
}
|
||||
enum precedence precedence() const { return IN_PRECEDENCE; }
|
||||
Item *get_copy(THD *) { return 0; }
|
||||
void print(String *str, enum_query_type query_type)
|
||||
|
|
@ -2932,8 +3065,8 @@ class Item_func_regexp_instr :public Item_long_func
|
|||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_str(func_name()) ||
|
||||
args[1]->check_type_can_return_text(func_name());
|
||||
return (args[0]->check_type_can_return_str(func_name_cstring()) ||
|
||||
args[1]->check_type_can_return_text(func_name_cstring()));
|
||||
}
|
||||
Regexp_processor_pcre re;
|
||||
DTCollation cmp_collation;
|
||||
|
|
@ -2950,7 +3083,11 @@ class Item_func_regexp_instr :public Item_long_func
|
|||
}
|
||||
longlong val_int();
|
||||
bool fix_length_and_dec();
|
||||
const char *func_name() const { return "regexp_instr"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("regexp_instr") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd) { return 0; }
|
||||
};
|
||||
|
||||
|
|
@ -3184,7 +3321,11 @@ class Item_equal: public Item_bool_func
|
|||
void update_const(THD *thd);
|
||||
enum Functype functype() const { return MULT_EQUAL_FUNC; }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "multiple equal"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("multiple equal") };
|
||||
return name;
|
||||
}
|
||||
void sort(Item_field_cmpfunc compare, void *arg);
|
||||
bool fix_length_and_dec();
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
|
|
@ -3362,7 +3503,11 @@ class Item_cond_and final :public Item_cond
|
|||
Item_cond_and(THD *thd, List<Item> &list_arg): Item_cond(thd, list_arg) {}
|
||||
enum Functype functype() const { return COND_AND_FUNC; }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "and"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("and") };
|
||||
return name;
|
||||
}
|
||||
enum precedence precedence() const { return AND_PRECEDENCE; }
|
||||
table_map not_null_tables() const
|
||||
{ return abort_on_null ? not_null_tables_cache: and_tables_cache; }
|
||||
|
|
@ -3396,7 +3541,11 @@ class Item_cond_or final :public Item_cond
|
|||
Item_cond_or(THD *thd, List<Item> &list_arg): Item_cond(thd, list_arg) {}
|
||||
enum Functype functype() const { return COND_OR_FUNC; }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "or"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("or") };
|
||||
return name;
|
||||
}
|
||||
enum precedence precedence() const { return OR_PRECEDENCE; }
|
||||
table_map not_null_tables() const { return and_tables_cache; }
|
||||
Item *copy_andor_structure(THD *thd);
|
||||
|
|
@ -3410,7 +3559,11 @@ class Item_func_dyncol_check :public Item_bool_func
|
|||
public:
|
||||
Item_func_dyncol_check(THD *thd, Item *str): Item_bool_func(thd, str) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "column_check"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("column_check") };
|
||||
return name;
|
||||
}
|
||||
bool need_parentheses_in_default() { return false; }
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_dyncol_check>(thd, this); }
|
||||
|
|
@ -3422,7 +3575,11 @@ class Item_func_dyncol_exists :public Item_bool_func
|
|||
Item_func_dyncol_exists(THD *thd, Item *str, Item *num):
|
||||
Item_bool_func(thd, str, num) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "column_exists"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("column_exists") };
|
||||
return name;
|
||||
}
|
||||
bool need_parentheses_in_default() { return false; }
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_dyncol_exists>(thd, this); }
|
||||
|
|
@ -3441,7 +3598,7 @@ class Item_func_cursor_bool_attr: public Item_bool_func, public Cursor_ref
|
|||
}
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
Cursor_ref::print_func(str, func_name());
|
||||
Cursor_ref::print_func(str, func_name_cstring());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -3451,7 +3608,11 @@ class Item_func_cursor_isopen: public Item_func_cursor_bool_attr
|
|||
public:
|
||||
Item_func_cursor_isopen(THD *thd, const LEX_CSTRING *name, uint offset)
|
||||
:Item_func_cursor_bool_attr(thd, name, offset) { }
|
||||
const char *func_name() const { return "%ISOPEN"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("%ISOPEN") };
|
||||
return name;
|
||||
}
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_cursor_isopen>(thd, this); }
|
||||
|
|
@ -3466,7 +3627,11 @@ class Item_func_cursor_found: public Item_func_cursor_bool_attr
|
|||
{
|
||||
set_maybe_null();
|
||||
}
|
||||
const char *func_name() const { return "%FOUND"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("%FOUND") };
|
||||
return name;
|
||||
}
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_cursor_found>(thd, this); }
|
||||
|
|
@ -3481,7 +3646,11 @@ class Item_func_cursor_notfound: public Item_func_cursor_bool_attr
|
|||
{
|
||||
set_maybe_null();
|
||||
}
|
||||
const char *func_name() const { return "%NOTFOUND"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("%NOTFOUND") };
|
||||
return name;
|
||||
}
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_cursor_notfound>(thd, this); }
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ bool Item_func::check_argument_types_or_binary(const Type_handler *handler,
|
|||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_or_binary(func_name(), handler))
|
||||
if (args[i]->check_type_or_binary(func_name_cstring(), handler))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -178,7 +178,7 @@ bool Item_func::check_argument_types_traditional_scalar(uint start,
|
|||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_traditional_scalar(func_name()))
|
||||
if (args[i]->check_type_traditional_scalar(func_name_cstring()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -191,7 +191,7 @@ bool Item_func::check_argument_types_can_return_int(uint start,
|
|||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_can_return_int(func_name()))
|
||||
if (args[i]->check_type_can_return_int(func_name_cstring()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -204,7 +204,7 @@ bool Item_func::check_argument_types_can_return_real(uint start,
|
|||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_can_return_real(func_name()))
|
||||
if (args[i]->check_type_can_return_real(func_name_cstring()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -217,7 +217,7 @@ bool Item_func::check_argument_types_can_return_text(uint start,
|
|||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_can_return_text(func_name()))
|
||||
if (args[i]->check_type_can_return_text(func_name_cstring()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -230,7 +230,7 @@ bool Item_func::check_argument_types_can_return_str(uint start,
|
|||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_can_return_str(func_name()))
|
||||
if (args[i]->check_type_can_return_str(func_name_cstring()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -243,7 +243,7 @@ bool Item_func::check_argument_types_can_return_date(uint start,
|
|||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_can_return_date(func_name()))
|
||||
if (args[i]->check_type_can_return_date(func_name_cstring()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -256,7 +256,7 @@ bool Item_func::check_argument_types_can_return_time(uint start,
|
|||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_can_return_time(func_name()))
|
||||
if (args[i]->check_type_can_return_time(func_name_cstring()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -268,7 +268,7 @@ bool Item_func::check_argument_types_scalar(uint start, uint end) const
|
|||
for (uint i= start; i < end; i++)
|
||||
{
|
||||
DBUG_ASSERT(i < arg_count);
|
||||
if (args[i]->check_type_scalar(func_name()))
|
||||
if (args[i]->check_type_scalar(func_name_cstring()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -605,7 +605,7 @@ table_map Item_func::not_null_tables() const
|
|||
|
||||
void Item_func::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
print_args(str, 0, query_type);
|
||||
str->append(')');
|
||||
|
|
@ -629,7 +629,7 @@ void Item_func::print_op(String *str, enum_query_type query_type)
|
|||
{
|
||||
args[i]->print_parenthesised(str, query_type, precedence());
|
||||
str->append(' ');
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append(' ');
|
||||
}
|
||||
args[arg_count-1]->print_parenthesised(str, query_type, higher_precedence());
|
||||
|
|
@ -672,7 +672,7 @@ bool Item_hybrid_func::fix_attributes(Item **items, uint nitems)
|
|||
{
|
||||
bool rc= Item_hybrid_func::type_handler()->
|
||||
Item_hybrid_func_fix_attributes(current_thd,
|
||||
func_name(), this, this,
|
||||
func_name_cstring(), this, this,
|
||||
items, nitems);
|
||||
DBUG_ASSERT(!rc || current_thd->is_error());
|
||||
return rc;
|
||||
|
|
@ -1070,11 +1070,12 @@ void Item_real_typecast::print(String *str, enum_query_type query_type)
|
|||
{
|
||||
char len_buf[20*3 + 1];
|
||||
char *end;
|
||||
Name name= type_handler()->name();
|
||||
|
||||
str->append(STRING_WITH_LEN("cast("));
|
||||
args[0]->print(str, query_type);
|
||||
str->append(STRING_WITH_LEN(" as "));
|
||||
str->append(type_handler()->name().ptr());
|
||||
str->append(name.ptr(), name.length());
|
||||
if (decimals != NOT_FIXED_DEC)
|
||||
{
|
||||
str->append('(');
|
||||
|
|
@ -3754,7 +3755,7 @@ void Item_udf_func::cleanup()
|
|||
|
||||
void Item_udf_func::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
{
|
||||
|
|
@ -5412,12 +5413,12 @@ int Item_func_set_user_var::save_in_field(Field *field, bool no_conversions,
|
|||
String *result;
|
||||
CHARSET_INFO *cs= collation.collation;
|
||||
char buff[MAX_FIELD_WIDTH]; // Alloc buffer for small columns
|
||||
str_value.set_quick(buff, sizeof(buff), cs);
|
||||
str_value.set_buffer_if_not_allocated(buff, sizeof(buff), cs);
|
||||
result= m_var_entry->val_str(&null_value, &str_value, decimals);
|
||||
|
||||
if (null_value)
|
||||
{
|
||||
str_value.set_quick(0, 0, cs);
|
||||
str_value.set_buffer_if_not_allocated(0, 0, cs);
|
||||
return set_field_to_null_with_conversions(field, no_conversions);
|
||||
}
|
||||
|
||||
|
|
@ -5425,7 +5426,7 @@ int Item_func_set_user_var::save_in_field(Field *field, bool no_conversions,
|
|||
|
||||
field->set_notnull();
|
||||
error=field->store(result->ptr(),result->length(),cs);
|
||||
str_value.set_quick(0, 0, cs);
|
||||
str_value.set_buffer_if_not_allocated(0, 0, cs);
|
||||
}
|
||||
else if (result_type() == REAL_RESULT)
|
||||
{
|
||||
|
|
@ -6569,11 +6570,11 @@ Item_func_sp::cleanup()
|
|||
Item_func::cleanup();
|
||||
}
|
||||
|
||||
const char *
|
||||
Item_func_sp::func_name() const
|
||||
LEX_CSTRING
|
||||
Item_func_sp::func_name_cstring() const
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
return Item_sp::func_name(thd);
|
||||
return Item_sp::func_name_cstring(thd);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -6947,7 +6948,7 @@ bool Item_func_last_value::fix_length_and_dec()
|
|||
}
|
||||
|
||||
|
||||
void Cursor_ref::print_func(String *str, const char *func_name)
|
||||
void Cursor_ref::print_func(String *str, const LEX_CSTRING &func_name)
|
||||
{
|
||||
append_identifier(current_thd, str, &m_cursor_name);
|
||||
str->append(func_name);
|
||||
|
|
@ -7076,7 +7077,7 @@ void Item_func_nextval::print(String *str, enum_query_type query_type)
|
|||
bool use_db_name= d_name.str && d_name.str[0];
|
||||
THD *thd= current_thd; // Don't trust 'table'
|
||||
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
|
||||
/*
|
||||
|
|
@ -7200,7 +7201,7 @@ void Item_func_setval::print(String *str, enum_query_type query_type)
|
|||
bool use_db_name= d_name.str && d_name.str[0];
|
||||
THD *thd= current_thd; // Don't trust 'table'
|
||||
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
|
||||
/*
|
||||
|
|
|
|||
548
sql/item_func.h
548
sql/item_func.h
File diff suppressed because it is too large
Load Diff
|
|
@ -293,7 +293,7 @@ String *Item_func_as_geojson::val_str_ascii(String *str)
|
|||
goto error;
|
||||
}
|
||||
|
||||
if ((geom->as_json(str, max_dec, &dummy) || str->append("}", 1)))
|
||||
if ((geom->as_json(str, max_dec, &dummy) || str->append('}')))
|
||||
goto error;
|
||||
|
||||
return str;
|
||||
|
|
@ -1127,28 +1127,28 @@ Item_func_spatial_rel::get_mm_leaf(RANGE_OPT_PARAM *param,
|
|||
}
|
||||
|
||||
|
||||
const char *Item_func_spatial_mbr_rel::func_name() const
|
||||
LEX_CSTRING Item_func_spatial_mbr_rel::func_name_cstring() const
|
||||
{
|
||||
switch (spatial_rel) {
|
||||
case SP_CONTAINS_FUNC:
|
||||
return "mbrcontains";
|
||||
return { STRING_WITH_LEN("mbrcontains") };
|
||||
case SP_WITHIN_FUNC:
|
||||
return "mbrwithin";
|
||||
return { STRING_WITH_LEN("mbrwithin") } ;
|
||||
case SP_EQUALS_FUNC:
|
||||
return "mbrequals";
|
||||
return { STRING_WITH_LEN("mbrequals") };
|
||||
case SP_DISJOINT_FUNC:
|
||||
return "mbrdisjoint";
|
||||
return { STRING_WITH_LEN("mbrdisjoint") };
|
||||
case SP_INTERSECTS_FUNC:
|
||||
return "mbrintersects";
|
||||
return { STRING_WITH_LEN("mbrintersects") };
|
||||
case SP_TOUCHES_FUNC:
|
||||
return "mbrtouches";
|
||||
return { STRING_WITH_LEN("mbrtouches") };
|
||||
case SP_CROSSES_FUNC:
|
||||
return "mbrcrosses";
|
||||
return { STRING_WITH_LEN("mbrcrosses") };
|
||||
case SP_OVERLAPS_FUNC:
|
||||
return "mbroverlaps";
|
||||
return { STRING_WITH_LEN("mbroverlaps") };
|
||||
default:
|
||||
DBUG_ASSERT(0); // Should never happened
|
||||
return "mbrsp_unknown";
|
||||
return { STRING_WITH_LEN("mbrsp_unknown") };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1198,28 +1198,28 @@ longlong Item_func_spatial_mbr_rel::val_int()
|
|||
}
|
||||
|
||||
|
||||
const char *Item_func_spatial_precise_rel::func_name() const
|
||||
LEX_CSTRING Item_func_spatial_precise_rel::func_name_cstring() const
|
||||
{
|
||||
switch (spatial_rel) {
|
||||
case SP_CONTAINS_FUNC:
|
||||
return "st_contains";
|
||||
return { STRING_WITH_LEN("st_contains") };
|
||||
case SP_WITHIN_FUNC:
|
||||
return "st_within";
|
||||
return { STRING_WITH_LEN("st_within") };
|
||||
case SP_EQUALS_FUNC:
|
||||
return "st_equals";
|
||||
return { STRING_WITH_LEN("st_equals") };
|
||||
case SP_DISJOINT_FUNC:
|
||||
return "st_disjoint";
|
||||
return { STRING_WITH_LEN("st_disjoint") };
|
||||
case SP_INTERSECTS_FUNC:
|
||||
return "st_intersects";
|
||||
return { STRING_WITH_LEN("st_intersects") };
|
||||
case SP_TOUCHES_FUNC:
|
||||
return "st_touches";
|
||||
return { STRING_WITH_LEN("st_touches") };
|
||||
case SP_CROSSES_FUNC:
|
||||
return "st_crosses";
|
||||
return { STRING_WITH_LEN("st_crosses") };
|
||||
case SP_OVERLAPS_FUNC:
|
||||
return "st_overlaps";
|
||||
return { STRING_WITH_LEN("st_overlaps") } ;
|
||||
default:
|
||||
DBUG_ASSERT(0); // Should never happened
|
||||
return "sp_unknown";
|
||||
return { STRING_WITH_LEN("sp_unknown") };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1591,20 +1591,20 @@ String *Item_func_spatial_operation::val_str(String *str_value)
|
|||
}
|
||||
|
||||
|
||||
const char *Item_func_spatial_operation::func_name() const
|
||||
LEX_CSTRING Item_func_spatial_operation::func_name_cstring() const
|
||||
{
|
||||
switch (spatial_op) {
|
||||
case Gcalc_function::op_intersection:
|
||||
return "st_intersection";
|
||||
return { STRING_WITH_LEN("st_intersection") };
|
||||
case Gcalc_function::op_difference:
|
||||
return "st_difference";
|
||||
return { STRING_WITH_LEN("st_difference") };
|
||||
case Gcalc_function::op_union:
|
||||
return "st_union";
|
||||
return { STRING_WITH_LEN("st_union") };
|
||||
case Gcalc_function::op_symdifference:
|
||||
return "st_symdifference";
|
||||
return { STRING_WITH_LEN("st_symdifference") };
|
||||
default:
|
||||
DBUG_ASSERT(0); // Should never happen
|
||||
return "sp_unknown";
|
||||
return { STRING_WITH_LEN("sp_unknown") };
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Item_real_func_args_geometry: public Item_real_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count == 1);
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
|
||||
args[0]);
|
||||
}
|
||||
public:
|
||||
|
|
@ -74,7 +74,7 @@ class Item_long_func_args_geometry: public Item_long_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count == 1);
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
|
||||
args[0]);
|
||||
}
|
||||
protected:
|
||||
|
|
@ -95,7 +95,7 @@ class Item_bool_func_args_geometry: public Item_bool_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count == 1);
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
|
||||
args[0]);
|
||||
}
|
||||
public:
|
||||
|
|
@ -113,7 +113,7 @@ class Item_str_ascii_func_args_geometry: public Item_str_ascii_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count >= 1);
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
|
||||
args[0]);
|
||||
}
|
||||
public:
|
||||
|
|
@ -135,7 +135,7 @@ class Item_binary_func_args_geometry: public Item_str_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count >= 1);
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
|
||||
args[0]);
|
||||
}
|
||||
public:
|
||||
|
|
@ -153,7 +153,7 @@ class Item_geometry_func_args_geometry: public Item_geometry_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count >= 1);
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(),
|
||||
args[0]);
|
||||
}
|
||||
public:
|
||||
|
|
@ -173,7 +173,7 @@ class Item_real_func_args_geometry_geometry: public Item_real_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count >= 2);
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(),
|
||||
args, 0, 2);
|
||||
}
|
||||
public:
|
||||
|
|
@ -192,7 +192,7 @@ class Item_bool_func_args_geometry_geometry: public Item_bool_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count >= 2);
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(),
|
||||
args, 0, 2);
|
||||
}
|
||||
public:
|
||||
|
|
@ -205,14 +205,18 @@ class Item_func_geometry_from_text: public Item_geometry_func
|
|||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_general_purpose_string(func_name()) ||
|
||||
return args[0]->check_type_general_purpose_string(func_name_cstring()) ||
|
||||
check_argument_types_can_return_int(1, MY_MIN(2, arg_count));
|
||||
}
|
||||
public:
|
||||
Item_func_geometry_from_text(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
Item_func_geometry_from_text(THD *thd, Item *a, Item *srid):
|
||||
Item_geometry_func(thd, a, srid) {}
|
||||
const char *func_name() const { return "st_geometryfromtext"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_geometryfromtext") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_geometry_from_text>(thd, this); }
|
||||
|
|
@ -223,14 +227,18 @@ class Item_func_geometry_from_wkb: public Item_geometry_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
return
|
||||
Type_handler_geometry::check_type_geom_or_binary(func_name(), args[0]) ||
|
||||
Type_handler_geometry::check_type_geom_or_binary(func_name_cstring(), args[0]) ||
|
||||
check_argument_types_can_return_int(1, MY_MIN(2, arg_count));
|
||||
}
|
||||
public:
|
||||
Item_func_geometry_from_wkb(THD *thd, Item *a): Item_geometry_func(thd, a) {}
|
||||
Item_func_geometry_from_wkb(THD *thd, Item *a, Item *srid):
|
||||
Item_geometry_func(thd, a, srid) {}
|
||||
const char *func_name() const { return "st_geometryfromwkb"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_geometryfromwkb") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_geometry_from_wkb>(thd, this); }
|
||||
|
|
@ -243,7 +251,7 @@ class Item_func_geometry_from_json: public Item_geometry_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
// TODO: check with Alexey, for better args[1] and args[2] type control
|
||||
return args[0]->check_type_general_purpose_string(func_name()) ||
|
||||
return args[0]->check_type_general_purpose_string(func_name_cstring()) ||
|
||||
check_argument_types_traditional_scalar(1, MY_MIN(3, arg_count));
|
||||
}
|
||||
public:
|
||||
|
|
@ -252,7 +260,11 @@ class Item_func_geometry_from_json: public Item_geometry_func
|
|||
Item_geometry_func(thd, js, opt) {}
|
||||
Item_func_geometry_from_json(THD *thd, Item *js, Item *opt, Item *srid):
|
||||
Item_geometry_func(thd, js, opt, srid) {}
|
||||
const char *func_name() const { return "st_geomfromgeojson"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_geomfromgeojson") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_geometry_from_json>(thd, this); }
|
||||
|
|
@ -264,7 +276,11 @@ class Item_func_as_wkt: public Item_str_ascii_func_args_geometry
|
|||
public:
|
||||
Item_func_as_wkt(THD *thd, Item *a)
|
||||
:Item_str_ascii_func_args_geometry(thd, a) {}
|
||||
const char *func_name() const { return "st_astext"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_astext") };
|
||||
return name;
|
||||
}
|
||||
String *val_str_ascii(String *);
|
||||
bool fix_length_and_dec();
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -276,7 +292,11 @@ class Item_func_as_wkb: public Item_binary_func_args_geometry
|
|||
public:
|
||||
Item_func_as_wkb(THD *thd, Item *a)
|
||||
:Item_binary_func_args_geometry(thd, a) {}
|
||||
const char *func_name() const { return "st_aswkb"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_aswkb") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
const Type_handler *type_handler() const { return &type_handler_long_blob; }
|
||||
bool fix_length_and_dec()
|
||||
|
|
@ -307,7 +327,11 @@ class Item_func_as_geojson: public Item_str_ascii_func_args_geometry
|
|||
:Item_str_ascii_func_args_geometry(thd, js, max_dec_digits) {}
|
||||
Item_func_as_geojson(THD *thd, Item *js, Item *max_dec_digits, Item *opt)
|
||||
:Item_str_ascii_func_args_geometry(thd, js, max_dec_digits, opt) {}
|
||||
const char *func_name() const { return "st_asgeojson"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_asgeojson") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
String *val_str_ascii(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -321,7 +345,11 @@ class Item_func_geometry_type: public Item_str_ascii_func_args_geometry
|
|||
Item_func_geometry_type(THD *thd, Item *a)
|
||||
:Item_str_ascii_func_args_geometry(thd, a) {}
|
||||
String *val_str_ascii(String *);
|
||||
const char *func_name() const { return "st_geometrytype"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_geometrytype") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
// "GeometryCollection" is the longest
|
||||
|
|
@ -362,7 +390,11 @@ class Item_func_convexhull: public Item_geometry_func_args_geometry
|
|||
:Item_geometry_func_args_geometry(thd, a),
|
||||
res_heap(8192, sizeof(ch_node))
|
||||
{}
|
||||
const char *func_name() const { return "st_convexhull"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_convexhull") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_convexhull>(thd, this); }
|
||||
|
|
@ -374,7 +406,11 @@ class Item_func_centroid: public Item_geometry_func_args_geometry
|
|||
public:
|
||||
Item_func_centroid(THD *thd, Item *a)
|
||||
:Item_geometry_func_args_geometry(thd, a) {}
|
||||
const char *func_name() const { return "st_centroid"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_centroid") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
|
|
@ -389,7 +425,11 @@ class Item_func_envelope: public Item_geometry_func_args_geometry
|
|||
public:
|
||||
Item_func_envelope(THD *thd, Item *a)
|
||||
:Item_geometry_func_args_geometry(thd, a) {}
|
||||
const char *func_name() const { return "st_envelope"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_envelope") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
|
|
@ -427,7 +467,11 @@ class Item_func_boundary: public Item_geometry_func_args_geometry
|
|||
public:
|
||||
Item_func_boundary(THD *thd, Item *a)
|
||||
:Item_geometry_func_args_geometry(thd, a) {}
|
||||
const char *func_name() const { return "st_boundary"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_boundary") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_boundary>(thd, this); }
|
||||
|
|
@ -442,7 +486,11 @@ class Item_func_point: public Item_geometry_func
|
|||
Item_func_point(THD *thd, Item *a, Item *b): Item_geometry_func(thd, a, b) {}
|
||||
Item_func_point(THD *thd, Item *a, Item *b, Item *srid):
|
||||
Item_geometry_func(thd, a, b, srid) {}
|
||||
const char *func_name() const { return "point"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("point") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
|
|
@ -458,19 +506,22 @@ class Item_func_spatial_decomp: public Item_geometry_func_args_geometry
|
|||
public:
|
||||
Item_func_spatial_decomp(THD *thd, Item *a, Item_func::Functype ft):
|
||||
Item_geometry_func_args_geometry(thd, a) { decomp_func = ft; }
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
switch (decomp_func)
|
||||
{
|
||||
static LEX_CSTRING startpoint= {STRING_WITH_LEN("st_startpoint") };
|
||||
static LEX_CSTRING endpoint= {STRING_WITH_LEN("st_endpoint") };
|
||||
static LEX_CSTRING exteriorring= {STRING_WITH_LEN("st_exteriorring") };
|
||||
static LEX_CSTRING unknown= {STRING_WITH_LEN("spatial_decomp_unknown") };
|
||||
switch (decomp_func) {
|
||||
case SP_STARTPOINT:
|
||||
return "st_startpoint";
|
||||
return startpoint;
|
||||
case SP_ENDPOINT:
|
||||
return "st_endpoint";
|
||||
return endpoint;
|
||||
case SP_EXTERIORRING:
|
||||
return "st_exteriorring";
|
||||
return exteriorring;
|
||||
default:
|
||||
DBUG_ASSERT(0); // Should never happened
|
||||
return "spatial_decomp_unknown";
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
String *val_str(String *);
|
||||
|
|
@ -484,26 +535,30 @@ class Item_func_spatial_decomp_n: public Item_geometry_func_args_geometry
|
|||
bool check_arguments() const
|
||||
{
|
||||
return Item_geometry_func_args_geometry::check_arguments() ||
|
||||
args[1]->check_type_can_return_int(func_name());
|
||||
args[1]->check_type_can_return_int(func_name_cstring());
|
||||
}
|
||||
public:
|
||||
Item_func_spatial_decomp_n(THD *thd, Item *a, Item *b, Item_func::Functype ft)
|
||||
:Item_geometry_func_args_geometry(thd, a, b),
|
||||
decomp_func_n(ft)
|
||||
{ }
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
switch (decomp_func_n)
|
||||
{
|
||||
static LEX_CSTRING pointn= {STRING_WITH_LEN("st_pointn") };
|
||||
static LEX_CSTRING geometryn= {STRING_WITH_LEN("st_geometryn") };
|
||||
static LEX_CSTRING interiorringn= {STRING_WITH_LEN("st_interiorringn") };
|
||||
static LEX_CSTRING unknown= {STRING_WITH_LEN("spatial_decomp_unknown") };
|
||||
|
||||
switch (decomp_func_n) {
|
||||
case SP_POINTN:
|
||||
return "st_pointn";
|
||||
return pointn;
|
||||
case SP_GEOMETRYN:
|
||||
return "st_geometryn";
|
||||
return geometryn;
|
||||
case SP_INTERIORRINGN:
|
||||
return "st_interiorringn";
|
||||
return interiorringn;
|
||||
default:
|
||||
DBUG_ASSERT(0); // Should never happened
|
||||
return "spatial_decomp_n_unknown";
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
String *val_str(String *);
|
||||
|
|
@ -515,7 +570,7 @@ class Item_func_spatial_collection: public Item_geometry_func
|
|||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name(), args,
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(), args,
|
||||
0, arg_count);
|
||||
}
|
||||
enum Geometry::wkbType coll_type;
|
||||
|
|
@ -562,7 +617,11 @@ class Item_func_geometrycollection: public Item_func_spatial_collection
|
|||
{
|
||||
return &type_handler_geometrycollection;
|
||||
}
|
||||
const char *func_name() const { return "geometrycollection"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("geometrycollection") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_geometrycollection>(thd, this); }
|
||||
};
|
||||
|
|
@ -577,7 +636,11 @@ class Item_func_linestring: public Item_func_spatial_collection
|
|||
Geometry::wkb_point)
|
||||
{ }
|
||||
const Type_handler *type_handler() const { return &type_handler_linestring; }
|
||||
const char *func_name() const { return "linestring"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("linestring") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_linestring>(thd, this); }
|
||||
};
|
||||
|
|
@ -592,7 +655,11 @@ class Item_func_polygon: public Item_func_spatial_collection
|
|||
Geometry::wkb_linestring)
|
||||
{ }
|
||||
const Type_handler *type_handler() const { return &type_handler_polygon; }
|
||||
const char *func_name() const { return "polygon"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("polygon") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_polygon>(thd, this); }
|
||||
};
|
||||
|
|
@ -610,7 +677,11 @@ class Item_func_multilinestring: public Item_func_spatial_collection
|
|||
{
|
||||
return &type_handler_multilinestring;
|
||||
}
|
||||
const char *func_name() const { return "multilinestring"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("multilinestring") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_multilinestring>(thd, this); }
|
||||
};
|
||||
|
|
@ -628,7 +699,11 @@ class Item_func_multipoint: public Item_func_spatial_collection
|
|||
{
|
||||
return &type_handler_multipoint;
|
||||
}
|
||||
const char *func_name() const { return "multipoint"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("multipoint") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_multipoint>(thd, this); }
|
||||
};
|
||||
|
|
@ -646,7 +721,11 @@ class Item_func_multipolygon: public Item_func_spatial_collection
|
|||
{
|
||||
return &type_handler_multipolygon;
|
||||
}
|
||||
const char *func_name() const { return "multipolygon"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("multipolygon") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_multipolygon>(thd, this); }
|
||||
};
|
||||
|
|
@ -668,7 +747,7 @@ class Item_func_spatial_rel: public Item_bool_func2_with_rev
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count >= 2);
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(),
|
||||
args, 0, 2);
|
||||
}
|
||||
public:
|
||||
|
|
@ -710,7 +789,7 @@ class Item_func_spatial_mbr_rel: public Item_func_spatial_rel
|
|||
Item_func_spatial_rel(thd, a, b, sp_rel)
|
||||
{ }
|
||||
longlong val_int();
|
||||
const char *func_name() const;
|
||||
LEX_CSTRING func_name_cstring() const override;
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_spatial_mbr_rel>(thd, this); }
|
||||
};
|
||||
|
|
@ -726,7 +805,7 @@ class Item_func_spatial_precise_rel: public Item_func_spatial_rel
|
|||
Item_func_spatial_rel(thd, a, b, sp_rel), collector()
|
||||
{ }
|
||||
longlong val_int();
|
||||
const char *func_name() const;
|
||||
LEX_CSTRING func_name_cstring() const override;
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_spatial_precise_rel>(thd, this); }
|
||||
};
|
||||
|
|
@ -741,14 +820,18 @@ class Item_func_spatial_relate: public Item_bool_func_args_geometry_geometry
|
|||
bool check_arguments() const
|
||||
{
|
||||
return Item_bool_func_args_geometry_geometry::check_arguments() ||
|
||||
args[2]->check_type_general_purpose_string(func_name());
|
||||
args[2]->check_type_general_purpose_string(func_name_cstring());
|
||||
}
|
||||
public:
|
||||
Item_func_spatial_relate(THD *thd, Item *a, Item *b, Item *matrix):
|
||||
Item_bool_func_args_geometry_geometry(thd, a, b, matrix)
|
||||
{ }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_relate"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_relate") };
|
||||
return name;
|
||||
}
|
||||
bool need_parentheses_in_default() { return false; }
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_spatial_relate>(thd, this); }
|
||||
|
|
@ -764,7 +847,7 @@ class Item_func_spatial_operation: public Item_geometry_func
|
|||
bool check_arguments() const
|
||||
{
|
||||
DBUG_ASSERT(arg_count >= 2);
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name(),
|
||||
return Type_handler_geometry::check_types_geom_or_binary(func_name_cstring(),
|
||||
args, 0, 2);
|
||||
}
|
||||
public:
|
||||
|
|
@ -782,7 +865,7 @@ class Item_func_spatial_operation: public Item_geometry_func
|
|||
{}
|
||||
virtual ~Item_func_spatial_operation();
|
||||
String *val_str(String *);
|
||||
const char *func_name() const;
|
||||
LEX_CSTRING func_name_cstring() const override;
|
||||
virtual inline void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
Item_func::print(str, query_type);
|
||||
|
|
@ -797,7 +880,7 @@ class Item_func_buffer: public Item_geometry_func_args_geometry
|
|||
bool check_arguments() const
|
||||
{
|
||||
return Item_geometry_func_args_geometry::check_arguments() ||
|
||||
args[1]->check_type_can_return_real(func_name());
|
||||
args[1]->check_type_can_return_real(func_name_cstring());
|
||||
}
|
||||
protected:
|
||||
class Transporter : public Gcalc_operation_transporter
|
||||
|
|
@ -842,7 +925,11 @@ class Item_func_buffer: public Item_geometry_func_args_geometry
|
|||
public:
|
||||
Item_func_buffer(THD *thd, Item *obj, Item *distance)
|
||||
:Item_geometry_func_args_geometry(thd, obj, distance) {}
|
||||
const char *func_name() const { return "st_buffer"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_buffer") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_buffer>(thd, this); }
|
||||
|
|
@ -855,7 +942,11 @@ class Item_func_isempty: public Item_bool_func_args_geometry
|
|||
Item_func_isempty(THD *thd, Item *a)
|
||||
:Item_bool_func_args_geometry(thd, a) {}
|
||||
longlong val_int() override;
|
||||
const char *func_name() const { return "st_isempty"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_isempty") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() override
|
||||
{ set_maybe_null(); return FALSE; }
|
||||
bool need_parentheses_in_default() override { return false; }
|
||||
|
|
@ -873,7 +964,11 @@ class Item_func_issimple: public Item_long_func_args_geometry
|
|||
Item_func_issimple(THD *thd, Item *a)
|
||||
:Item_long_func_args_geometry(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_issimple"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_issimple") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() { decimals=0; max_length=2; return FALSE; }
|
||||
decimal_digits_t decimal_precision() const override { return 1; }
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -886,7 +981,11 @@ class Item_func_isclosed: public Item_long_func_args_geometry
|
|||
Item_func_isclosed(THD *thd, Item *a)
|
||||
:Item_long_func_args_geometry(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_isclosed"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_isclosed") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() { decimals=0; max_length=2; return FALSE; }
|
||||
decimal_digits_t decimal_precision() const override { return 1; }
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -898,7 +997,11 @@ class Item_func_isring: public Item_func_issimple
|
|||
public:
|
||||
Item_func_isring(THD *thd, Item *a): Item_func_issimple(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "st_isring"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_isring") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_isring>(thd, this); }
|
||||
};
|
||||
|
|
@ -909,7 +1012,11 @@ class Item_func_dimension: public Item_long_func_args_geometry
|
|||
Item_func_dimension(THD *thd, Item *a)
|
||||
:Item_long_func_args_geometry(thd, a) {}
|
||||
longlong val_int() override;
|
||||
const char *func_name() const { return "st_dimension"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_dimension") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() override
|
||||
{ max_length= 10; set_maybe_null(); return FALSE; }
|
||||
Item *get_copy(THD *thd) override
|
||||
|
|
@ -922,7 +1029,11 @@ class Item_func_x: public Item_real_func_args_geometry
|
|||
public:
|
||||
Item_func_x(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_x"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_x") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
if (Item_real_func::fix_length_and_dec())
|
||||
|
|
@ -940,7 +1051,11 @@ class Item_func_y: public Item_real_func_args_geometry
|
|||
public:
|
||||
Item_func_y(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_y"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_y") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
if (Item_real_func::fix_length_and_dec())
|
||||
|
|
@ -959,7 +1074,11 @@ class Item_func_numgeometries: public Item_long_func_args_geometry
|
|||
Item_func_numgeometries(THD *thd, Item *a)
|
||||
:Item_long_func_args_geometry(thd, a) {}
|
||||
longlong val_int() override;
|
||||
const char *func_name() const { return "st_numgeometries"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_numgeometries") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() override
|
||||
{ max_length= 10; set_maybe_null(); return FALSE; }
|
||||
Item *get_copy(THD *thd) override
|
||||
|
|
@ -973,7 +1092,11 @@ class Item_func_numinteriorring: public Item_long_func_args_geometry
|
|||
Item_func_numinteriorring(THD *thd, Item *a)
|
||||
:Item_long_func_args_geometry(thd, a) {}
|
||||
longlong val_int() override;
|
||||
const char *func_name() const { return "st_numinteriorrings"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_numinteriorrings") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() override
|
||||
{ max_length= 10; set_maybe_null(); return FALSE; }
|
||||
Item *get_copy(THD *thd) override
|
||||
|
|
@ -987,7 +1110,11 @@ class Item_func_numpoints: public Item_long_func_args_geometry
|
|||
Item_func_numpoints(THD *thd, Item *a)
|
||||
:Item_long_func_args_geometry(thd, a) {}
|
||||
longlong val_int() override;
|
||||
const char *func_name() const { return "st_numpoints"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_numpoints") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() override
|
||||
{ max_length= 10; set_maybe_null(); return FALSE; }
|
||||
Item *get_copy(THD *thd) override
|
||||
|
|
@ -1000,7 +1127,11 @@ class Item_func_area: public Item_real_func_args_geometry
|
|||
public:
|
||||
Item_func_area(THD *thd, Item *a): Item_real_func_args_geometry(thd, a) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_area"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_area") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
if (Item_real_func::fix_length_and_dec())
|
||||
|
|
@ -1020,7 +1151,11 @@ class Item_func_glength: public Item_real_func_args_geometry
|
|||
Item_func_glength(THD *thd, Item *a)
|
||||
:Item_real_func_args_geometry(thd, a) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_length"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_length") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
if (Item_real_func::fix_length_and_dec())
|
||||
|
|
@ -1039,7 +1174,11 @@ class Item_func_srid: public Item_long_func_args_geometry
|
|||
Item_func_srid(THD *thd, Item *a)
|
||||
:Item_long_func_args_geometry(thd, a) {}
|
||||
longlong val_int() override;
|
||||
const char *func_name() const { return "srid"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("srid") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() override
|
||||
{ max_length= 10; set_maybe_null(); return FALSE; }
|
||||
Item *get_copy(THD *thd) override
|
||||
|
|
@ -1058,7 +1197,11 @@ class Item_func_distance: public Item_real_func_args_geometry_geometry
|
|||
Item_func_distance(THD *thd, Item *a, Item *b)
|
||||
:Item_real_func_args_geometry_geometry(thd, a, b) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_distance"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_distance") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_distance>(thd, this); }
|
||||
};
|
||||
|
|
@ -1072,7 +1215,11 @@ class Item_func_sphere_distance: public Item_real_func
|
|||
Item_func_sphere_distance(THD *thd, List<Item> &list):
|
||||
Item_real_func(thd, list) {}
|
||||
double val_real();
|
||||
const char *func_name() const { return "st_distance_sphere"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_distance_sphere") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_sphere_distance>(thd, this); }
|
||||
};
|
||||
|
|
@ -1087,7 +1234,11 @@ class Item_func_pointonsurface: public Item_geometry_func_args_geometry
|
|||
public:
|
||||
Item_func_pointonsurface(THD *thd, Item *a)
|
||||
:Item_geometry_func_args_geometry(thd, a) {}
|
||||
const char *func_name() const { return "st_pointonsurface"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_pointonsurface") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
|
|
@ -1105,7 +1256,11 @@ class Item_func_gis_debug: public Item_long_func
|
|||
Item_func_gis_debug(THD *thd, Item *a): Item_long_func(thd, a)
|
||||
{ null_value= false; }
|
||||
bool fix_length_and_dec() { fix_char_length(10); return FALSE; }
|
||||
const char *func_name() const { return "st_gis_debug"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("st_gis_debug") };
|
||||
return name;
|
||||
}
|
||||
longlong val_int();
|
||||
bool check_vcol_func_processor(void *arg)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ static const char tab_arr[TAB_SIZE_LIMIT+1]= " ";
|
|||
|
||||
static int append_tab(String *js, int depth, int tab_size)
|
||||
{
|
||||
if (js->append("\n", 1))
|
||||
if (js->append('\n'))
|
||||
return 1;
|
||||
for (int i=0; i<depth; i++)
|
||||
{
|
||||
|
|
@ -183,7 +183,7 @@ static int json_nice(json_engine_t *je, String *nice_js,
|
|||
append_tab(nice_js, depth, tab_size))
|
||||
goto error;
|
||||
|
||||
nice_js->append("\"", 1);
|
||||
nice_js->append('"');
|
||||
append_simple(nice_js, key_start, key_end - key_start);
|
||||
nice_js->append(colon, colon_len);
|
||||
}
|
||||
|
|
@ -591,9 +591,9 @@ String *Item_func_json_quote::val_str(String *str)
|
|||
str->length(0);
|
||||
str->set_charset(&my_charset_utf8mb4_bin);
|
||||
|
||||
if (str->append("\"", 1) ||
|
||||
if (str->append('"') ||
|
||||
st_append_escaped(str, s) ||
|
||||
str->append("\"", 1))
|
||||
str->append('"'))
|
||||
{
|
||||
/* Report an error. */
|
||||
null_value= 1;
|
||||
|
|
@ -805,7 +805,7 @@ String *Item_func_json_extract::read_json(String *str,
|
|||
str->set_charset(js->charset());
|
||||
str->length(0);
|
||||
|
||||
if (possible_multiple_values && str->append("[", 1))
|
||||
if (possible_multiple_values && str->append('['))
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
@ -867,7 +867,7 @@ String *Item_func_json_extract::read_json(String *str,
|
|||
goto return_null;
|
||||
}
|
||||
|
||||
if (possible_multiple_values && str->append("]", 1))
|
||||
if (possible_multiple_values && str->append(']'))
|
||||
goto error; /* Out of memory. */
|
||||
|
||||
js= str;
|
||||
|
|
@ -1485,15 +1485,15 @@ static int append_json_value(String *str, Item *item, String *tmp_val)
|
|||
|
||||
if (item->result_type() == STRING_RESULT)
|
||||
{
|
||||
return str->append("\"", 1) ||
|
||||
return str->append('"') ||
|
||||
st_append_escaped(str, sv) ||
|
||||
str->append("\"", 1);
|
||||
str->append('"');
|
||||
}
|
||||
return st_append_escaped(str, sv);
|
||||
}
|
||||
|
||||
append_null:
|
||||
return str->append("null", 4);
|
||||
return str->append(STRING_WITH_LEN("null"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1531,15 +1531,15 @@ static int append_json_value_from_field(String *str,
|
|||
|
||||
if (i->result_type() == STRING_RESULT)
|
||||
{
|
||||
return str->append("\"", 1) ||
|
||||
return str->append('"') ||
|
||||
st_append_escaped(str, sv) ||
|
||||
str->append("\"", 1);
|
||||
str->append('"');
|
||||
}
|
||||
return st_append_escaped(str, sv);
|
||||
}
|
||||
|
||||
append_null:
|
||||
return str->append("null", 4);
|
||||
return str->append(STRING_WITH_LEN("null"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1549,7 +1549,7 @@ static int append_json_keyname(String *str, Item *item, String *tmp_val)
|
|||
if (item->null_value)
|
||||
goto append_null;
|
||||
|
||||
return str->append("\"", 1) ||
|
||||
return str->append('"') ||
|
||||
st_append_escaped(str, sv) ||
|
||||
str->append("\": ", 3);
|
||||
|
||||
|
|
@ -1595,7 +1595,7 @@ String *Item_func_json_array::val_str(String *str)
|
|||
str->length(0);
|
||||
str->set_charset(collation.collation);
|
||||
|
||||
if (str->append("[", 1) ||
|
||||
if (str->append('[') ||
|
||||
((arg_count > 0) && append_json_value(str, args[0], &tmp_val)))
|
||||
goto err_return;
|
||||
|
||||
|
|
@ -1606,7 +1606,7 @@ String *Item_func_json_array::val_str(String *str)
|
|||
goto err_return;
|
||||
}
|
||||
|
||||
if (str->append("]", 1))
|
||||
if (str->append(']'))
|
||||
goto err_return;
|
||||
|
||||
if (result_limit == 0)
|
||||
|
|
@ -1735,11 +1735,11 @@ String *Item_func_json_array_append::val_str(String *str)
|
|||
else
|
||||
c_to= je.value_end;
|
||||
|
||||
if (str->append("[", 1) ||
|
||||
if (str->append('[') ||
|
||||
str->append((const char *) c_from, c_to - c_from) ||
|
||||
str->append(", ", 2) ||
|
||||
append_json_value(str, args[n_arg+1], &tmp_val) ||
|
||||
str->append("]", 1) ||
|
||||
str->append(']') ||
|
||||
str->append((const char *) je.s.c_str,
|
||||
js->end() - (const char *) je.s.c_str))
|
||||
goto return_null; /* Out of memory. */
|
||||
|
|
@ -1925,7 +1925,7 @@ String *Item_func_json_object::val_str(String *str)
|
|||
str->length(0);
|
||||
str->set_charset(collation.collation);
|
||||
|
||||
if (str->append("{", 1) ||
|
||||
if (str->append('{') ||
|
||||
(arg_count > 0 &&
|
||||
(append_json_keyname(str, args[0], &tmp_val) ||
|
||||
append_json_value(str, args[1], &tmp_val))))
|
||||
|
|
@ -1939,7 +1939,7 @@ String *Item_func_json_object::val_str(String *str)
|
|||
goto err_return;
|
||||
}
|
||||
|
||||
if (str->append("}", 1))
|
||||
if (str->append('}'))
|
||||
goto err_return;
|
||||
|
||||
if (result_limit == 0)
|
||||
|
|
@ -1976,7 +1976,7 @@ static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
|
|||
|
||||
json_string_set_cs(&key_name, je1->s.cs);
|
||||
|
||||
if (str->append("{", 1))
|
||||
if (str->append('{'))
|
||||
return 3;
|
||||
while (json_scan_next(je1) == 0 &&
|
||||
je1->state != JST_OBJ_END)
|
||||
|
|
@ -2002,7 +2002,7 @@ static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
|
|||
*je2= sav_je2;
|
||||
}
|
||||
|
||||
if (str->append("\"", 1) ||
|
||||
if (str->append('"') ||
|
||||
append_simple(str, key_start, key_end - key_start) ||
|
||||
str->append("\":", 2))
|
||||
return 3;
|
||||
|
|
@ -2087,7 +2087,7 @@ static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
|
|||
if (json_skip_key(je2))
|
||||
return 1;
|
||||
|
||||
if (str->append("\"", 1) ||
|
||||
if (str->append('"') ||
|
||||
append_simple(str, key_start, je2->s.c_str - key_start))
|
||||
return 3;
|
||||
|
||||
|
|
@ -2095,7 +2095,7 @@ static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (str->append("}", 1))
|
||||
if (str->append('}'))
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
|
|
@ -2115,7 +2115,7 @@ static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (str->append("[", 1))
|
||||
if (str->append('['))
|
||||
return 3;
|
||||
if (je1->value_type == JSON_VALUE_OBJECT)
|
||||
{
|
||||
|
|
@ -2157,7 +2157,7 @@ static int do_merge(String *str, json_engine_t *je1, json_engine_t *je2)
|
|||
return 3;
|
||||
|
||||
if (je2->value_type != JSON_VALUE_ARRAY &&
|
||||
str->append("]", 1))
|
||||
str->append(']'))
|
||||
return 3;
|
||||
}
|
||||
|
||||
|
|
@ -2256,7 +2256,7 @@ static int copy_value_patch(String *str, json_engine_t *je)
|
|||
}
|
||||
/* JSON_VALUE_OBJECT */
|
||||
|
||||
if (str->append("{", 1))
|
||||
if (str->append('{'))
|
||||
return 1;
|
||||
while (json_scan_next(je) == 0 && je->state != JST_OBJ_END)
|
||||
{
|
||||
|
|
@ -2279,12 +2279,12 @@ static int copy_value_patch(String *str, json_engine_t *je)
|
|||
else
|
||||
first_key= 0;
|
||||
|
||||
if (str->append("\"", 1) ||
|
||||
if (str->append('"') ||
|
||||
append_simple(str, key_start, je->value_begin - key_start) ||
|
||||
copy_value_patch(str, je))
|
||||
return 1;
|
||||
}
|
||||
if (str->append("}", 1))
|
||||
if (str->append('}'))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
|
@ -2311,7 +2311,7 @@ static int do_merge_patch(String *str, json_engine_t *je1, json_engine_t *je2,
|
|||
*empty_result= FALSE;
|
||||
json_string_set_cs(&key_name, je1->s.cs);
|
||||
|
||||
if (str->append("{", 1))
|
||||
if (str->append('{'))
|
||||
return 3;
|
||||
while (json_scan_next(je1) == 0 &&
|
||||
je1->state != JST_OBJ_END)
|
||||
|
|
@ -2337,7 +2337,7 @@ static int do_merge_patch(String *str, json_engine_t *je1, json_engine_t *je2,
|
|||
*je2= sav_je2;
|
||||
}
|
||||
|
||||
if (str->append("\"", 1) ||
|
||||
if (str->append('"') ||
|
||||
append_simple(str, key_start, key_end - key_start) ||
|
||||
str->append("\":", 2))
|
||||
return 3;
|
||||
|
|
@ -2428,7 +2428,7 @@ static int do_merge_patch(String *str, json_engine_t *je1, json_engine_t *je2,
|
|||
if (!first_key && str->append(", ", 2))
|
||||
return 3;
|
||||
|
||||
if (str->append("\"", 1) ||
|
||||
if (str->append('"') ||
|
||||
append_simple(str, key_start, key_end - key_start) ||
|
||||
str->append("\":", 2))
|
||||
return 3;
|
||||
|
|
@ -2449,7 +2449,7 @@ static int do_merge_patch(String *str, json_engine_t *je1, json_engine_t *je2,
|
|||
continue;
|
||||
}
|
||||
|
||||
if (str->append("}", 1))
|
||||
if (str->append('}'))
|
||||
return 3;
|
||||
}
|
||||
else
|
||||
|
|
@ -2515,7 +2515,7 @@ String *Item_func_json_merge_patch::val_str(String *str)
|
|||
goto error_return;
|
||||
|
||||
if (empty_result)
|
||||
str->append("null");
|
||||
str->append(STRING_WITH_LEN("null"));
|
||||
|
||||
cont_point:
|
||||
{
|
||||
|
|
@ -2876,7 +2876,7 @@ String *Item_func_json_insert::val_str(String *str)
|
|||
str->length(0);
|
||||
/* Wrap the value as an array. */
|
||||
if (append_simple(str, js->ptr(), (const char *) v_from - js->ptr()) ||
|
||||
(do_array_autowrap && str->append("[", 1)))
|
||||
(do_array_autowrap && str->append('[')))
|
||||
goto js_error; /* Out of memory. */
|
||||
|
||||
if (je.value_type == JSON_VALUE_OBJECT)
|
||||
|
|
@ -2889,7 +2889,7 @@ String *Item_func_json_insert::val_str(String *str)
|
|||
(append_simple(str, v_from, je.s.c_str - v_from) ||
|
||||
str->append(", ", 2))) ||
|
||||
append_json_value(str, args[n_arg+1], &tmp_val) ||
|
||||
(do_array_autowrap && str->append("]", 1)) ||
|
||||
(do_array_autowrap && str->append(']')) ||
|
||||
append_simple(str, je.s.c_str, js->end()-(const char *) je.s.c_str))
|
||||
goto js_error; /* Out of memory. */
|
||||
|
||||
|
|
@ -2960,7 +2960,7 @@ String *Item_func_json_insert::val_str(String *str)
|
|||
str->length(0);
|
||||
if (append_simple(str, js->ptr(), v_to - js->ptr()) ||
|
||||
(n_key > 0 && str->append(", ", 2)) ||
|
||||
str->append("\"", 1) ||
|
||||
str->append('"') ||
|
||||
append_simple(str, lp->key, lp->key_end - lp->key) ||
|
||||
str->append("\":", 2) ||
|
||||
append_json_value(str, args[n_arg+1], &tmp_val) ||
|
||||
|
|
@ -3305,7 +3305,7 @@ String *Item_func_json_keys::val_str(String *str)
|
|||
goto null_return;
|
||||
|
||||
str->length(0);
|
||||
if (str->append("[", 1))
|
||||
if (str->append('['))
|
||||
goto err_return; /* Out of memory. */
|
||||
/* Parse the OBJECT collecting the keys. */
|
||||
while (json_scan_next(&je) == 0 && je.state != JST_OBJ_END)
|
||||
|
|
@ -3328,9 +3328,9 @@ String *Item_func_json_keys::val_str(String *str)
|
|||
if (!check_key_in_list(str, key_start, key_len))
|
||||
{
|
||||
if ((n_keys > 0 && str->append(", ", 2)) ||
|
||||
str->append("\"", 1) ||
|
||||
str->append('"') ||
|
||||
append_simple(str, key_start, key_len) ||
|
||||
str->append("\"", 1))
|
||||
str->append('"'))
|
||||
goto err_return;
|
||||
n_keys++;
|
||||
}
|
||||
|
|
@ -3345,7 +3345,7 @@ String *Item_func_json_keys::val_str(String *str)
|
|||
}
|
||||
}
|
||||
|
||||
if (unlikely(je.s.error || str->append("]", 1)))
|
||||
if (unlikely(je.s.error || str->append(']')))
|
||||
goto err_return;
|
||||
|
||||
null_value= 0;
|
||||
|
|
@ -3449,14 +3449,14 @@ static int append_json_path(String *str, const json_path_t *p)
|
|||
else /*JSON_PATH_ARRAY*/
|
||||
{
|
||||
|
||||
if (str->append("[", 1) ||
|
||||
if (str->append('[') ||
|
||||
str->append_ulonglong(c->n_item) ||
|
||||
str->append("]", 1))
|
||||
str->append(']'))
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return str->append("\"", 1);
|
||||
return str->append('"');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3517,7 +3517,7 @@ String *Item_func_json_search::val_str(String *str)
|
|||
{
|
||||
if (n_path_found == 2)
|
||||
{
|
||||
if (str->append("[", 1) ||
|
||||
if (str->append('[') ||
|
||||
append_json_path(str, &sav_path))
|
||||
goto js_error;
|
||||
}
|
||||
|
|
@ -3543,7 +3543,7 @@ String *Item_func_json_search::val_str(String *str)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (str->append("]", 1))
|
||||
if (str->append(']'))
|
||||
goto js_error;
|
||||
}
|
||||
|
||||
|
|
@ -3559,21 +3559,21 @@ String *Item_func_json_search::val_str(String *str)
|
|||
}
|
||||
|
||||
|
||||
const char *Item_func_json_format::func_name() const
|
||||
LEX_CSTRING Item_func_json_format::func_name_cstring() const
|
||||
{
|
||||
switch (fmt)
|
||||
{
|
||||
case COMPACT:
|
||||
return "json_compact";
|
||||
return { STRING_WITH_LEN("json_compact") };
|
||||
case LOOSE:
|
||||
return "json_loose";
|
||||
return { STRING_WITH_LEN("json_loose") };
|
||||
case DETAILED:
|
||||
return "json_detailed";
|
||||
return { STRING_WITH_LEN("json_detailed") };
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
};
|
||||
|
||||
return "";
|
||||
return NULL_clex_str;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3774,7 +3774,7 @@ Item_func_json_objectagg(THD *thd, Item_func_json_objectagg *item)
|
|||
{
|
||||
quick_group= FALSE;
|
||||
result.set_charset(collation.collation);
|
||||
result.append("{");
|
||||
result.append('{');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3855,11 +3855,11 @@ bool Item_func_json_objectagg::add()
|
|||
|
||||
null_value= 0;
|
||||
if (result.length() > 1)
|
||||
result.append(", ");
|
||||
result.append(STRING_WITH_LEN(", "));
|
||||
|
||||
result.append("\"");
|
||||
result.append('"');
|
||||
result.append(*key);
|
||||
result.append("\":");
|
||||
result.append(STRING_WITH_LEN("\":"));
|
||||
|
||||
buf.length(0);
|
||||
append_json_value(&result, args[1], &buf);
|
||||
|
|
@ -3874,7 +3874,7 @@ String* Item_func_json_objectagg::val_str(String* str)
|
|||
if (null_value)
|
||||
return 0;
|
||||
|
||||
result.append("}");
|
||||
result.append('}');
|
||||
return &result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,11 @@ class Item_func_json_valid: public Item_bool_func
|
|||
public:
|
||||
Item_func_json_valid(THD *thd, Item *json) : Item_bool_func(thd, json) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "json_valid"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_valid") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
if (Item_bool_func::fix_length_and_dec())
|
||||
|
|
@ -111,7 +115,11 @@ class Item_func_json_exists: public Item_bool_func
|
|||
public:
|
||||
Item_func_json_exists(THD *thd, Item *js, Item *i_path):
|
||||
Item_bool_func(thd, js, i_path) {}
|
||||
const char *func_name() const { return "json_exists"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_exists") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_json_exists>(thd, this); }
|
||||
|
|
@ -147,7 +155,11 @@ class Item_func_json_value: public Item_str_func,
|
|||
public:
|
||||
Item_func_json_value(THD *thd, Item *js, Item *i_path):
|
||||
Item_str_func(thd, js, i_path) {}
|
||||
const char *func_name() const override { return "json_value"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_value") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() override ;
|
||||
String *val_str(String *to) override
|
||||
{
|
||||
|
|
@ -171,7 +183,11 @@ class Item_func_json_query: public Item_json_func,
|
|||
public:
|
||||
Item_func_json_query(THD *thd, Item *js, Item *i_path):
|
||||
Item_json_func(thd, js, i_path) {}
|
||||
const char *func_name() const override { return "json_query"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_query") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() override;
|
||||
String *val_str(String *to) override
|
||||
{
|
||||
|
|
@ -196,7 +212,11 @@ class Item_func_json_quote: public Item_str_func
|
|||
|
||||
public:
|
||||
Item_func_json_quote(THD *thd, Item *s): Item_str_func(thd, s) {}
|
||||
const char *func_name() const { return "json_quote"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_quote") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -211,7 +231,11 @@ class Item_func_json_unquote: public Item_str_func
|
|||
String *read_json(json_engine_t *je);
|
||||
public:
|
||||
Item_func_json_unquote(THD *thd, Item *s): Item_str_func(thd, s) {}
|
||||
const char *func_name() const { return "json_unquote"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_unquote") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -242,7 +266,11 @@ class Item_func_json_extract: public Item_json_str_multipath
|
|||
char **out_val, int *value_len);
|
||||
Item_func_json_extract(THD *thd, List<Item> &list):
|
||||
Item_json_str_multipath(thd, list) {}
|
||||
const char *func_name() const { return "json_extract"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_extract") };
|
||||
return name;
|
||||
}
|
||||
enum Functype functype() const { return JSON_EXTRACT_FUNC; }
|
||||
bool fix_length_and_dec();
|
||||
String *val_str(String *);
|
||||
|
|
@ -266,7 +294,11 @@ class Item_func_json_contains: public Item_bool_func
|
|||
public:
|
||||
Item_func_json_contains(THD *thd, List<Item> &list):
|
||||
Item_bool_func(thd, list) {}
|
||||
const char *func_name() const { return "json_contains"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_contains") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -287,7 +319,11 @@ class Item_func_json_contains_path: public Item_bool_func
|
|||
public:
|
||||
Item_func_json_contains_path(THD *thd, List<Item> &list):
|
||||
Item_bool_func(thd, list), tmp_paths(0) {}
|
||||
const char *func_name() const { return "json_contains_path"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_contains_path") };
|
||||
return name;
|
||||
}
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
bool fix_length_and_dec();
|
||||
void cleanup();
|
||||
|
|
@ -309,7 +345,11 @@ class Item_func_json_array: public Item_json_func
|
|||
Item_json_func(thd, list) {}
|
||||
String *val_str(String *);
|
||||
bool fix_length_and_dec();
|
||||
const char *func_name() const { return "json_array"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_array") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_json_array>(thd, this); }
|
||||
};
|
||||
|
|
@ -326,7 +366,11 @@ class Item_func_json_array_append: public Item_json_str_multipath
|
|||
bool fix_length_and_dec();
|
||||
String *val_str(String *);
|
||||
uint get_n_paths() const { return arg_count/2; }
|
||||
const char *func_name() const { return "json_array_append"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_array_append") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_json_array_append>(thd, this); }
|
||||
};
|
||||
|
|
@ -338,7 +382,11 @@ class Item_func_json_array_insert: public Item_func_json_array_append
|
|||
Item_func_json_array_insert(THD *thd, List<Item> &list):
|
||||
Item_func_json_array_append(thd, list) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "json_array_insert"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_array_insert") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_json_array_insert>(thd, this); }
|
||||
};
|
||||
|
|
@ -352,7 +400,11 @@ class Item_func_json_object: public Item_func_json_array
|
|||
Item_func_json_object(THD *thd, List<Item> &list):
|
||||
Item_func_json_array(thd, list) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "json_object"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_object") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_json_object>(thd, this); }
|
||||
};
|
||||
|
|
@ -366,7 +418,11 @@ class Item_func_json_merge: public Item_func_json_array
|
|||
Item_func_json_merge(THD *thd, List<Item> &list):
|
||||
Item_func_json_array(thd, list) {}
|
||||
String *val_str(String *);
|
||||
const char *func_name() const { return "json_merge_preserve"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_merge_preserve") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_json_merge>(thd, this); }
|
||||
};
|
||||
|
|
@ -376,7 +432,11 @@ class Item_func_json_merge_patch: public Item_func_json_merge
|
|||
public:
|
||||
Item_func_json_merge_patch(THD *thd, List<Item> &list):
|
||||
Item_func_json_merge(thd, list) {}
|
||||
const char *func_name() const { return "json_merge_patch"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_merge_patch") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_json_merge_patch>(thd, this); }
|
||||
|
|
@ -386,9 +446,9 @@ class Item_func_json_length: public Item_long_func
|
|||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_text(func_name()) ||
|
||||
return args[0]->check_type_can_return_text(func_name_cstring()) ||
|
||||
(arg_count > 1 &&
|
||||
args[1]->check_type_general_purpose_string(func_name()));
|
||||
args[1]->check_type_general_purpose_string(func_name_cstring()));
|
||||
}
|
||||
protected:
|
||||
json_path_with_flags path;
|
||||
|
|
@ -397,7 +457,11 @@ class Item_func_json_length: public Item_long_func
|
|||
public:
|
||||
Item_func_json_length(THD *thd, List<Item> &list):
|
||||
Item_long_func(thd, list) {}
|
||||
const char *func_name() const { return "json_length"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_length") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -408,12 +472,16 @@ class Item_func_json_length: public Item_long_func
|
|||
class Item_func_json_depth: public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_text(func_name()); }
|
||||
{ return args[0]->check_type_can_return_text(func_name_cstring()); }
|
||||
protected:
|
||||
String tmp_js;
|
||||
public:
|
||||
Item_func_json_depth(THD *thd, Item *js): Item_long_func(thd, js) {}
|
||||
const char *func_name() const { return "json_depth"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_depth") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec() { max_length= 10; return FALSE; }
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -427,7 +495,11 @@ class Item_func_json_type: public Item_str_func
|
|||
String tmp_js;
|
||||
public:
|
||||
Item_func_json_type(THD *thd, Item *js): Item_str_func(thd, js) {}
|
||||
const char *func_name() const { return "json_type"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_type") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -448,10 +520,13 @@ class Item_func_json_insert: public Item_json_str_multipath
|
|||
bool fix_length_and_dec();
|
||||
String *val_str(String *);
|
||||
uint get_n_paths() const { return arg_count/2; }
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return mode_insert ?
|
||||
(mode_replace ? "json_set" : "json_insert") : "json_update";
|
||||
static LEX_CSTRING json_set= {STRING_WITH_LEN("json_set") };
|
||||
static LEX_CSTRING json_insert= {STRING_WITH_LEN("json_insert") };
|
||||
static LEX_CSTRING json_update= {STRING_WITH_LEN("json_update") };
|
||||
return (mode_insert ?
|
||||
(mode_replace ? json_set : json_insert) : json_update);
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_json_insert>(thd, this); }
|
||||
|
|
@ -468,7 +543,11 @@ class Item_func_json_remove: public Item_json_str_multipath
|
|||
bool fix_length_and_dec();
|
||||
String *val_str(String *);
|
||||
uint get_n_paths() const { return arg_count - 1; }
|
||||
const char *func_name() const { return "json_remove"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_remove") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_json_remove>(thd, this); }
|
||||
};
|
||||
|
|
@ -483,7 +562,11 @@ class Item_func_json_keys: public Item_str_func
|
|||
public:
|
||||
Item_func_json_keys(THD *thd, List<Item> &list):
|
||||
Item_str_func(thd, list) {}
|
||||
const char *func_name() const { return "json_keys"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_keys") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -506,7 +589,11 @@ class Item_func_json_search: public Item_json_str_multipath
|
|||
public:
|
||||
Item_func_json_search(THD *thd, List<Item> &list):
|
||||
Item_json_str_multipath(thd, list) {}
|
||||
const char *func_name() const { return "json_search"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_search") };
|
||||
return name;
|
||||
}
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
bool fix_length_and_dec();
|
||||
String *val_str(String *);
|
||||
|
|
@ -535,7 +622,7 @@ class Item_func_json_format: public Item_json_func
|
|||
Item_func_json_format(THD *thd, List<Item> &list):
|
||||
Item_json_func(thd, list), fmt(DETAILED) {}
|
||||
|
||||
const char *func_name() const;
|
||||
LEX_CSTRING func_name_cstring() const override;
|
||||
bool fix_length_and_dec();
|
||||
String *val_str(String *str);
|
||||
String *val_json(String *str);
|
||||
|
|
@ -570,7 +657,11 @@ class Item_func_json_arrayagg : public Item_func_group_concat
|
|||
Item_func_json_arrayagg(THD *thd, Item_func_json_arrayagg *item);
|
||||
bool is_json_type() { return true; }
|
||||
|
||||
const char *func_name() const { return "json_arrayagg("; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_arrayagg(") };
|
||||
return name;
|
||||
}
|
||||
enum Sumfunctype sum_func() const {return JSON_ARRAYAGG_FUNC;}
|
||||
|
||||
String* val_str(String *str);
|
||||
|
|
@ -588,7 +679,7 @@ class Item_func_json_objectagg : public Item_sum
|
|||
Item_sum(thd, key, value)
|
||||
{
|
||||
quick_group= FALSE;
|
||||
result.append("{");
|
||||
result.append('{');
|
||||
}
|
||||
|
||||
Item_func_json_objectagg(THD *thd, Item_func_json_objectagg *item);
|
||||
|
|
@ -596,7 +687,11 @@ class Item_func_json_objectagg : public Item_sum
|
|||
void cleanup();
|
||||
|
||||
enum Sumfunctype sum_func () const {return JSON_OBJECTAGG_FUNC;}
|
||||
const char *func_name() const { return "json_objectagg"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("json_objectagg") };
|
||||
return name;
|
||||
}
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
if (too_big_for_varchar())
|
||||
|
|
|
|||
|
|
@ -554,7 +554,7 @@ String *Item_func_decode_histogram::val_str(String *str)
|
|||
size_t size= my_snprintf(numbuf, sizeof(numbuf),
|
||||
representation_by_type[type], val - prev);
|
||||
str->append(numbuf, size);
|
||||
str->append(",");
|
||||
str->append(',');
|
||||
prev= val;
|
||||
}
|
||||
/* show delta with max */
|
||||
|
|
@ -2145,7 +2145,7 @@ void Item_func_trim::print(String *str, enum_query_type query_type)
|
|||
Item_func::print(str, query_type);
|
||||
return;
|
||||
}
|
||||
str->append(Item_func_trim::func_name());
|
||||
str->append(Item_func_trim::func_name_cstring());
|
||||
str->append(func_name_ext());
|
||||
str->append('(');
|
||||
str->append(mode_name());
|
||||
|
|
@ -2934,13 +2934,14 @@ String *Item_func_make_set::val_str(String *str)
|
|||
|
||||
void Item_func_char::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(Item_func_char::func_name());
|
||||
str->append(Item_func_char::func_name_cstring());
|
||||
str->append('(');
|
||||
print_args(str, 0, query_type);
|
||||
if (collation.collation != &my_charset_bin)
|
||||
{
|
||||
str->append(STRING_WITH_LEN(" using "));
|
||||
str->append(collation.collation->csname);
|
||||
str->append(collation.collation->csname,
|
||||
strlen(collation.collation->csname));
|
||||
}
|
||||
str->append(')');
|
||||
}
|
||||
|
|
@ -3223,7 +3224,7 @@ bool Item_func_pad::fix_length_and_dec()
|
|||
return TRUE;
|
||||
pad_str.set_charset(collation.collation);
|
||||
pad_str.length(0);
|
||||
pad_str.append(" ", 1);
|
||||
pad_str.append(' ');
|
||||
}
|
||||
|
||||
DBUG_ASSERT(collation.collation->mbmaxlen > 0);
|
||||
|
|
@ -3533,7 +3534,8 @@ void Item_func_conv_charset::print(String *str, enum_query_type query_type)
|
|||
str->append(STRING_WITH_LEN("convert("));
|
||||
args[0]->print(str, query_type);
|
||||
str->append(STRING_WITH_LEN(" using "));
|
||||
str->append(collation.collation->csname);
|
||||
str->append(collation.collation->csname,
|
||||
strlen(collation.collation->csname));
|
||||
str->append(')');
|
||||
}
|
||||
|
||||
|
|
@ -3573,7 +3575,7 @@ void Item_func_set_collation::print(String *str, enum_query_type query_type)
|
|||
{
|
||||
args[0]->print_parenthesised(str, query_type, precedence());
|
||||
str->append(STRING_WITH_LEN(" collate "));
|
||||
str->append(m_set_collation->name);
|
||||
str->append(m_set_collation->name, strlen(m_set_collation->name));
|
||||
}
|
||||
|
||||
String *Item_func_charset::val_str(String *str)
|
||||
|
|
@ -3704,7 +3706,7 @@ String *Item_func_weight_string::val_str(String *str)
|
|||
|
||||
void Item_func_weight_string::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
args[0]->print(str, query_type);
|
||||
str->append(',');
|
||||
|
|
@ -4631,7 +4633,8 @@ void Item_func_dyncol_create::print_arguments(String *str,
|
|||
if (defs[i].cs)
|
||||
{
|
||||
str->append(STRING_WITH_LEN(" charset "));
|
||||
str->append(defs[i].cs->csname);
|
||||
const char *cs= defs[i].cs->csname;
|
||||
str->append(cs, strlen(cs));
|
||||
str->append(' ');
|
||||
}
|
||||
break;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1092,13 +1092,18 @@ void Item_subselect::print(String *str, enum_query_type query_type)
|
|||
if (unit && unit->first_select())
|
||||
{
|
||||
char buf[64];
|
||||
ll2str(unit->first_select()->select_number, buf, 10, 0);
|
||||
str->append(buf);
|
||||
size_t length= (size_t)
|
||||
(longlong10_to_str(unit->first_select()->select_number, buf, 10) -
|
||||
buf);
|
||||
str->append(buf, length);
|
||||
}
|
||||
else
|
||||
str->append("NULL"); // TODO: what exactly does this mean?
|
||||
{
|
||||
// TODO: Explain what exactly does this mean?
|
||||
str->append(NULL_clex_str);
|
||||
}
|
||||
|
||||
str->append(")");
|
||||
str->append(')');
|
||||
return;
|
||||
}
|
||||
if (engine)
|
||||
|
|
@ -1108,7 +1113,7 @@ void Item_subselect::print(String *str, enum_query_type query_type)
|
|||
str->append(')');
|
||||
}
|
||||
else
|
||||
str->append("(...)");
|
||||
str->append(STRING_WITH_LEN("(...)"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -3693,7 +3698,8 @@ void Item_allany_subselect::print(String *str, enum_query_type query_type)
|
|||
{
|
||||
left_expr->print(str, query_type);
|
||||
str->append(' ');
|
||||
str->append(func->symbol(all));
|
||||
const char *name= func->symbol(all);
|
||||
str->append(name, strlen(name));
|
||||
str->append(all ? " all " : " any ", 5);
|
||||
}
|
||||
Item_subselect::print(str, query_type);
|
||||
|
|
@ -6216,26 +6222,34 @@ bool Ordered_key::next_same()
|
|||
void Ordered_key::print(String *str)
|
||||
{
|
||||
uint i;
|
||||
str->append("{idx=");
|
||||
|
||||
/* We have to pre-allocate string as we are using qs_append() */
|
||||
if (str->alloc(str->length() +
|
||||
5+10+4+ (NAME_LEN+2)*key_column_count+
|
||||
20+11+21+10+FLOATING_POINT_BUFFER*3+50
|
||||
))
|
||||
return;
|
||||
str->append(STRING_WITH_LEN("{idx="));
|
||||
str->qs_append(keyid);
|
||||
str->append(", (");
|
||||
for (i= 0; i < key_column_count - 1; i++)
|
||||
str->append(STRING_WITH_LEN(", ("));
|
||||
for (i= 0; i < key_column_count ; i++)
|
||||
{
|
||||
str->append(&key_columns[i]->field->field_name);
|
||||
str->append(", ");
|
||||
str->append(STRING_WITH_LEN(", "));
|
||||
}
|
||||
str->append(&key_columns[i]->field->field_name);
|
||||
str->append("), ");
|
||||
if (key_column_count)
|
||||
str->length(str->length() - 2);
|
||||
str->append(STRING_WITH_LEN("), "));
|
||||
|
||||
str->append("null_bitmap: (bits=");
|
||||
str->append(STRING_WITH_LEN("null_bitmap: (bits="));
|
||||
str->qs_append(null_key.n_bits);
|
||||
str->append(", nulls= ");
|
||||
str->append(STRING_WITH_LEN(", nulls= "));
|
||||
str->qs_append((double)null_count);
|
||||
str->append(", min_null= ");
|
||||
str->append(STRING_WITH_LEN(", min_null= "));
|
||||
str->qs_append((double)min_null_row);
|
||||
str->append(", max_null= ");
|
||||
str->append(STRING_WITH_LEN(", max_null= "));
|
||||
str->qs_append((double)max_null_row);
|
||||
str->append("), ");
|
||||
str->append(STRING_WITH_LEN("), "));
|
||||
|
||||
str->append('}');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@ void Item_sum::print(String *str, enum_query_type query_type)
|
|||
{
|
||||
/* orig_args is not filled with valid values until fix_fields() */
|
||||
Item **pargs= fixed() ? orig_args : args;
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
/*
|
||||
TODO:
|
||||
The fact that func_name() may return a name with an extra '('
|
||||
|
|
@ -1458,11 +1458,10 @@ Item_sum_sp::fix_length_and_dec()
|
|||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
const char *
|
||||
Item_sum_sp::func_name() const
|
||||
LEX_CSTRING Item_sum_sp::func_name_cstring() const
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
return Item_sp::func_name(thd);
|
||||
return Item_sp::func_name_cstring(thd);
|
||||
}
|
||||
|
||||
Item* Item_sum_sp::copy_or_same(THD *thd)
|
||||
|
|
@ -3367,7 +3366,7 @@ void Item_udf_sum::cleanup()
|
|||
|
||||
void Item_udf_sum::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
for (uint i=0 ; i < arg_count ; i++)
|
||||
{
|
||||
|
|
@ -4524,7 +4523,7 @@ uint Item_func_group_concat::get_null_bytes()
|
|||
|
||||
void Item_func_group_concat::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
if (distinct)
|
||||
str->append(STRING_WITH_LEN("distinct "));
|
||||
for (uint i= 0; i < arg_count_field; i++)
|
||||
|
|
|
|||
|
|
@ -838,9 +838,11 @@ class Item_sum_sum :public Item_sum_num,
|
|||
void reset_field();
|
||||
void update_field();
|
||||
void no_rows_in_result() {}
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return has_with_distinct() ? "sum(distinct " : "sum(";
|
||||
static LEX_CSTRING name_distinct= { STRING_WITH_LEN("sum(distinct ")};
|
||||
static LEX_CSTRING name_normal= { STRING_WITH_LEN("sum(") };
|
||||
return has_with_distinct() ? name_distinct : name_normal;
|
||||
}
|
||||
Item *copy_or_same(THD* thd);
|
||||
void remove();
|
||||
|
|
@ -911,9 +913,11 @@ class Item_sum_count :public Item_sum_int
|
|||
void reset_field();
|
||||
void update_field();
|
||||
void direct_add(longlong add_count);
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return has_with_distinct() ? "count(distinct " : "count(";
|
||||
static LEX_CSTRING name_distinct= { STRING_WITH_LEN("count(distinct ")};
|
||||
static LEX_CSTRING name_normal= { STRING_WITH_LEN("count(") };
|
||||
return has_with_distinct() ? name_distinct : name_normal;
|
||||
}
|
||||
Item *copy_or_same(THD* thd);
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -961,9 +965,11 @@ class Item_sum_avg :public Item_sum_sum
|
|||
void update_field();
|
||||
Item *result_item(THD *thd, Field *field);
|
||||
void no_rows_in_result() {}
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return has_with_distinct() ? "avg(distinct " : "avg(";
|
||||
static LEX_CSTRING name_distinct= { STRING_WITH_LEN("avg(distinct ")};
|
||||
static LEX_CSTRING name_normal= { STRING_WITH_LEN("avg(") };
|
||||
return has_with_distinct() ? name_distinct : name_normal;
|
||||
}
|
||||
Item *copy_or_same(THD* thd);
|
||||
Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table);
|
||||
|
|
@ -1047,8 +1053,12 @@ class Item_sum_variance :public Item_sum_double
|
|||
void update_field() override final;
|
||||
Item *result_item(THD *thd, Field *field) override;
|
||||
void no_rows_in_result() override final {}
|
||||
const char *func_name() const override
|
||||
{ return sample ? "var_samp(" : "variance("; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name_sample= { STRING_WITH_LEN("var_samp(")};
|
||||
static LEX_CSTRING name_normal= { STRING_WITH_LEN("variance(") };
|
||||
return sample ? name_sample : name_normal;
|
||||
}
|
||||
Item *copy_or_same(THD* thd) override;
|
||||
Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override
|
||||
final;
|
||||
|
|
@ -1076,7 +1086,11 @@ class Item_sum_std final :public Item_sum_variance
|
|||
enum Sumfunctype sum_func () const override final { return STD_FUNC; }
|
||||
double val_real() override final;
|
||||
Item *result_item(THD *thd, Field *field) override final;
|
||||
const char *func_name() const override final { return "std("; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING sum_name= {STRING_WITH_LEN("std(") };
|
||||
return sum_name;
|
||||
}
|
||||
Item *copy_or_same(THD* thd) override final;
|
||||
Item *get_copy(THD *thd) override final
|
||||
{ return get_item_copy<Item_sum_std>(thd, this); }
|
||||
|
|
@ -1172,7 +1186,11 @@ class Item_sum_min final :public Item_sum_min_max
|
|||
enum Sumfunctype sum_func () const {return MIN_FUNC;}
|
||||
|
||||
bool add();
|
||||
const char *func_name() const { return "min("; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING sum_name= {STRING_WITH_LEN("min(") };
|
||||
return sum_name;
|
||||
}
|
||||
Item *copy_or_same(THD* thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_min>(thd, this); }
|
||||
|
|
@ -1187,7 +1205,11 @@ class Item_sum_max final :public Item_sum_min_max
|
|||
enum Sumfunctype sum_func () const {return MAX_FUNC;}
|
||||
|
||||
bool add();
|
||||
const char *func_name() const { return "max("; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING sum_name= {STRING_WITH_LEN("max(") };
|
||||
return sum_name;
|
||||
}
|
||||
Item *copy_or_same(THD* thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_max>(thd, this); }
|
||||
|
|
@ -1216,7 +1238,7 @@ class Item_sum_bit :public Item_sum_int
|
|||
const Type_handler *type_handler() const { return &type_handler_ulonglong; }
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
if (args[0]->check_type_can_return_int(func_name()))
|
||||
if (args[0]->check_type_can_return_int(func_name_cstring()))
|
||||
return true;
|
||||
decimals= 0; max_length=21; unsigned_flag= 1;
|
||||
base_flags&= ~item_base_t::MAYBE_NULL;
|
||||
|
|
@ -1276,7 +1298,11 @@ class Item_sum_or final :public Item_sum_bit
|
|||
Item_sum_or(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
|
||||
Item_sum_or(THD *thd, Item_sum_or *item) :Item_sum_bit(thd, item) {}
|
||||
bool add();
|
||||
const char *func_name() const { return "bit_or("; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING sum_name= {STRING_WITH_LEN("bit_or(") };
|
||||
return sum_name;
|
||||
}
|
||||
Item *copy_or_same(THD* thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_or>(thd, this); }
|
||||
|
|
@ -1293,7 +1319,11 @@ class Item_sum_and final :public Item_sum_bit
|
|||
Item_sum_bit(thd, item_par, ULONGLONG_MAX) {}
|
||||
Item_sum_and(THD *thd, Item_sum_and *item) :Item_sum_bit(thd, item) {}
|
||||
bool add();
|
||||
const char *func_name() const { return "bit_and("; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING sum_min_name= {STRING_WITH_LEN("bit_and(") };
|
||||
return sum_min_name;
|
||||
}
|
||||
Item *copy_or_same(THD* thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_and>(thd, this); }
|
||||
|
|
@ -1308,7 +1338,11 @@ class Item_sum_xor final :public Item_sum_bit
|
|||
Item_sum_xor(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {}
|
||||
Item_sum_xor(THD *thd, Item_sum_xor *item) :Item_sum_bit(thd, item) {}
|
||||
bool add();
|
||||
const char *func_name() const { return "bit_xor("; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING sum_min_name= {STRING_WITH_LEN("bit_xor(") };
|
||||
return sum_min_name;
|
||||
}
|
||||
Item *copy_or_same(THD* thd);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_xor>(thd, this); }
|
||||
|
|
@ -1393,7 +1427,7 @@ class Item_sum_sp final :public Item_sum,
|
|||
}
|
||||
bool fix_length_and_dec();
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
const char *func_name() const;
|
||||
LEX_CSTRING func_name_cstring() const override;
|
||||
const Type_handler *type_handler() const;
|
||||
bool add();
|
||||
|
||||
|
|
@ -1606,7 +1640,11 @@ class Item_udf_sum : public Item_sum
|
|||
Item_udf_sum(THD *thd, Item_udf_sum *item)
|
||||
:Item_sum(thd, item), udf(item->udf)
|
||||
{ udf.not_original= TRUE; }
|
||||
const char *func_name() const { return udf.name(); }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
const char *tmp= udf.name();
|
||||
return {tmp, strlen(tmp) };
|
||||
}
|
||||
bool fix_fields(THD *thd, Item **ref)
|
||||
{
|
||||
DBUG_ASSERT(fixed() == 0);
|
||||
|
|
@ -1973,7 +2011,11 @@ class Item_func_group_concat : public Item_sum
|
|||
void cleanup();
|
||||
|
||||
enum Sumfunctype sum_func () const {return GROUP_CONCAT_FUNC;}
|
||||
const char *func_name() const { return "group_concat("; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING sum_name= {STRING_WITH_LEN("group_concat(") };
|
||||
return sum_name;
|
||||
}
|
||||
const Type_handler *type_handler() const
|
||||
{
|
||||
if (too_big_for_varchar())
|
||||
|
|
|
|||
|
|
@ -976,7 +976,7 @@ bool Item_func_monthname::fix_length_and_dec()
|
|||
{
|
||||
THD* thd= current_thd;
|
||||
CHARSET_INFO *cs= thd->variables.collation_connection;
|
||||
locale= thd->variables.lc_time_names;
|
||||
locale= thd->variables.lc_time_names;
|
||||
collation.set(cs, DERIVATION_COERCIBLE, locale->repertoire());
|
||||
decimals=0;
|
||||
max_length= locale->max_month_name_length * collation.collation->mbmaxlen;
|
||||
|
|
@ -1575,7 +1575,7 @@ bool Item_func_curtime::get_date(THD *thd, MYSQL_TIME *res,
|
|||
|
||||
void Item_func_curtime::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
if (decimals)
|
||||
str->append_ulonglong(decimals);
|
||||
|
|
@ -1637,7 +1637,7 @@ bool Item_func_now::fix_fields(THD *thd, Item **items)
|
|||
|
||||
void Item_func_now::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
if (decimals)
|
||||
str->append_ulonglong(decimals);
|
||||
|
|
@ -2109,16 +2109,19 @@ static const char *interval_names[]=
|
|||
void Item_date_add_interval::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
args[0]->print_parenthesised(str, query_type, INTERVAL_PRECEDENCE);
|
||||
str->append(date_sub_interval?" - interval ":" + interval ");
|
||||
static LEX_CSTRING minus_interval= { STRING_WITH_LEN(" - interval ") };
|
||||
static LEX_CSTRING plus_interval= { STRING_WITH_LEN(" + interval ") };
|
||||
LEX_CSTRING *tmp= date_sub_interval ? &minus_interval : &plus_interval;
|
||||
str->append(tmp);
|
||||
args[1]->print(str, query_type);
|
||||
str->append(' ');
|
||||
str->append(interval_names[int_type]);
|
||||
str->append(interval_names[int_type], strlen(interval_names[int_type]));
|
||||
}
|
||||
|
||||
void Item_extract::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(STRING_WITH_LEN("extract("));
|
||||
str->append(interval_names[int_type]);
|
||||
str->append(interval_names[int_type], strlen(interval_names[int_type]));
|
||||
str->append(STRING_WITH_LEN(" from "));
|
||||
args[0]->print(str, query_type);
|
||||
str->append(')');
|
||||
|
|
@ -2260,7 +2263,8 @@ void Item_func::print_cast_temporal(String *str, enum_query_type query_type)
|
|||
if (decimals && decimals != NOT_FIXED_DEC)
|
||||
{
|
||||
str->append('(');
|
||||
str->append(llstr(decimals, buf));
|
||||
size_t length= (size_t) (longlong10_to_str(decimals, buf, -10) - buf);
|
||||
str->append(buf, length);
|
||||
str->append(')');
|
||||
}
|
||||
str->append(')');
|
||||
|
|
@ -2274,18 +2278,16 @@ void Item_char_typecast::print(String *str, enum_query_type query_type)
|
|||
str->append(STRING_WITH_LEN(" as char"));
|
||||
if (cast_length != ~0U)
|
||||
{
|
||||
char buf[20];
|
||||
size_t length= (size_t) (longlong10_to_str(cast_length, buf, 10) - buf);
|
||||
str->append('(');
|
||||
char buffer[20];
|
||||
// my_charset_bin is good enough for numbers
|
||||
String st(buffer, sizeof(buffer), &my_charset_bin);
|
||||
st.set(static_cast<ulonglong>(cast_length), &my_charset_bin);
|
||||
str->append(st);
|
||||
str->append(buf, length);
|
||||
str->append(')');
|
||||
}
|
||||
if (cast_cs)
|
||||
{
|
||||
str->append(STRING_WITH_LEN(" charset "));
|
||||
str->append(cast_cs->csname);
|
||||
str->append(cast_cs->csname, strlen(cast_cs->csname));
|
||||
}
|
||||
str->append(')');
|
||||
}
|
||||
|
|
@ -2882,7 +2884,7 @@ longlong Item_func_timestamp_diff::val_int()
|
|||
|
||||
void Item_func_timestamp_diff::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
|
||||
switch (int_type) {
|
||||
|
|
@ -2961,7 +2963,7 @@ String *Item_func_get_format::val_str_ascii(String *str)
|
|||
|
||||
void Item_func_get_format::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
|
||||
switch (type) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ bool get_interval_value(THD *thd, Item *args,
|
|||
class Item_long_func_date_field: public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_date(func_name()); }
|
||||
{ return args[0]->check_type_can_return_date(func_name_cstring()); }
|
||||
public:
|
||||
Item_long_func_date_field(THD *thd, Item *a)
|
||||
:Item_long_func(thd, a) { }
|
||||
|
|
@ -43,7 +43,7 @@ class Item_long_func_date_field: public Item_long_func
|
|||
class Item_long_func_time_field: public Item_long_func
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_time(func_name()); }
|
||||
{ return args[0]->check_type_can_return_time(func_name_cstring()); }
|
||||
public:
|
||||
Item_long_func_time_field(THD *thd, Item *a)
|
||||
:Item_long_func(thd, a) { }
|
||||
|
|
@ -57,7 +57,11 @@ class Item_func_period_add :public Item_long_func
|
|||
public:
|
||||
Item_func_period_add(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "period_add"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("period_add") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
max_length=6*MY_CHARSET_BIN_MB_MAXLEN;
|
||||
|
|
@ -75,7 +79,11 @@ class Item_func_period_diff :public Item_long_func
|
|||
public:
|
||||
Item_func_period_diff(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "period_diff"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("period_diff") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -92,7 +100,11 @@ class Item_func_to_days :public Item_long_func_date_field
|
|||
public:
|
||||
Item_func_to_days(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "to_days"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("to_days") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -120,7 +132,11 @@ class Item_func_to_seconds :public Item_longlong_func
|
|||
public:
|
||||
Item_func_to_seconds(THD *thd, Item *a): Item_longlong_func(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "to_seconds"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("to_seconds") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -147,7 +163,11 @@ class Item_func_dayofmonth :public Item_long_func_date_field
|
|||
public:
|
||||
Item_func_dayofmonth(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "dayofmonth"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("dayofmonth") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -172,7 +192,11 @@ class Item_func_month :public Item_long_func
|
|||
Item_func_month(THD *thd, Item *a): Item_long_func(thd, a)
|
||||
{ }
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "month"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("month") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals= 0;
|
||||
|
|
@ -196,7 +220,11 @@ class Item_func_monthname :public Item_str_func
|
|||
MY_LOCALE *locale;
|
||||
public:
|
||||
Item_func_monthname(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
const char *func_name() const { return "monthname"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("monthname") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *str);
|
||||
bool fix_length_and_dec();
|
||||
bool check_partition_func_processor(void *int_arg) {return TRUE;}
|
||||
|
|
@ -218,7 +246,11 @@ class Item_func_dayofyear :public Item_long_func_date_field
|
|||
public:
|
||||
Item_func_dayofyear(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "dayofyear"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("dayofyear") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals= 0;
|
||||
|
|
@ -242,7 +274,11 @@ class Item_func_hour :public Item_long_func_time_field
|
|||
public:
|
||||
Item_func_hour(THD *thd, Item *a): Item_long_func_time_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "hour"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("hour") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -266,7 +302,11 @@ class Item_func_minute :public Item_long_func_time_field
|
|||
public:
|
||||
Item_func_minute(THD *thd, Item *a): Item_long_func_time_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "minute"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("minute") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -290,7 +330,11 @@ class Item_func_quarter :public Item_long_func_date_field
|
|||
public:
|
||||
Item_func_quarter(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "quarter"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("quarter") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -314,7 +358,11 @@ class Item_func_second :public Item_long_func_time_field
|
|||
public:
|
||||
Item_func_second(THD *thd, Item *a): Item_long_func_time_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "second"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("second") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -337,14 +385,18 @@ class Item_func_week :public Item_long_func
|
|||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_date(func_name()) ||
|
||||
(arg_count > 1 && args[1]->check_type_can_return_int(func_name()));
|
||||
return args[0]->check_type_can_return_date(func_name_cstring()) ||
|
||||
(arg_count > 1 && args[1]->check_type_can_return_int(func_name_cstring()));
|
||||
}
|
||||
public:
|
||||
Item_func_week(THD *thd, Item *a): Item_long_func(thd, a) {}
|
||||
Item_func_week(THD *thd, Item *a, Item *b): Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "week"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("week") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -370,14 +422,18 @@ class Item_func_yearweek :public Item_long_func
|
|||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_date(func_name()) ||
|
||||
args[1]->check_type_can_return_int(func_name());
|
||||
return args[0]->check_type_can_return_date(func_name_cstring()) ||
|
||||
args[1]->check_type_can_return_int(func_name_cstring());
|
||||
}
|
||||
public:
|
||||
Item_func_yearweek(THD *thd, Item *a, Item *b)
|
||||
:Item_long_func(thd, a, b) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "yearweek"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("yearweek") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -401,7 +457,11 @@ class Item_func_year :public Item_long_func_date_field
|
|||
public:
|
||||
Item_func_year(THD *thd, Item *a): Item_long_func_date_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "year"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("year") };
|
||||
return name;
|
||||
}
|
||||
enum_monotonicity_info get_monotonicity_info() const;
|
||||
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
|
||||
bool fix_length_and_dec()
|
||||
|
|
@ -429,9 +489,11 @@ class Item_func_weekday :public Item_long_func
|
|||
Item_func_weekday(THD *thd, Item *a, bool type_arg):
|
||||
Item_long_func(thd, a), odbc_type(type_arg) { }
|
||||
longlong val_int();
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return (odbc_type ? "dayofweek" : "weekday");
|
||||
static LEX_CSTRING dayofweek= {STRING_WITH_LEN("dayofweek") };
|
||||
static LEX_CSTRING weekday= {STRING_WITH_LEN("weekday") };
|
||||
return (odbc_type ? dayofweek : weekday);
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate)
|
||||
{
|
||||
|
|
@ -459,7 +521,11 @@ class Item_func_dayname :public Item_str_func
|
|||
MY_LOCALE *locale;
|
||||
public:
|
||||
Item_func_dayname(THD *thd, Item *a): Item_str_func(thd, a) {}
|
||||
const char *func_name() const { return "dayname"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("dayname") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *str);
|
||||
const Type_handler *type_handler() const { return &type_handler_varchar; }
|
||||
bool fix_length_and_dec();
|
||||
|
|
@ -510,7 +576,11 @@ class Item_func_unix_timestamp :public Item_func_seconds_hybrid
|
|||
Item_func_unix_timestamp(THD *thd): Item_func_seconds_hybrid(thd) {}
|
||||
Item_func_unix_timestamp(THD *thd, Item *a):
|
||||
Item_func_seconds_hybrid(thd, a) {}
|
||||
const char *func_name() const { return "unix_timestamp"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("unix_timestamp") };
|
||||
return name;
|
||||
}
|
||||
enum_monotonicity_info get_monotonicity_info() const;
|
||||
longlong val_int_endpoint(bool left_endp, bool *incl_endp);
|
||||
bool check_partition_func_processor(void *int_arg) {return FALSE;}
|
||||
|
|
@ -547,7 +617,11 @@ class Item_func_time_to_sec :public Item_func_seconds_hybrid
|
|||
public:
|
||||
Item_func_time_to_sec(THD *thd, Item *item):
|
||||
Item_func_seconds_hybrid(thd, item) {}
|
||||
const char *func_name() const { return "time_to_sec"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("time_to_sec") };
|
||||
return name;
|
||||
}
|
||||
bool check_partition_func_processor(void *int_arg) {return FALSE;}
|
||||
bool check_vcol_func_processor(void *arg) { return FALSE;}
|
||||
bool check_valid_arguments_processor(void *int_arg)
|
||||
|
|
@ -651,7 +725,11 @@ class Item_func_curtime_local :public Item_func_curtime
|
|||
{
|
||||
public:
|
||||
Item_func_curtime_local(THD *thd, uint dec): Item_func_curtime(thd, dec) {}
|
||||
const char *func_name() const { return "curtime"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("curtime") };
|
||||
return name;
|
||||
}
|
||||
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_curtime_local>(thd, this); }
|
||||
|
|
@ -662,7 +740,11 @@ class Item_func_curtime_utc :public Item_func_curtime
|
|||
{
|
||||
public:
|
||||
Item_func_curtime_utc(THD *thd, uint dec): Item_func_curtime(thd, dec) {}
|
||||
const char *func_name() const { return "utc_time"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("utc_time") };
|
||||
return name;
|
||||
}
|
||||
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_curtime_utc>(thd, this); }
|
||||
|
|
@ -690,7 +772,11 @@ class Item_func_curdate_local :public Item_func_curdate
|
|||
{
|
||||
public:
|
||||
Item_func_curdate_local(THD *thd): Item_func_curdate(thd) {}
|
||||
const char *func_name() const { return "curdate"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("curdate") };
|
||||
return name;
|
||||
}
|
||||
void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_curdate_local>(thd, this); }
|
||||
|
|
@ -701,7 +787,11 @@ class Item_func_curdate_utc :public Item_func_curdate
|
|||
{
|
||||
public:
|
||||
Item_func_curdate_utc(THD *thd): Item_func_curdate(thd) {}
|
||||
const char *func_name() const { return "utc_date"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("utc_date") };
|
||||
return name;
|
||||
}
|
||||
void store_now_in_TIME(THD* thd, MYSQL_TIME *now_time);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_curdate_utc>(thd, this); }
|
||||
|
|
@ -738,7 +828,11 @@ class Item_func_now_local :public Item_func_now
|
|||
{
|
||||
public:
|
||||
Item_func_now_local(THD *thd, uint dec): Item_func_now(thd, dec) {}
|
||||
const char *func_name() const { return "current_timestamp"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("current_timestamp") };
|
||||
return name;
|
||||
}
|
||||
int save_in_field(Field *field, bool no_conversions);
|
||||
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time);
|
||||
virtual enum Functype functype() const { return NOW_FUNC; }
|
||||
|
|
@ -751,7 +845,11 @@ class Item_func_now_utc :public Item_func_now
|
|||
{
|
||||
public:
|
||||
Item_func_now_utc(THD *thd, uint dec): Item_func_now(thd, dec) {}
|
||||
const char *func_name() const { return "utc_timestamp"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("utc_timestamp") };
|
||||
return name;
|
||||
}
|
||||
virtual void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time);
|
||||
virtual enum Functype functype() const { return NOW_UTC_FUNC; }
|
||||
virtual bool check_vcol_func_processor(void *arg)
|
||||
|
|
@ -773,7 +871,11 @@ class Item_func_sysdate_local :public Item_func_now
|
|||
public:
|
||||
Item_func_sysdate_local(THD *thd, uint dec): Item_func_now(thd, dec) {}
|
||||
bool const_item() const { return 0; }
|
||||
const char *func_name() const { return "sysdate"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("sysdate") };
|
||||
return name;
|
||||
}
|
||||
void store_now_in_TIME(THD *thd, MYSQL_TIME *now_time);
|
||||
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate);
|
||||
table_map used_tables() const { return RAND_TABLE_BIT; }
|
||||
|
|
@ -791,10 +893,14 @@ class Item_func_sysdate_local :public Item_func_now
|
|||
class Item_func_from_days :public Item_datefunc
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_int(func_name()); }
|
||||
{ return args[0]->check_type_can_return_int(func_name_cstring()); }
|
||||
public:
|
||||
Item_func_from_days(THD *thd, Item *a): Item_datefunc(thd, a) {}
|
||||
const char *func_name() const { return "from_days"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("from_days") };
|
||||
return name;
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate);
|
||||
bool check_partition_func_processor(void *int_arg) {return FALSE;}
|
||||
bool check_vcol_func_processor(void *arg) { return FALSE;}
|
||||
|
|
@ -811,7 +917,7 @@ class Item_func_date_format :public Item_str_func
|
|||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_date(func_name()) ||
|
||||
return args[0]->check_type_can_return_date(func_name_cstring()) ||
|
||||
check_argument_types_can_return_text(1, arg_count);
|
||||
}
|
||||
const MY_LOCALE *locale;
|
||||
|
|
@ -825,7 +931,11 @@ class Item_func_date_format :public Item_str_func
|
|||
Item_func_date_format(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_str_func(thd, a, b, c), locale(0), is_time_format(false) {}
|
||||
String *val_str(String *str);
|
||||
const char *func_name() const { return "date_format"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("date_format") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
uint format_length(const String *format);
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
|
|
@ -844,7 +954,11 @@ class Item_func_time_format: public Item_func_date_format
|
|||
public:
|
||||
Item_func_time_format(THD *thd, Item *a, Item *b):
|
||||
Item_func_date_format(thd, a, b) { is_time_format= true; }
|
||||
const char *func_name() const { return "time_format"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("time_format") };
|
||||
return name;
|
||||
}
|
||||
bool check_vcol_func_processor(void *arg) { return false; }
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_time_format>(thd, this); }
|
||||
|
|
@ -854,11 +968,15 @@ class Item_func_time_format: public Item_func_date_format
|
|||
class Item_func_from_unixtime :public Item_datetimefunc
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_decimal(func_name()); }
|
||||
{ return args[0]->check_type_can_return_decimal(func_name_cstring()); }
|
||||
Time_zone *tz;
|
||||
public:
|
||||
Item_func_from_unixtime(THD *thd, Item *a): Item_datetimefunc(thd, a) {}
|
||||
const char *func_name() const { return "from_unixtime"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("from_unixtime") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate);
|
||||
bool check_vcol_func_processor(void *arg)
|
||||
|
|
@ -888,7 +1006,7 @@ class Item_func_convert_tz :public Item_datetimefunc
|
|||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_date(func_name()) ||
|
||||
return args[0]->check_type_can_return_date(func_name_cstring()) ||
|
||||
check_argument_types_can_return_text(1, arg_count);
|
||||
}
|
||||
/*
|
||||
|
|
@ -902,7 +1020,11 @@ class Item_func_convert_tz :public Item_datetimefunc
|
|||
public:
|
||||
Item_func_convert_tz(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_datetimefunc(thd, a, b, c), from_tz_cached(0), to_tz_cached(0) {}
|
||||
const char *func_name() const { return "convert_tz"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("convert_tz") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
fix_attributes_datetime(args[0]->datetime_precision(current_thd));
|
||||
|
|
@ -919,7 +1041,7 @@ class Item_func_convert_tz :public Item_datetimefunc
|
|||
class Item_func_sec_to_time :public Item_timefunc
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_decimal(func_name()); }
|
||||
{ return args[0]->check_type_can_return_decimal(func_name_cstring()); }
|
||||
public:
|
||||
Item_func_sec_to_time(THD *thd, Item *item): Item_timefunc(thd, item) {}
|
||||
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate);
|
||||
|
|
@ -929,7 +1051,11 @@ class Item_func_sec_to_time :public Item_timefunc
|
|||
set_maybe_null();
|
||||
return FALSE;
|
||||
}
|
||||
const char *func_name() const { return "sec_to_time"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("sec_to_time") };
|
||||
return name;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_sec_to_time>(thd, this); }
|
||||
};
|
||||
|
|
@ -944,7 +1070,11 @@ class Item_date_add_interval :public Item_handled_func
|
|||
bool neg_arg):
|
||||
Item_handled_func(thd, a, b), int_type(type_arg),
|
||||
date_sub_interval(neg_arg) {}
|
||||
const char *func_name() const { return "date_add_interval"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("date_add_interval") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
void print(String *str, enum_query_type query_type);
|
||||
|
|
@ -1005,7 +1135,11 @@ class Item_extract :public Item_int_func,
|
|||
}
|
||||
longlong val_int();
|
||||
enum Functype functype() const { return EXTRACT_FUNC; }
|
||||
const char *func_name() const { return "extract"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("extract") };
|
||||
return name;
|
||||
}
|
||||
bool check_arguments() const;
|
||||
bool fix_length_and_dec();
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
|
|
@ -1082,7 +1216,11 @@ class Item_char_typecast :public Item_handled_func
|
|||
m_suppress_warning_to_error_escalation(false) {}
|
||||
enum Functype functype() const { return CHAR_TYPECAST_FUNC; }
|
||||
bool eq(const Item *item, bool binary_cmp) const;
|
||||
const char *func_name() const { return "cast_as_char"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_char") };
|
||||
return name;
|
||||
}
|
||||
CHARSET_INFO *cast_charset() const { return cast_cs; }
|
||||
String *val_str_generic(String *a);
|
||||
String *val_str_binary_from_native(String *a);
|
||||
|
|
@ -1123,7 +1261,11 @@ class Item_date_typecast :public Item_datefunc
|
|||
{
|
||||
public:
|
||||
Item_date_typecast(THD *thd, Item *a): Item_datefunc(thd, a) {}
|
||||
const char *func_name() const { return "cast_as_date"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_date") };
|
||||
return name;
|
||||
}
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
print_cast_temporal(str, query_type);
|
||||
|
|
@ -1143,7 +1285,11 @@ class Item_time_typecast :public Item_timefunc
|
|||
public:
|
||||
Item_time_typecast(THD *thd, Item *a, uint dec_arg):
|
||||
Item_timefunc(thd, a) { decimals= dec_arg; }
|
||||
const char *func_name() const { return "cast_as_time"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_time") };
|
||||
return name;
|
||||
}
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
print_cast_temporal(str, query_type);
|
||||
|
|
@ -1165,7 +1311,11 @@ class Item_datetime_typecast :public Item_datetimefunc
|
|||
public:
|
||||
Item_datetime_typecast(THD *thd, Item *a, uint dec_arg):
|
||||
Item_datetimefunc(thd, a) { decimals= dec_arg; }
|
||||
const char *func_name() const { return "cast_as_datetime"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("cast_as_datetime") };
|
||||
return name;
|
||||
}
|
||||
void print(String *str, enum_query_type query_type)
|
||||
{
|
||||
print_cast_temporal(str, query_type);
|
||||
|
|
@ -1189,7 +1339,11 @@ class Item_func_makedate :public Item_datefunc
|
|||
public:
|
||||
Item_func_makedate(THD *thd, Item *a, Item *b):
|
||||
Item_datefunc(thd, a, b) {}
|
||||
const char *func_name() const { return "makedate"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("makedate") };
|
||||
return name;
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_makedate>(thd, this); }
|
||||
|
|
@ -1200,14 +1354,18 @@ class Item_func_timestamp :public Item_datetimefunc
|
|||
{
|
||||
bool check_arguments() const
|
||||
{
|
||||
return args[0]->check_type_can_return_date(func_name()) ||
|
||||
args[1]->check_type_can_return_time(func_name());
|
||||
return args[0]->check_type_can_return_date(func_name_cstring()) ||
|
||||
args[1]->check_type_can_return_time(func_name_cstring());
|
||||
}
|
||||
public:
|
||||
Item_func_timestamp(THD *thd, Item *a, Item *b)
|
||||
:Item_datetimefunc(thd, a, b)
|
||||
{ }
|
||||
const char *func_name() const { return "timestamp"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("timestamp") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
|
|
@ -1255,7 +1413,12 @@ class Item_func_add_time :public Item_handled_func
|
|||
:Item_handled_func(thd, a, b), sign(neg_arg ? -1 : 1)
|
||||
{ }
|
||||
bool fix_length_and_dec();
|
||||
const char *func_name() const { return sign > 0 ? "addtime" : "subtime"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING addtime= { STRING_WITH_LEN("addtime") };
|
||||
static LEX_CSTRING subtime= { STRING_WITH_LEN("subtime") };
|
||||
return sign > 0 ? addtime : subtime;
|
||||
}
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_add_time>(thd, this); }
|
||||
};
|
||||
|
|
@ -1267,7 +1430,11 @@ class Item_func_timediff :public Item_timefunc
|
|||
{ return check_argument_types_can_return_time(0, arg_count); }
|
||||
public:
|
||||
Item_func_timediff(THD *thd, Item *a, Item *b): Item_timefunc(thd, a, b) {}
|
||||
const char *func_name() const { return "timediff"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("timediff") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
THD *thd= current_thd;
|
||||
|
|
@ -1287,7 +1454,7 @@ class Item_func_maketime :public Item_timefunc
|
|||
bool check_arguments() const
|
||||
{
|
||||
return check_argument_types_can_return_int(0, 2) ||
|
||||
args[2]->check_type_can_return_decimal(func_name());
|
||||
args[2]->check_type_can_return_decimal(func_name_cstring());
|
||||
}
|
||||
public:
|
||||
Item_func_maketime(THD *thd, Item *a, Item *b, Item *c):
|
||||
|
|
@ -1299,7 +1466,11 @@ class Item_func_maketime :public Item_timefunc
|
|||
set_maybe_null();
|
||||
return FALSE;
|
||||
}
|
||||
const char *func_name() const { return "maketime"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("maketime") };
|
||||
return name;
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_maketime>(thd, this); }
|
||||
|
|
@ -1311,7 +1482,11 @@ class Item_func_microsecond :public Item_long_func_time_field
|
|||
public:
|
||||
Item_func_microsecond(THD *thd, Item *a): Item_long_func_time_field(thd, a) {}
|
||||
longlong val_int();
|
||||
const char *func_name() const { return "microsecond"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("microsecond") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
decimals=0;
|
||||
|
|
@ -1341,7 +1516,11 @@ class Item_func_timestamp_diff :public Item_longlong_func
|
|||
public:
|
||||
Item_func_timestamp_diff(THD *thd, Item *a, Item *b, interval_type type_arg):
|
||||
Item_longlong_func(thd, a, b), int_type(type_arg) {}
|
||||
const char *func_name() const { return "timestampdiff"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("timestampdiff") };
|
||||
return name;
|
||||
}
|
||||
longlong val_int();
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
|
|
@ -1368,7 +1547,11 @@ class Item_func_get_format :public Item_str_ascii_func
|
|||
Item_str_ascii_func(thd, a), type(type_arg)
|
||||
{}
|
||||
String *val_str_ascii(String *str);
|
||||
const char *func_name() const { return "get_format"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("get_format") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec()
|
||||
{
|
||||
set_maybe_null();
|
||||
|
|
@ -1395,7 +1578,11 @@ class Item_func_str_to_date :public Item_handled_func
|
|||
{}
|
||||
bool get_date_common(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzzydate,
|
||||
timestamp_type);
|
||||
const char *func_name() const { return "str_to_date"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("str_to_date") };
|
||||
return name;
|
||||
}
|
||||
bool fix_length_and_dec();
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_str_to_date>(thd, this); }
|
||||
|
|
@ -1405,10 +1592,14 @@ class Item_func_str_to_date :public Item_handled_func
|
|||
class Item_func_last_day :public Item_datefunc
|
||||
{
|
||||
bool check_arguments() const
|
||||
{ return args[0]->check_type_can_return_date(func_name()); }
|
||||
{ return args[0]->check_type_can_return_date(func_name_cstring()); }
|
||||
public:
|
||||
Item_func_last_day(THD *thd, Item *a): Item_datefunc(thd, a) {}
|
||||
const char *func_name() const { return "last_day"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("last_day") };
|
||||
return name;
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_last_day>(thd, this); }
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ bool Item_func_history::val_bool()
|
|||
|
||||
void Item_func_history::print(String *str, enum_query_type query_type)
|
||||
{
|
||||
str->append(func_name());
|
||||
str->append(func_name_cstring());
|
||||
str->append('(');
|
||||
args[0]->print(str, query_type);
|
||||
str->append(')');
|
||||
|
|
|
|||
|
|
@ -46,7 +46,11 @@ class Item_func_history: public Item_bool_func
|
|||
max_length= 1;
|
||||
return FALSE;
|
||||
}
|
||||
virtual const char* func_name() const { return "is_history"; }
|
||||
virtual LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("is_history") };
|
||||
return name;
|
||||
}
|
||||
virtual void print(String *str, enum_query_type query_type);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_history>(thd, this); }
|
||||
|
|
@ -57,13 +61,11 @@ class Item_func_trt_ts: public Item_datetimefunc
|
|||
TR_table::field_id_t trt_field;
|
||||
public:
|
||||
Item_func_trt_ts(THD *thd, Item* a, TR_table::field_id_t _trt_field);
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
if (trt_field == TR_table::FLD_BEGIN_TS)
|
||||
{
|
||||
return "trt_begin_ts";
|
||||
}
|
||||
return "trt_commit_ts";
|
||||
static LEX_CSTRING begin_name= {STRING_WITH_LEN("trt_begin_ts") };
|
||||
static LEX_CSTRING commit_name= {STRING_WITH_LEN("trt_commit_ts") };
|
||||
return (trt_field == TR_table::FLD_BEGIN_TS) ? begin_name : commit_name;
|
||||
}
|
||||
bool get_date(THD *thd, MYSQL_TIME *res, date_mode_t fuzzydate);
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -84,20 +86,23 @@ class Item_func_trt_id : public Item_longlong_func
|
|||
Item_func_trt_id(THD *thd, Item* a, TR_table::field_id_t _trt_field, bool _backwards= false);
|
||||
Item_func_trt_id(THD *thd, Item* a, Item* b, TR_table::field_id_t _trt_field);
|
||||
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
switch (trt_field)
|
||||
{
|
||||
static LEX_CSTRING trx_name= {STRING_WITH_LEN("trt_trx_id") };
|
||||
static LEX_CSTRING commit_name= {STRING_WITH_LEN("trt_commit_id") };
|
||||
static LEX_CSTRING iso_name= {STRING_WITH_LEN("trt_iso_level") };
|
||||
|
||||
switch (trt_field) {
|
||||
case TR_table::FLD_TRX_ID:
|
||||
return "trt_trx_id";
|
||||
return trx_name;
|
||||
case TR_table::FLD_COMMIT_ID:
|
||||
return "trt_commit_id";
|
||||
return commit_name;
|
||||
case TR_table::FLD_ISO_LEVEL:
|
||||
return "trt_iso_level";
|
||||
return iso_name;
|
||||
default:
|
||||
DBUG_ASSERT(0);
|
||||
}
|
||||
return NULL;
|
||||
return NULL_clex_str;
|
||||
}
|
||||
|
||||
bool fix_length_and_dec()
|
||||
|
|
@ -119,9 +124,10 @@ class Item_func_trt_trx_sees : public Item_bool_func
|
|||
|
||||
public:
|
||||
Item_func_trt_trx_sees(THD *thd, Item* a, Item* b);
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "trt_trx_sees";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("trt_trx_sees") };
|
||||
return name;
|
||||
}
|
||||
longlong val_int();
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -137,9 +143,10 @@ class Item_func_trt_trx_sees_eq :
|
|||
{
|
||||
accept_eq= true;
|
||||
}
|
||||
const char *func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "trt_trx_sees_eq";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("trt_trx_sees_eq") };
|
||||
return name;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -99,13 +99,15 @@ Item_window_func::fix_fields(THD *thd, Item **ref)
|
|||
|
||||
if (window_spec->window_frame && is_frame_prohibited())
|
||||
{
|
||||
my_error(ER_NOT_ALLOWED_WINDOW_FRAME, MYF(0), window_func()->func_name());
|
||||
my_error(ER_NOT_ALLOWED_WINDOW_FRAME, MYF(0),
|
||||
window_func()->func_name());
|
||||
return true;
|
||||
}
|
||||
|
||||
if (window_spec->order_list->elements == 0 && is_order_list_mandatory())
|
||||
{
|
||||
my_error(ER_NO_ORDER_LIST_IN_WINDOW_SPEC, MYF(0), window_func()->func_name());
|
||||
my_error(ER_NO_ORDER_LIST_IN_WINDOW_SPEC, MYF(0),
|
||||
window_func()->func_name());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -180,7 +182,8 @@ bool Item_window_func::check_result_type_of_order_item()
|
|||
if (rtype != REAL_RESULT && rtype != INT_RESULT &&
|
||||
rtype != DECIMAL_RESULT && rtype != TIME_RESULT)
|
||||
{
|
||||
my_error(ER_WRONG_TYPE_FOR_PERCENTILE_FUNC, MYF(0), window_func()->func_name());
|
||||
my_error(ER_WRONG_TYPE_FOR_PERCENTILE_FUNC, MYF(0),
|
||||
window_func()->func_name());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -553,7 +556,7 @@ void Item_window_func::print(String *str, enum_query_type query_type)
|
|||
return;
|
||||
}
|
||||
window_func()->print(str, query_type);
|
||||
str->append(" over ");
|
||||
str->append(STRING_WITH_LEN(" over "));
|
||||
if (!window_spec)
|
||||
str->append(window_name);
|
||||
else
|
||||
|
|
@ -562,11 +565,11 @@ void Item_window_func::print(String *str, enum_query_type query_type)
|
|||
void Item_window_func::print_for_percentile_functions(String *str, enum_query_type query_type)
|
||||
{
|
||||
window_func()->print(str, query_type);
|
||||
str->append(" within group ");
|
||||
str->append(STRING_WITH_LEN(" within group "));
|
||||
str->append('(');
|
||||
window_spec->print_order(str,query_type);
|
||||
str->append(')');
|
||||
str->append(" over ");
|
||||
str->append(STRING_WITH_LEN(" over "));
|
||||
str->append('(');
|
||||
window_spec->print_partition(str,query_type);
|
||||
str->append(')');
|
||||
|
|
|
|||
|
|
@ -143,9 +143,10 @@ class Item_sum_row_number: public Item_sum_int
|
|||
{
|
||||
return count;
|
||||
}
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "row_number";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("row_number") };
|
||||
return name;
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -205,9 +206,10 @@ class Item_sum_rank: public Item_sum_int
|
|||
return RANK_FUNC;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "rank";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("rank") };
|
||||
return name;
|
||||
}
|
||||
|
||||
void setup_window_func(THD *thd, Window_spec *window_spec);
|
||||
|
|
@ -276,9 +278,10 @@ class Item_sum_dense_rank: public Item_sum_int
|
|||
return DENSE_RANK_FUNC;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "dense_rank";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("dense_rank") };
|
||||
return name;
|
||||
}
|
||||
|
||||
void setup_window_func(THD *thd, Window_spec *window_spec);
|
||||
|
|
@ -350,9 +353,10 @@ class Item_sum_first_value : public Item_sum_hybrid_simple
|
|||
return FIRST_VALUE_FUNC;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "first_value";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("first_value") };
|
||||
return name;
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -376,15 +380,17 @@ class Item_sum_last_value : public Item_sum_hybrid_simple
|
|||
return LAST_VALUE_FUNC;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "last_value";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("last_value") };
|
||||
return name;
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_last_value>(thd, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_sum_nth_value : public Item_sum_hybrid_simple
|
||||
{
|
||||
public:
|
||||
|
|
@ -396,15 +402,17 @@ class Item_sum_nth_value : public Item_sum_hybrid_simple
|
|||
return NTH_VALUE_FUNC;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "nth_value";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("nth_value") };
|
||||
return name;
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_nth_value>(thd, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_sum_lead : public Item_sum_hybrid_simple
|
||||
{
|
||||
public:
|
||||
|
|
@ -416,15 +424,17 @@ class Item_sum_lead : public Item_sum_hybrid_simple
|
|||
return LEAD_FUNC;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "lead";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("lead") };
|
||||
return name;
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_sum_lead>(thd, this); }
|
||||
};
|
||||
|
||||
|
||||
class Item_sum_lag : public Item_sum_hybrid_simple
|
||||
{
|
||||
public:
|
||||
|
|
@ -436,9 +446,10 @@ class Item_sum_lag : public Item_sum_hybrid_simple
|
|||
return LAG_FUNC;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "lag";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("lag") };
|
||||
return name;
|
||||
}
|
||||
|
||||
Item *get_copy(THD *thd)
|
||||
|
|
@ -523,9 +534,10 @@ class Item_sum_percent_rank: public Item_sum_double,
|
|||
return PERCENT_RANK_FUNC;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "percent_rank";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("percent_rank") };
|
||||
return name;
|
||||
}
|
||||
|
||||
void update_field() {}
|
||||
|
|
@ -618,9 +630,10 @@ class Item_sum_cume_dist: public Item_sum_double,
|
|||
partition_row_count_= 0;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "cume_dist";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("cume_dist") };
|
||||
return name;
|
||||
}
|
||||
|
||||
void update_field() {}
|
||||
|
|
@ -699,9 +712,10 @@ class Item_sum_ntile : public Item_sum_int,
|
|||
n_old_val_= 0;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "ntile";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("ntile") };
|
||||
return name;
|
||||
}
|
||||
|
||||
void update_field() {}
|
||||
|
|
@ -855,9 +869,10 @@ class Item_sum_percentile_disc : public Item_sum_num,
|
|||
current_row_count_= 0;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "percentile_disc";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("percentile_disc") };
|
||||
return name;
|
||||
}
|
||||
|
||||
void update_field() {}
|
||||
|
|
@ -994,9 +1009,10 @@ class Item_sum_percentile_cont : public Item_sum_double,
|
|||
current_row_count_= 0;
|
||||
}
|
||||
|
||||
const char*func_name() const
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return "percentile_cont";
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("percentile_cont") };
|
||||
return name;
|
||||
}
|
||||
void update_field() {}
|
||||
|
||||
|
|
@ -1357,7 +1373,11 @@ class Item_window_func : public Item_func_or_sum
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
const char* func_name() const { return "WF"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("WF") };
|
||||
return name;
|
||||
}
|
||||
|
||||
bool fix_fields(THD *thd, Item **ref);
|
||||
|
||||
|
|
|
|||
|
|
@ -198,7 +198,10 @@ class Item_nodeset_func :public Item_str_func
|
|||
const_item_cache= false;
|
||||
return FALSE;
|
||||
}
|
||||
const char *func_name() const { return "nodeset"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("nodeset") };
|
||||
}
|
||||
bool check_vcol_func_processor(void *arg)
|
||||
{
|
||||
return mark_unsupported_function(func_name(), arg, VCOL_IMPOSSIBLE);
|
||||
|
|
@ -213,7 +216,10 @@ class Item_nodeset_func_rootelement :public Item_nodeset_func
|
|||
public:
|
||||
Item_nodeset_func_rootelement(THD *thd, String *pxml):
|
||||
Item_nodeset_func(thd, pxml) {}
|
||||
const char *func_name() const { return "xpath_rootelement"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_rootelement") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_rootelement>(thd, this); }
|
||||
|
|
@ -226,7 +232,10 @@ class Item_nodeset_func_union :public Item_nodeset_func
|
|||
public:
|
||||
Item_nodeset_func_union(THD *thd, Item *a, Item *b, String *pxml):
|
||||
Item_nodeset_func(thd, a, b, pxml) {}
|
||||
const char *func_name() const { return "xpath_union"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_union") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_union>(thd, this); }
|
||||
|
|
@ -242,7 +251,10 @@ class Item_nodeset_func_axisbyname :public Item_nodeset_func
|
|||
Item_nodeset_func_axisbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func(thd, a, pxml), node_name(n_arg), node_namelen(l_arg) { }
|
||||
const char *func_name() const { return "xpath_axisbyname"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_axisbyname") };
|
||||
}
|
||||
bool validname(MY_XML_NODE *n)
|
||||
{
|
||||
if (node_name[0] == '*')
|
||||
|
|
@ -260,7 +272,10 @@ class Item_nodeset_func_selfbyname: public Item_nodeset_func_axisbyname
|
|||
Item_nodeset_func_selfbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
|
||||
const char *func_name() const { return "xpath_selfbyname"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_selfbyname") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_selfbyname>(thd, this); }
|
||||
|
|
@ -274,7 +289,10 @@ class Item_nodeset_func_childbyname: public Item_nodeset_func_axisbyname
|
|||
Item_nodeset_func_childbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
|
||||
const char *func_name() const { return "xpath_childbyname"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_childbyname") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_childbyname>(thd, this); }
|
||||
|
|
@ -290,7 +308,10 @@ class Item_nodeset_func_descendantbyname: public Item_nodeset_func_axisbyname
|
|||
String *pxml, bool need_self_arg):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml),
|
||||
need_self(need_self_arg) {}
|
||||
const char *func_name() const { return "xpath_descendantbyname"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_descendantbyname") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_descendantbyname>(thd, this); }
|
||||
|
|
@ -306,7 +327,10 @@ class Item_nodeset_func_ancestorbyname: public Item_nodeset_func_axisbyname
|
|||
String *pxml, bool need_self_arg):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml),
|
||||
need_self(need_self_arg) {}
|
||||
const char *func_name() const { return "xpath_ancestorbyname"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_ancestorbyname") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_ancestorbyname>(thd, this); }
|
||||
|
|
@ -320,7 +344,11 @@ class Item_nodeset_func_parentbyname: public Item_nodeset_func_axisbyname
|
|||
Item_nodeset_func_parentbyname(THD *thd, Item *a, const char *n_arg, uint l_arg,
|
||||
String *pxml):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
|
||||
const char *func_name() const { return "xpath_parentbyname"; }
|
||||
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_parentbyname") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_parentbyname>(thd, this); }
|
||||
|
|
@ -334,7 +362,10 @@ class Item_nodeset_func_attributebyname: public Item_nodeset_func_axisbyname
|
|||
Item_nodeset_func_attributebyname(THD *thd, Item *a, const char *n_arg,
|
||||
uint l_arg, String *pxml):
|
||||
Item_nodeset_func_axisbyname(thd, a, n_arg, l_arg, pxml) {}
|
||||
const char *func_name() const { return "xpath_attributebyname"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_attributebyname") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_attributebyname>(thd, this); }
|
||||
|
|
@ -351,7 +382,10 @@ class Item_nodeset_func_predicate :public Item_nodeset_func
|
|||
public:
|
||||
Item_nodeset_func_predicate(THD *thd, Item *a, Item *b, String *pxml):
|
||||
Item_nodeset_func(thd, a, b, pxml) {}
|
||||
const char *func_name() const { return "xpath_predicate"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_predicate") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_predicate>(thd, this); }
|
||||
|
|
@ -364,7 +398,10 @@ class Item_nodeset_func_elementbyindex :public Item_nodeset_func
|
|||
public:
|
||||
Item_nodeset_func_elementbyindex(THD *thd, Item *a, Item *b, String *pxml):
|
||||
Item_nodeset_func(thd, a, b, pxml) { }
|
||||
const char *func_name() const { return "xpath_elementbyindex"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_elementbyindex") };
|
||||
}
|
||||
bool val_native(THD *thd, Native *nodeset);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_nodeset_func_elementbyindex>(thd, this); }
|
||||
|
|
@ -384,7 +421,10 @@ class Item_xpath_cast_bool :public Item_bool_func
|
|||
public:
|
||||
Item_xpath_cast_bool(THD *thd, Item *a, String *pxml_arg):
|
||||
Item_bool_func(thd, a), pxml(pxml_arg) {}
|
||||
const char *func_name() const { return "xpath_cast_bool"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_cast_bool") };
|
||||
}
|
||||
longlong val_int()
|
||||
{
|
||||
if (args[0]->fixed_type_handler() == &type_handler_xpath_nodeset)
|
||||
|
|
@ -406,7 +446,10 @@ class Item_xpath_cast_number :public Item_real_func
|
|||
{
|
||||
public:
|
||||
Item_xpath_cast_number(THD *thd, Item *a): Item_real_func(thd, a) {}
|
||||
const char *func_name() const { return "xpath_cast_number"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_cast_number") };
|
||||
}
|
||||
virtual double val_real() { return args[0]->val_real(); }
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_xpath_cast_number>(thd, this); }
|
||||
|
|
@ -439,7 +482,10 @@ class Item_func_xpath_position :public Item_long_func
|
|||
public:
|
||||
Item_func_xpath_position(THD *thd, Item *a, String *p):
|
||||
Item_long_func(thd, a), pxml(p) {}
|
||||
const char *func_name() const { return "xpath_position"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_position") };
|
||||
}
|
||||
bool fix_length_and_dec() { max_length=10; return FALSE; }
|
||||
longlong val_int()
|
||||
{
|
||||
|
|
@ -460,7 +506,10 @@ class Item_func_xpath_count :public Item_long_func
|
|||
public:
|
||||
Item_func_xpath_count(THD *thd, Item *a, String *p):
|
||||
Item_long_func(thd, a), pxml(p) {}
|
||||
const char *func_name() const { return "xpath_count"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_count") };
|
||||
}
|
||||
bool fix_length_and_dec() { max_length=10; return FALSE; }
|
||||
longlong val_int()
|
||||
{
|
||||
|
|
@ -484,7 +533,10 @@ class Item_func_xpath_sum :public Item_real_func
|
|||
Item_func_xpath_sum(THD *thd, Item *a, String *p):
|
||||
Item_real_func(thd, a), pxml(p) {}
|
||||
|
||||
const char *func_name() const { return "xpath_sum"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_sum") };
|
||||
}
|
||||
double val_real()
|
||||
{
|
||||
double sum= 0;
|
||||
|
|
@ -556,7 +608,10 @@ class Item_nodeset_to_const_comparator :public Item_bool_func
|
|||
Item_nodeset_to_const_comparator(THD *thd, Item *nodeset, Item *cmpfunc,
|
||||
String *p):
|
||||
Item_bool_func(thd, nodeset, cmpfunc), pxml(p) {}
|
||||
const char *func_name() const { return "xpath_nodeset_to_const_comparator"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
return { STRING_WITH_LEN("xpath_nodeset_to_const_comparator") };
|
||||
}
|
||||
bool check_vcol_func_processor(void *arg)
|
||||
{
|
||||
return mark_unsupported_function(func_name(), arg, VCOL_IMPOSSIBLE);
|
||||
|
|
|
|||
|
|
@ -131,7 +131,11 @@ class Item_func_xml_extractvalue: public Item_xml_str_func
|
|||
public:
|
||||
Item_func_xml_extractvalue(THD *thd, Item *a, Item *b):
|
||||
Item_xml_str_func(thd, a, b) {}
|
||||
const char *func_name() const { return "extractvalue"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("extractvalue") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_xml_extractvalue>(thd, this); }
|
||||
|
|
@ -148,7 +152,11 @@ class Item_func_xml_update: public Item_xml_str_func
|
|||
public:
|
||||
Item_func_xml_update(THD *thd, Item *a, Item *b, Item *c):
|
||||
Item_xml_str_func(thd, a, b, c) {}
|
||||
const char *func_name() const { return "updatexml"; }
|
||||
LEX_CSTRING func_name_cstring() const override
|
||||
{
|
||||
static LEX_CSTRING name= {STRING_WITH_LEN("updatexml") };
|
||||
return name;
|
||||
}
|
||||
String *val_str(String *);
|
||||
Item *get_copy(THD *thd)
|
||||
{ return get_item_copy<Item_func_xml_update>(thd, this); }
|
||||
|
|
|
|||
|
|
@ -900,20 +900,26 @@ int Json_table_column::print(THD *thd, Field **f, String *str)
|
|||
switch (m_column_type)
|
||||
{
|
||||
case FOR_ORDINALITY:
|
||||
if (str->append("FOR ORDINALITY"))
|
||||
if (str->append(STRING_WITH_LEN("FOR ORDINALITY")))
|
||||
return 1;
|
||||
break;
|
||||
case EXISTS_PATH:
|
||||
case PATH:
|
||||
{
|
||||
static const LEX_CSTRING path= { STRING_WITH_LEN(" PATH ") };
|
||||
static const LEX_CSTRING exists_path= { STRING_WITH_LEN(" EXISTS PATH ") };
|
||||
|
||||
(*f)->sql_type(column_type);
|
||||
|
||||
if (str->append(column_type) ||
|
||||
((*f)->has_charset() && m_explicit_cs &&
|
||||
(str->append(" CHARSET ") || str->append(m_explicit_cs->csname))) ||
|
||||
str->append(m_column_type == PATH ? " PATH " : " EXISTS PATH ") ||
|
||||
(str->append(STRING_WITH_LEN(" CHARSET ")) ||
|
||||
str->append(m_explicit_cs->csname, strlen(m_explicit_cs->csname)))) ||
|
||||
str->append(m_column_type == PATH ? &path : &exists_path) ||
|
||||
print_path(str, &m_path))
|
||||
return 1;
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
if (m_on_empty.print("EMPTY", str) ||
|
||||
|
|
@ -977,7 +983,7 @@ int Json_table_column::On_response::respond(Json_table_column *jc, Field *f,
|
|||
|
||||
int Json_table_column::On_response::print(const char *name, String *str) const
|
||||
{
|
||||
const char *resp;
|
||||
LEX_CSTRING resp;
|
||||
const LEX_CSTRING *ds= NULL;
|
||||
if (m_response == Json_table_column::RESPONSE_NOT_SPECIFIED)
|
||||
return 0;
|
||||
|
|
@ -985,29 +991,28 @@ int Json_table_column::On_response::print(const char *name, String *str) const
|
|||
switch (m_response)
|
||||
{
|
||||
case Json_table_column::RESPONSE_NULL:
|
||||
resp= "NULL";
|
||||
lex_string_set3(&resp, STRING_WITH_LEN("NULL"));
|
||||
break;
|
||||
case Json_table_column::RESPONSE_ERROR:
|
||||
resp= "ERROR";
|
||||
lex_string_set3(&resp, STRING_WITH_LEN("ERROR"));
|
||||
break;
|
||||
case Json_table_column::RESPONSE_DEFAULT:
|
||||
{
|
||||
resp= "DEFAULT";
|
||||
lex_string_set3(&resp, STRING_WITH_LEN("DEFAULT"));
|
||||
ds= &m_default;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
resp= NULL;
|
||||
lex_string_set3(&resp, "", 0);
|
||||
DBUG_ASSERT(FALSE); /* should never happen. */
|
||||
}
|
||||
|
||||
return
|
||||
(str->append(' ') || str->append(resp) ||
|
||||
(ds && (str->append(" '") ||
|
||||
str->append_for_single_quote(ds->str, ds->length) ||
|
||||
str->append('\''))) ||
|
||||
str->append(" ON ") ||
|
||||
str->append(name));
|
||||
return (str->append(' ') || str->append(resp) ||
|
||||
(ds && (str->append(STRING_WITH_LEN(" '")) ||
|
||||
str->append_for_single_quote(ds->str, ds->length) ||
|
||||
str->append('\''))) ||
|
||||
str->append(STRING_WITH_LEN(" ON ")) ||
|
||||
str->append(name, strlen(name)));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1178,7 +1183,7 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
|
|||
Json_table_column *jc= *last_column;
|
||||
bool first_column= TRUE;
|
||||
|
||||
if (str->append("COLUMNS ("))
|
||||
if (str->append(STRING_WITH_LEN("COLUMNS (")))
|
||||
return 1;
|
||||
|
||||
/* loop while jc belongs to the current or nested paths. */
|
||||
|
|
@ -1187,7 +1192,7 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
|
|||
{
|
||||
if (first_column)
|
||||
first_column= FALSE;
|
||||
else if (str->append(", "))
|
||||
else if (str->append(STRING_WITH_LEN(", ")))
|
||||
return 1;
|
||||
|
||||
if (jc->m_nest == c_path)
|
||||
|
|
@ -1200,7 +1205,7 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
|
|||
else
|
||||
{
|
||||
DBUG_ASSERT(column_in_this_or_nested(c_nested, jc));
|
||||
if (str->append("NESTED PATH ") ||
|
||||
if (str->append(STRING_WITH_LEN("NESTED PATH ")) ||
|
||||
print_path(str, &jc->m_nest->m_path) ||
|
||||
str->append(' ') ||
|
||||
c_nested->print(thd, f, str, it, &jc))
|
||||
|
|
@ -1209,7 +1214,7 @@ int Json_table_nested_path::print(THD *thd, Field ***f, String *str,
|
|||
}
|
||||
}
|
||||
|
||||
if (str->append(")"))
|
||||
if (str->append(STRING_WITH_LEN(")")))
|
||||
return 1;
|
||||
|
||||
*last_column= jc;
|
||||
|
|
@ -1235,12 +1240,12 @@ int Table_function_json_table::print(THD *thd, TABLE_LIST *sql_table,
|
|||
|
||||
DBUG_ENTER("Table_function_json_table::print");
|
||||
|
||||
if (str->append("JSON_TABLE("))
|
||||
if (str->append(STRING_WITH_LEN("JSON_TABLE(")))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
m_json->print(str, query_type);
|
||||
|
||||
if (str->append(", ") ||
|
||||
if (str->append(STRING_WITH_LEN(", ")) ||
|
||||
print_path(str, &m_nested_path.m_path) ||
|
||||
str->append(' ') ||
|
||||
m_nested_path.print(thd, &f_list, str, jc_i, &jc) ||
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ void field_unpack(String *to, Field *field, const uchar *rec, uint max_length,
|
|||
{
|
||||
if (field->is_null())
|
||||
{
|
||||
to->append(STRING_WITH_LEN("NULL"));
|
||||
to->append(NULL_clex_str);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
CHARSET_INFO *cs= field->charset();
|
||||
|
|
@ -434,7 +434,7 @@ void key_unpack(String *to, TABLE *table, KEY *key)
|
|||
{
|
||||
if (table->record[0][key_part->null_offset] & key_part->null_bit)
|
||||
{
|
||||
to->append(STRING_WITH_LEN("NULL"));
|
||||
to->append(NULL_clex_str);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -517,6 +517,7 @@ int append_query_string(CHARSET_INFO *csinfo, String *to,
|
|||
const char *str, size_t len, bool no_backslash)
|
||||
{
|
||||
char *beg, *ptr;
|
||||
my_bool overflow;
|
||||
uint32 const orig_len= to->length();
|
||||
if (to->reserve(orig_len + len * 2 + 4))
|
||||
return 1;
|
||||
|
|
@ -530,7 +531,7 @@ int append_query_string(CHARSET_INFO *csinfo, String *to,
|
|||
*ptr++= '\'';
|
||||
if (!no_backslash)
|
||||
{
|
||||
ptr+= escape_string_for_mysql(csinfo, ptr, 0, str, len);
|
||||
ptr+= escape_string_for_mysql(csinfo, ptr, 0, str, len, &overflow);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -660,7 +661,7 @@ Log_event::do_shall_skip(rpl_group_info *rgi)
|
|||
|
||||
void Log_event::pack_info(Protocol *protocol)
|
||||
{
|
||||
protocol->store("", &my_charset_bin);
|
||||
protocol->store("", 0, &my_charset_bin);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -675,7 +676,7 @@ int Log_event::net_send(Protocol *protocol, const char* log_name, my_off_t pos)
|
|||
log_name = p + 1;
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(log_name, &my_charset_bin);
|
||||
protocol->store(log_name, strlen(log_name), &my_charset_bin);
|
||||
protocol->store((ulonglong) pos);
|
||||
event_type = get_type_str();
|
||||
protocol->store(event_type, strlen(event_type), &my_charset_bin);
|
||||
|
|
@ -4132,9 +4133,9 @@ static bool
|
|||
user_var_append_name_part(THD *thd, String *buf,
|
||||
const char *name, size_t name_len)
|
||||
{
|
||||
return buf->append("@") ||
|
||||
return buf->append('@') ||
|
||||
append_identifier(thd, buf, name, name_len) ||
|
||||
buf->append("=");
|
||||
buf->append('=');
|
||||
}
|
||||
|
||||
void User_var_log_event::pack_info(Protocol* protocol)
|
||||
|
|
@ -4145,7 +4146,7 @@ void User_var_log_event::pack_info(Protocol* protocol)
|
|||
String buf(buf_mem, sizeof(buf_mem), system_charset_info);
|
||||
buf.length(0);
|
||||
if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
|
||||
buf.append("NULL"))
|
||||
buf.append(NULL_clex_str))
|
||||
return;
|
||||
protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
|
||||
}
|
||||
|
|
@ -4190,9 +4191,10 @@ void User_var_log_event::pack_info(Protocol* protocol)
|
|||
buf.length(0);
|
||||
my_decimal((const uchar *) (val + 2), val[0], val[1]).to_string(&str);
|
||||
if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
|
||||
buf.append(buf2))
|
||||
buf.append(str))
|
||||
return;
|
||||
protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
|
||||
|
||||
break;
|
||||
}
|
||||
case STRING_RESULT:
|
||||
|
|
@ -4204,7 +4206,7 @@ void User_var_log_event::pack_info(Protocol* protocol)
|
|||
buf.length(0);
|
||||
if (!(cs= get_charset(charset_number, MYF(0))))
|
||||
{
|
||||
if (buf.append("???"))
|
||||
if (buf.append(STRING_WITH_LEN("???")))
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
|
@ -4212,9 +4214,9 @@ void User_var_log_event::pack_info(Protocol* protocol)
|
|||
size_t old_len;
|
||||
char *beg, *end;
|
||||
if (user_var_append_name_part(protocol->thd, &buf, name, name_len) ||
|
||||
buf.append("_") ||
|
||||
buf.append(cs->csname) ||
|
||||
buf.append(" "))
|
||||
buf.append('_') ||
|
||||
buf.append(cs->csname, strlen(cs->csname)) ||
|
||||
buf.append(' '))
|
||||
return;
|
||||
old_len= buf.length();
|
||||
if (buf.reserve(old_len + val_len * 2 + 3 + sizeof(" COLLATE ") +
|
||||
|
|
@ -4223,8 +4225,8 @@ void User_var_log_event::pack_info(Protocol* protocol)
|
|||
beg= const_cast<char *>(buf.ptr()) + old_len;
|
||||
end= str_to_hex(beg, val, val_len);
|
||||
buf.length(old_len + (end - beg));
|
||||
if (buf.append(" COLLATE ") ||
|
||||
buf.append(cs->name))
|
||||
if (buf.append(STRING_WITH_LEN(" COLLATE ")) ||
|
||||
buf.append(cs->name, strlen(cs->name)))
|
||||
return;
|
||||
}
|
||||
protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
|
||||
|
|
@ -5028,7 +5030,7 @@ void Execute_load_query_log_event::pack_info(Protocol *protocol)
|
|||
}
|
||||
if (query && q_len && buf.append(query, q_len))
|
||||
return;
|
||||
if (buf.append(" ;file_id=") ||
|
||||
if (buf.append(STRING_WITH_LEN(" ;file_id=")) ||
|
||||
buf.append_ulonglong(file_id))
|
||||
return;
|
||||
protocol->store(buf.ptr(), buf.length(), &my_charset_bin);
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ void Json_writer::start_object()
|
|||
if (!element_started)
|
||||
start_element();
|
||||
|
||||
output.append("{");
|
||||
output.append('{');
|
||||
indent_level+=INDENT_SIZE;
|
||||
first_child=true;
|
||||
element_started= false;
|
||||
|
|
@ -48,7 +48,7 @@ void Json_writer::start_array()
|
|||
if (!element_started)
|
||||
start_element();
|
||||
|
||||
output.append("[");
|
||||
output.append('[');
|
||||
indent_level+=INDENT_SIZE;
|
||||
first_child=true;
|
||||
element_started= false;
|
||||
|
|
@ -62,7 +62,7 @@ void Json_writer::end_object()
|
|||
if (!first_child)
|
||||
append_indent();
|
||||
first_child= false;
|
||||
output.append("}");
|
||||
output.append('}');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ void Json_writer::end_array()
|
|||
indent_level-=INDENT_SIZE;
|
||||
if (!first_child)
|
||||
append_indent();
|
||||
output.append("]");
|
||||
output.append(']');
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ Json_writer& Json_writer::add_member(const char *name, size_t len)
|
|||
|
||||
output.append('"');
|
||||
output.append(name, len);
|
||||
output.append("\": ");
|
||||
output.append(STRING_WITH_LEN("\": "));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
@ -376,13 +376,13 @@ void Single_line_formatting_helper::flush_on_one_line()
|
|||
{
|
||||
owner->output.append('"');
|
||||
owner->output.append(str);
|
||||
owner->output.append("\": ");
|
||||
owner->output.append(STRING_WITH_LEN("\": "));
|
||||
owner->output.append('[');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (nr != 1)
|
||||
owner->output.append(", ");
|
||||
owner->output.append(STRING_WITH_LEN(", "));
|
||||
owner->output.append('"');
|
||||
owner->output.append(str);
|
||||
owner->output.append('"');
|
||||
|
|
|
|||
|
|
@ -268,6 +268,8 @@ extern MYSQL_PLUGIN_IMPORT const char *my_localhost;
|
|||
extern MYSQL_PLUGIN_IMPORT const char **errmesg; /* Error messages */
|
||||
extern const char *myisam_recover_options_str;
|
||||
extern const LEX_CSTRING in_left_expr_name, in_additional_cond, in_having_cond;
|
||||
extern const LEX_CSTRING NULL_clex_str;
|
||||
extern const LEX_CSTRING error_clex_str;
|
||||
extern SHOW_VAR status_vars[];
|
||||
extern struct system_variables max_system_variables;
|
||||
extern struct system_status_var global_status_var;
|
||||
|
|
|
|||
|
|
@ -16052,7 +16052,7 @@ print_sel_arg_key(Field *field, const uchar *key, String *out)
|
|||
{
|
||||
if (*key)
|
||||
{
|
||||
out->append("NULL");
|
||||
out->append(STRING_WITH_LEN("NULL"));
|
||||
goto end;
|
||||
}
|
||||
key++; // Skip null byte
|
||||
|
|
@ -16085,15 +16085,16 @@ const char *dbug_print_sel_arg(SEL_ARG *sel_arg)
|
|||
{
|
||||
StringBuffer<64> buf;
|
||||
String &out= dbug_print_sel_arg_buf;
|
||||
LEX_CSTRING tmp;
|
||||
out.length(0);
|
||||
|
||||
if (!sel_arg)
|
||||
{
|
||||
out.append("NULL");
|
||||
out.append(STRING_WITH_LEN("NULL"));
|
||||
goto end;
|
||||
}
|
||||
|
||||
out.append("SEL_ARG(");
|
||||
out.append(STRING_WITH_LEN("SEL_ARG("));
|
||||
|
||||
const char *stype;
|
||||
switch(sel_arg->type) {
|
||||
|
|
@ -16113,34 +16114,42 @@ const char *dbug_print_sel_arg(SEL_ARG *sel_arg)
|
|||
|
||||
if (stype)
|
||||
{
|
||||
out.append("type=");
|
||||
out.append(stype);
|
||||
out.append(STRING_WITH_LEN("type="));
|
||||
out.append(stype, strlen(stype));
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (sel_arg->min_flag & NO_MIN_RANGE)
|
||||
out.append("-inf");
|
||||
out.append(STRING_WITH_LEN("-inf"));
|
||||
else
|
||||
{
|
||||
print_sel_arg_key(sel_arg->field, sel_arg->min_value, &buf);
|
||||
out.append(buf);
|
||||
}
|
||||
|
||||
out.append((sel_arg->min_flag & NEAR_MIN)? "<" : "<=");
|
||||
if (sel_arg->min_flag & NEAR_MIN)
|
||||
lex_string_set3(&tmp, "<", 1);
|
||||
else
|
||||
lex_string_set3(&tmp, "<=", 2);
|
||||
out.append(&tmp);
|
||||
|
||||
out.append(sel_arg->field->field_name);
|
||||
|
||||
out.append((sel_arg->max_flag & NEAR_MAX)? "<" : "<=");
|
||||
if (sel_arg->min_flag & NEAR_MAX)
|
||||
lex_string_set3(&tmp, "<", 1);
|
||||
else
|
||||
lex_string_set3(&tmp, "<=", 2);
|
||||
out.append(&tmp);
|
||||
|
||||
if (sel_arg->max_flag & NO_MAX_RANGE)
|
||||
out.append("+inf");
|
||||
out.append(STRING_WITH_LEN("+inf"));
|
||||
else
|
||||
{
|
||||
print_sel_arg_key(sel_arg->field, sel_arg->max_value, &buf);
|
||||
out.append(buf);
|
||||
}
|
||||
|
||||
out.append(")");
|
||||
out.append(')');
|
||||
|
||||
end:
|
||||
return dbug_print_sel_arg_buf.c_ptr_safe();
|
||||
|
|
|
|||
|
|
@ -1344,9 +1344,9 @@ bool Protocol::send_result_set_row(List<Item> *row_items)
|
|||
|
||||
|
||||
/**
|
||||
Send \\0 end terminated string.
|
||||
Send \\0 end terminated string or NULL
|
||||
|
||||
@param from NullS or \\0 terminated string
|
||||
@param from NullS or \\0 terminated string
|
||||
|
||||
@note
|
||||
In most cases one should use store(from, length) instead of this function
|
||||
|
|
@ -1357,12 +1357,11 @@ bool Protocol::send_result_set_row(List<Item> *row_items)
|
|||
1 error
|
||||
*/
|
||||
|
||||
bool Protocol::store(const char *from, CHARSET_INFO *cs)
|
||||
bool Protocol::store_string_or_null(const char *from, CHARSET_INFO *cs)
|
||||
{
|
||||
if (!from)
|
||||
return store_null();
|
||||
size_t length= strlen(from);
|
||||
return store(from, length, cs);
|
||||
return store(from, strlen(from), cs);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1381,7 +1380,7 @@ bool Protocol::store(I_List<i_string>* str_list)
|
|||
tmp.length(0);
|
||||
while ((s=it++))
|
||||
{
|
||||
tmp.append(s->ptr);
|
||||
tmp.append(s->ptr, strlen(s->ptr));
|
||||
tmp.append(',');
|
||||
}
|
||||
if ((len= tmp.length()))
|
||||
|
|
|
|||
|
|
@ -99,7 +99,12 @@ class Protocol
|
|||
bool send_result_set_row(List<Item> *row_items);
|
||||
|
||||
bool store(I_List<i_string> *str_list);
|
||||
bool store(const char *from, CHARSET_INFO *cs);
|
||||
/* This will be deleted in future commit */
|
||||
bool store(const char *from, CHARSET_INFO *cs)
|
||||
{
|
||||
return store_string_or_null(from, cs);
|
||||
}
|
||||
bool store_string_or_null(const char *from, CHARSET_INFO *cs);
|
||||
bool store_warning(const char *from, size_t length);
|
||||
String *storage_packet() { return packet; }
|
||||
inline void free() { packet->free(); }
|
||||
|
|
@ -114,6 +119,10 @@ class Protocol
|
|||
{ return store_longlong((longlong) from, 1); }
|
||||
inline bool store(String *str)
|
||||
{ return store((char*) str->ptr(), str->length(), str->charset()); }
|
||||
inline bool store(const LEX_CSTRING *from, CHARSET_INFO *cs)
|
||||
{
|
||||
return store(from->str, from->length, cs);
|
||||
}
|
||||
|
||||
virtual bool prepare_for_send(uint num_columns)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -183,11 +183,11 @@ static my_bool show_slave_hosts_callback(THD *thd, Protocol *protocol)
|
|||
{
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(si->server_id);
|
||||
protocol->store(si->host, &my_charset_bin);
|
||||
protocol->store(si->host, strlen(si->host), &my_charset_bin);
|
||||
if (opt_show_slave_auth_info)
|
||||
{
|
||||
protocol->store(si->user, &my_charset_bin);
|
||||
protocol->store(si->password, &my_charset_bin);
|
||||
protocol->store(si->user, safe_strlen(si->user), &my_charset_bin);
|
||||
protocol->store(si->password, safe_strlen(si->password), &my_charset_bin);
|
||||
}
|
||||
protocol->store((uint32) si->port);
|
||||
protocol->store(si->master_id);
|
||||
|
|
|
|||
|
|
@ -805,7 +805,7 @@ Rpl_filter::db_rule_ent_list_to_str(String* str, I_List<i_string>* list)
|
|||
|
||||
while ((s= it++))
|
||||
{
|
||||
str->append(s->ptr);
|
||||
str->append(s->ptr, strlen(s->ptr));
|
||||
str->append(',');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1037,13 +1037,13 @@ rpl_slave_state_tostring_helper(String *dest, const rpl_gtid *gtid, bool *first)
|
|||
if (*first)
|
||||
*first= false;
|
||||
else
|
||||
if (dest->append(",",1))
|
||||
if (dest->append(','))
|
||||
return true;
|
||||
return
|
||||
dest->append_ulonglong(gtid->domain_id) ||
|
||||
dest->append("-",1) ||
|
||||
dest->append('-') ||
|
||||
dest->append_ulonglong(gtid->server_id) ||
|
||||
dest->append("-",1) ||
|
||||
dest->append('-') ||
|
||||
dest->append_ulonglong(gtid->seq_no);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1971,15 +1971,16 @@ void prot_store_ids(THD *thd, DYNAMIC_ARRAY *ids)
|
|||
break the loop whenever remained space could not fit
|
||||
ellipses on the next cycle
|
||||
*/
|
||||
sprintf(dbuff + cur_len, "...");
|
||||
cur_len+= sprintf(dbuff + cur_len, "...");
|
||||
break;
|
||||
}
|
||||
cur_len += sprintf(buff + cur_len, "%s", dbuff);
|
||||
cur_len+= sprintf(buff + cur_len, "%s", dbuff);
|
||||
}
|
||||
thd->protocol->store(buff, &my_charset_bin);
|
||||
thd->protocol->store(buff, cur_len, &my_charset_bin);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
bool Master_info_index::flush_all_relay_logs()
|
||||
{
|
||||
DBUG_ENTER("flush_all_relay_logs");
|
||||
|
|
|
|||
|
|
@ -1218,12 +1218,14 @@ int fill_sysvars(THD *thd, TABLE_LIST *tables, COND *cond)
|
|||
{
|
||||
uint i;
|
||||
strbuf.length(0);
|
||||
for (i=0; i + 1 < tl->count; i++)
|
||||
for (i=0; i < tl->count; i++)
|
||||
{
|
||||
strbuf.append(tl->type_names[i]);
|
||||
const char *name= tl->type_names[i];
|
||||
strbuf.append(name, strlen(name));
|
||||
strbuf.append(',');
|
||||
}
|
||||
strbuf.append(tl->type_names[i]);
|
||||
if (!strbuf.is_empty())
|
||||
strbuf.chop();
|
||||
fields[11]->set_notnull();
|
||||
fields[11]->store(strbuf.ptr(), strbuf.length(), scs);
|
||||
}
|
||||
|
|
|
|||
116
sql/slave.cc
116
sql/slave.cc
|
|
@ -315,9 +315,11 @@ build_gtid_pos_create_query(THD *thd, String *query,
|
|||
LEX_CSTRING *engine_name)
|
||||
{
|
||||
bool err= false;
|
||||
err|= query->append(gtid_pos_table_definition1);
|
||||
err|= query->append(gtid_pos_table_definition1,
|
||||
sizeof(gtid_pos_table_definition1)-1);
|
||||
err|= append_identifier(thd, query, table_name);
|
||||
err|= query->append(gtid_pos_table_definition2);
|
||||
err|= query->append(gtid_pos_table_definition2,
|
||||
sizeof(gtid_pos_table_definition2)-1);
|
||||
err|= append_identifier(thd, query, engine_name);
|
||||
return err;
|
||||
}
|
||||
|
|
@ -2540,15 +2542,20 @@ when it try to get the value of TIME_ZONE global variable from master.";
|
|||
char quote_buf[2*sizeof(mi->master_log_name)+1];
|
||||
char str_buf[28+2*sizeof(mi->master_log_name)+10];
|
||||
String query(str_buf, sizeof(str_buf), system_charset_info);
|
||||
size_t quote_length;
|
||||
my_bool overflow;
|
||||
query.length(0);
|
||||
|
||||
query.append("SELECT binlog_gtid_pos('");
|
||||
escape_quotes_for_mysql(&my_charset_bin, quote_buf, sizeof(quote_buf),
|
||||
mi->master_log_name, strlen(mi->master_log_name));
|
||||
query.append(quote_buf);
|
||||
query.append("',");
|
||||
query.append(STRING_WITH_LEN("SELECT binlog_gtid_pos('"));
|
||||
quote_length= escape_quotes_for_mysql(&my_charset_bin, quote_buf,
|
||||
sizeof(quote_buf),
|
||||
mi->master_log_name,
|
||||
strlen(mi->master_log_name),
|
||||
&overflow);
|
||||
query.append(quote_buf, quote_length);
|
||||
query.append(STRING_WITH_LEN("',"));
|
||||
query.append_ulonglong(mi->master_log_pos);
|
||||
query.append(")");
|
||||
query.append(')');
|
||||
|
||||
if (!mysql_real_query(mysql, query.c_ptr_safe(), query.length()) &&
|
||||
(master_res= mysql_store_result(mysql)) &&
|
||||
|
|
@ -3114,7 +3121,20 @@ void show_master_info_get_fields(THD *thd, List<Item> *field_list,
|
|||
}
|
||||
|
||||
/* Text for Slave_IO_Running */
|
||||
static const char *slave_running[]= { "No", "Connecting", "Preparing", "Yes" };
|
||||
static const LEX_CSTRING slave_running[]=
|
||||
{
|
||||
{ STRING_WITH_LEN("No") },
|
||||
{ STRING_WITH_LEN("Connecting") },
|
||||
{ STRING_WITH_LEN("Preparing") },
|
||||
{ STRING_WITH_LEN("Yes") }
|
||||
};
|
||||
|
||||
static const LEX_CSTRING msg_yes= { STRING_WITH_LEN("Yes") };
|
||||
static const LEX_CSTRING msg_no= { STRING_WITH_LEN("No") };
|
||||
#ifndef HAVE_OPENSSL
|
||||
static const LEX_CSTRING msg_ignored= { STRING_WITH_LEN("Ignored") };
|
||||
#endif
|
||||
|
||||
|
||||
static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
|
||||
String *gtid_pos)
|
||||
|
|
@ -3128,6 +3148,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
|
|||
Protocol *protocol= thd->protocol;
|
||||
Rpl_filter *rpl_filter= mi->rpl_filter;
|
||||
StringBuffer<256> tmp;
|
||||
const char *msg;
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
|
||||
|
|
@ -3145,11 +3166,13 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
|
|||
Show what the sql driver replication thread is doing
|
||||
This is only meaningful if there is only one slave thread.
|
||||
*/
|
||||
protocol->store(mi->rli.sql_driver_thd ?
|
||||
mi->rli.sql_driver_thd->get_proc_info() : "",
|
||||
&my_charset_bin);
|
||||
msg= (mi->rli.sql_driver_thd ?
|
||||
mi->rli.sql_driver_thd->get_proc_info() : "");
|
||||
protocol->store_string_or_null(msg, &my_charset_bin);
|
||||
}
|
||||
protocol->store(mi->io_thd ? mi->io_thd->get_proc_info() : "", &my_charset_bin);
|
||||
msg= mi->io_thd ? mi->io_thd->get_proc_info() : "";
|
||||
protocol->store_string_or_null(msg, &my_charset_bin);
|
||||
|
||||
mysql_mutex_unlock(&mi->run_lock);
|
||||
|
||||
mysql_mutex_lock(&mi->data_lock);
|
||||
|
|
@ -3158,19 +3181,22 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
|
|||
mysql_mutex_lock(&mi->err_lock);
|
||||
/* err_lock is to protect mi->rli.last_error() */
|
||||
mysql_mutex_lock(&mi->rli.err_lock);
|
||||
protocol->store(mi->host, &my_charset_bin);
|
||||
protocol->store(mi->user, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->host, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->user, &my_charset_bin);
|
||||
protocol->store((uint32) mi->port);
|
||||
protocol->store((uint32) mi->connect_retry);
|
||||
protocol->store(mi->master_log_name, &my_charset_bin);
|
||||
protocol->store((ulonglong) mi->master_log_pos);
|
||||
protocol->store(mi->rli.group_relay_log_name +
|
||||
dirname_length(mi->rli.group_relay_log_name),
|
||||
protocol->store(mi->master_log_name, strlen(mi->master_log_name),
|
||||
&my_charset_bin);
|
||||
protocol->store((ulonglong) mi->master_log_pos);
|
||||
msg= (mi->rli.group_relay_log_name +
|
||||
dirname_length(mi->rli.group_relay_log_name));
|
||||
protocol->store(msg, strlen(msg), &my_charset_bin);
|
||||
protocol->store((ulonglong) mi->rli.group_relay_log_pos);
|
||||
protocol->store(mi->rli.group_master_log_name, &my_charset_bin);
|
||||
protocol->store(slave_running[mi->slave_running], &my_charset_bin);
|
||||
protocol->store(mi->rli.slave_running ? "Yes":"No", &my_charset_bin);
|
||||
protocol->store(mi->rli.group_master_log_name,
|
||||
strlen(mi->rli.group_master_log_name),
|
||||
&my_charset_bin);
|
||||
protocol->store(&slave_running[mi->slave_running], &my_charset_bin);
|
||||
protocol->store(mi->rli.slave_running ? &msg_yes : &msg_no, &my_charset_bin);
|
||||
protocol->store(rpl_filter->get_do_db());
|
||||
protocol->store(rpl_filter->get_ignore_db());
|
||||
|
||||
|
|
@ -3184,29 +3210,30 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
|
|||
protocol->store(&tmp);
|
||||
|
||||
protocol->store(mi->rli.last_error().number);
|
||||
protocol->store(mi->rli.last_error().message, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->rli.last_error().message,
|
||||
&my_charset_bin);
|
||||
protocol->store((uint32) mi->rli.slave_skip_counter);
|
||||
protocol->store((ulonglong) mi->rli.group_master_log_pos);
|
||||
protocol->store((ulonglong) mi->rli.log_space_total);
|
||||
|
||||
protocol->store(
|
||||
mi->rli.until_condition==Relay_log_info::UNTIL_NONE ? "None":
|
||||
( mi->rli.until_condition==Relay_log_info::UNTIL_MASTER_POS? "Master":
|
||||
( mi->rli.until_condition==Relay_log_info::UNTIL_RELAY_POS? "Relay":
|
||||
"Gtid")), &my_charset_bin);
|
||||
protocol->store(mi->rli.until_log_name, &my_charset_bin);
|
||||
msg= (mi->rli.until_condition==Relay_log_info::UNTIL_NONE ? "None" :
|
||||
(mi->rli.until_condition==Relay_log_info::UNTIL_MASTER_POS? "Master":
|
||||
(mi->rli.until_condition==Relay_log_info::UNTIL_RELAY_POS? "Relay":
|
||||
"Gtid")));
|
||||
protocol->store(msg, strlen(msg), &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->rli.until_log_name, &my_charset_bin);
|
||||
protocol->store((ulonglong) mi->rli.until_log_pos);
|
||||
|
||||
#ifdef HAVE_OPENSSL
|
||||
protocol->store(mi->ssl? "Yes":"No", &my_charset_bin);
|
||||
protocol->store(mi->ssl ? &msg_yes : &msg_no, &my_charset_bin);
|
||||
#else
|
||||
protocol->store(mi->ssl? "Ignored":"No", &my_charset_bin);
|
||||
protocol->store(mi->ssl ? &msg_ignored: &msg_no, &my_charset_bin);
|
||||
#endif
|
||||
protocol->store(mi->ssl_ca, &my_charset_bin);
|
||||
protocol->store(mi->ssl_capath, &my_charset_bin);
|
||||
protocol->store(mi->ssl_cert, &my_charset_bin);
|
||||
protocol->store(mi->ssl_cipher, &my_charset_bin);
|
||||
protocol->store(mi->ssl_key, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->ssl_ca, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->ssl_capath, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->ssl_cert, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->ssl_cipher, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->ssl_key, &my_charset_bin);
|
||||
|
||||
/*
|
||||
Seconds_Behind_Master: if SQL thread is running and I/O thread is
|
||||
|
|
@ -3261,27 +3288,30 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
|
|||
{
|
||||
protocol->store_null();
|
||||
}
|
||||
protocol->store(mi->ssl_verify_server_cert? "Yes":"No", &my_charset_bin);
|
||||
protocol->store(mi->ssl_verify_server_cert? &msg_yes : &msg_no,
|
||||
&my_charset_bin);
|
||||
|
||||
// Last_IO_Errno
|
||||
protocol->store(mi->last_error().number);
|
||||
// Last_IO_Error
|
||||
protocol->store(mi->last_error().message, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->last_error().message, &my_charset_bin);
|
||||
// Last_SQL_Errno
|
||||
protocol->store(mi->rli.last_error().number);
|
||||
// Last_SQL_Error
|
||||
protocol->store(mi->rli.last_error().message, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->rli.last_error().message,
|
||||
&my_charset_bin);
|
||||
// Replicate_Ignore_Server_Ids
|
||||
prot_store_ids(thd, &mi->ignore_server_ids);
|
||||
// Master_Server_id
|
||||
protocol->store((uint32) mi->master_id);
|
||||
// SQL_Delay
|
||||
// Master_Ssl_Crl
|
||||
protocol->store(mi->ssl_ca, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->ssl_ca, &my_charset_bin);
|
||||
// Master_Ssl_Crlpath
|
||||
protocol->store(mi->ssl_capath, &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->ssl_capath, &my_charset_bin);
|
||||
// Using_Gtid
|
||||
protocol->store(mi->using_gtid_astext(mi->using_gtid), &my_charset_bin);
|
||||
protocol->store_string_or_null(mi->using_gtid_astext(mi->using_gtid),
|
||||
&my_charset_bin);
|
||||
// Gtid_IO_Pos
|
||||
{
|
||||
mi->gtid_current_pos.to_string(&tmp);
|
||||
|
|
@ -3312,7 +3342,7 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full,
|
|||
else
|
||||
protocol->store_null();
|
||||
// Slave_SQL_Running_State
|
||||
protocol->store(slave_sql_running_state, &my_charset_bin);
|
||||
protocol->store_string_or_null(slave_sql_running_state, &my_charset_bin);
|
||||
|
||||
protocol->store(mi->total_ddl_groups);
|
||||
protocol->store(mi->total_non_trans_groups);
|
||||
|
|
|
|||
10
sql/sp.cc
10
sql/sp.cc
|
|
@ -1075,12 +1075,14 @@ sp_returns_type(THD *thd, String &result, const sp_head *sp)
|
|||
|
||||
if (field->has_charset())
|
||||
{
|
||||
const char *name= field->charset()->csname;
|
||||
result.append(STRING_WITH_LEN(" CHARSET "));
|
||||
result.append(field->charset()->csname);
|
||||
result.append(name, strlen(name));
|
||||
if (!(field->charset()->state & MY_CS_PRIMARY))
|
||||
{
|
||||
name= field->charset()->name;
|
||||
result.append(STRING_WITH_LEN(" COLLATE "));
|
||||
result.append(field->charset()->name);
|
||||
result.append(name, strlen(name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1553,7 +1555,7 @@ Sp_handler_package::show_create_sp(THD *thd, String *buf,
|
|||
buf->append(STRING_WITH_LEN("OR REPLACE "))) ||
|
||||
append_definer(thd, buf, &definer.user, &definer.host) ||
|
||||
buf->append(type_lex_cstring()) ||
|
||||
buf->append(" ", 1) ||
|
||||
buf->append(' ') ||
|
||||
(ddl_options.if_not_exists() &&
|
||||
buf->append(STRING_WITH_LEN("IF NOT EXISTS "))) ||
|
||||
(db.length > 0 &&
|
||||
|
|
@ -1561,7 +1563,7 @@ Sp_handler_package::show_create_sp(THD *thd, String *buf,
|
|||
buf->append('.'))) ||
|
||||
append_identifier(thd, buf, name.str, name.length) ||
|
||||
append_package_chistics(buf, chistics) ||
|
||||
buf->append(" ", 1) ||
|
||||
buf->append(' ') ||
|
||||
buf->append(body.str, body.length);
|
||||
return rc;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -150,9 +150,9 @@ bool Item_splocal::append_value_for_log(THD *thd, String *str)
|
|||
Item *item= this_item();
|
||||
String *str_value= item->type_handler()->print_item_value(thd, item,
|
||||
&str_value_holder);
|
||||
return str_value ?
|
||||
str->append(*str_value) :
|
||||
str->append(STRING_WITH_LEN("NULL"));
|
||||
return (str_value ?
|
||||
str->append(*str_value) :
|
||||
str->append(NULL_clex_str));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -166,7 +166,7 @@ bool Item_splocal_row_field::append_for_log(THD *thd, String *str)
|
|||
|
||||
if (str->append(STRING_WITH_LEN(" NAME_CONST('")) ||
|
||||
str->append(&m_name) ||
|
||||
str->append(".") ||
|
||||
str->append('.') ||
|
||||
str->append(&m_field_name) ||
|
||||
str->append(STRING_WITH_LEN("',")))
|
||||
return true;
|
||||
|
|
@ -2117,7 +2117,7 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
|
|||
if (str_value)
|
||||
binlog_buf.append(*str_value);
|
||||
else
|
||||
binlog_buf.append(STRING_WITH_LEN("NULL"));
|
||||
binlog_buf.append(NULL_clex_str);
|
||||
}
|
||||
binlog_buf.append(')');
|
||||
}
|
||||
|
|
@ -4203,7 +4203,8 @@ sp_instr_freturn::print(String *str)
|
|||
if (str->reserve(1024+8+32)) // Add some for the expr. too
|
||||
return;
|
||||
str->qs_append(STRING_WITH_LEN("freturn "));
|
||||
str->qs_append(m_type_handler->name().ptr());
|
||||
LEX_CSTRING name= m_type_handler->name().lex_cstring();
|
||||
str->qs_append(&name);
|
||||
str->qs_append(' ');
|
||||
m_value->print(str, enum_query_type(QT_ORDINARY |
|
||||
QT_ITEM_ORIGINAL_FUNC_NULLIF));
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ int Geometry::as_json(String *wkt, uint max_dec_digits, const char **end)
|
|||
if (wkt->reserve(4 + type_keyname_len + 2 + len + 2 + 2 +
|
||||
coord_keyname_len + 4, 512))
|
||||
return 1;
|
||||
wkt->qs_append("\"", 1);
|
||||
wkt->qs_append('"');
|
||||
wkt->qs_append((const char *) type_keyname, type_keyname_len);
|
||||
wkt->qs_append("\": \"", 4);
|
||||
wkt->qs_append(get_class_info()->m_geojson_name.str, len);
|
||||
|
|
@ -404,7 +404,7 @@ int Geometry::bbox_as_json(String *wkt)
|
|||
const char *end;
|
||||
if (wkt->reserve(5 + bbox_keyname_len + (FLOATING_POINT_DECIMALS+2)*4, 512))
|
||||
return 1;
|
||||
wkt->qs_append("\"", 1);
|
||||
wkt->qs_append('"');
|
||||
wkt->qs_append((const char *) bbox_keyname, bbox_keyname_len);
|
||||
wkt->qs_append("\": [", 4);
|
||||
|
||||
|
|
@ -418,7 +418,7 @@ int Geometry::bbox_as_json(String *wkt)
|
|||
wkt->qs_append(mbr.xmax);
|
||||
wkt->qs_append(", ", 2);
|
||||
wkt->qs_append(mbr.ymax);
|
||||
wkt->qs_append("]", 1);
|
||||
wkt->qs_append(']');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -3504,13 +3504,13 @@ bool Gis_geometry_collection::get_data_as_json(String *txt, uint max_dec_digits,
|
|||
if (!(geom= create_by_typeid(&buffer, wkb_type)))
|
||||
return 1;
|
||||
geom->set_data_ptr(data, (uint) (m_data_end - data));
|
||||
if (txt->append("{", 1) ||
|
||||
if (txt->append('{') ||
|
||||
geom->as_json(txt, max_dec_digits, &data) ||
|
||||
txt->append(STRING_WITH_LEN("}, "), 512))
|
||||
return 1;
|
||||
}
|
||||
txt->length(txt->length() - 2);
|
||||
if (txt->append("]", 1))
|
||||
if (txt->append(']'))
|
||||
return 1;
|
||||
|
||||
*end= data;
|
||||
|
|
|
|||
|
|
@ -453,15 +453,15 @@ class ACL_PROXY_USER :public ACL_ACCESS
|
|||
void print_grant(String *str)
|
||||
{
|
||||
str->append(STRING_WITH_LEN("GRANT PROXY ON '"));
|
||||
str->append(proxied_user);
|
||||
str->append(proxied_user, strlen(proxied_user));
|
||||
str->append(STRING_WITH_LEN("'@'"));
|
||||
if (proxied_host.hostname)
|
||||
str->append(proxied_host.hostname, strlen(proxied_host.hostname));
|
||||
str->append(STRING_WITH_LEN("' TO '"));
|
||||
str->append(user);
|
||||
str->append(user, strlen(user));
|
||||
str->append(STRING_WITH_LEN("'@'"));
|
||||
if (host.hostname)
|
||||
str->append(host.hostname);
|
||||
str->append(host.hostname, strlen(host.hostname));
|
||||
str->append(STRING_WITH_LEN("'"));
|
||||
if (with_grant)
|
||||
str->append(STRING_WITH_LEN(" WITH GRANT OPTION"));
|
||||
|
|
@ -1776,7 +1776,7 @@ class User_table_json: public User_table
|
|||
if (value_len)
|
||||
json.append(',');
|
||||
json.append('"');
|
||||
json.append(key);
|
||||
json.append(key, strlen(key));
|
||||
json.append(STRING_WITH_LEN("\":"));
|
||||
if (string)
|
||||
json.append('"');
|
||||
|
|
@ -9136,7 +9136,7 @@ bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
|
|||
goto end;
|
||||
}
|
||||
|
||||
result.append("CREATE USER ");
|
||||
result.append(STRING_WITH_LEN("CREATE USER "));
|
||||
append_identifier(thd, &result, username, strlen(username));
|
||||
add_user_parameters(thd, &result, acl_user, false);
|
||||
|
||||
|
|
@ -9160,9 +9160,10 @@ bool mysql_show_create_user(THD *thd, LEX_USER *lex_user)
|
|||
of a user account, including both the manual expiration state of the
|
||||
account and the automatic expiration policy attached to it, we should
|
||||
print two statements here, a CREATE USER (printed above) and an ALTER USER */
|
||||
if (acl_user->password_expired && acl_user->password_lifetime > -1) {
|
||||
if (acl_user->password_expired && acl_user->password_lifetime > -1)
|
||||
{
|
||||
result.length(0);
|
||||
result.append("ALTER USER ");
|
||||
result.append(STRING_WITH_LEN("ALTER USER "));
|
||||
append_identifier(thd, &result, username, strlen(username));
|
||||
result.append('@');
|
||||
append_identifier(thd, &result, acl_user->host.hostname,
|
||||
|
|
@ -9418,7 +9419,7 @@ static bool show_default_role(THD *thd, ACL_USER *acl_entry,
|
|||
def_str.length(0);
|
||||
def_str.append(STRING_WITH_LEN("SET DEFAULT ROLE "));
|
||||
def_str.append(&def_rolename);
|
||||
def_str.append(" FOR '");
|
||||
def_str.append(STRING_WITH_LEN(" FOR '"));
|
||||
def_str.append(&acl_entry->user);
|
||||
DBUG_ASSERT(!(acl_entry->flags & IS_ROLE));
|
||||
def_str.append(STRING_WITH_LEN("'@'"));
|
||||
|
|
|
|||
130
sql/sql_admin.cc
130
sql/sql_admin.cc
|
|
@ -32,6 +32,15 @@
|
|||
#include "sql_admin.h"
|
||||
#include "sql_statistics.h"
|
||||
#include "wsrep_mysqld.h"
|
||||
|
||||
const LEX_CSTRING msg_repair= { STRING_WITH_LEN("repair") };
|
||||
const LEX_CSTRING msg_assign_to_keycache=
|
||||
{ STRING_WITH_LEN("assign_to_keycache") };
|
||||
const LEX_CSTRING msg_analyze= { STRING_WITH_LEN("analyze") };
|
||||
const LEX_CSTRING msg_check= { STRING_WITH_LEN("check") };
|
||||
const LEX_CSTRING msg_preload_keys= { STRING_WITH_LEN("preload_keys") };
|
||||
const LEX_CSTRING msg_optimize= { STRING_WITH_LEN("optimize") };
|
||||
|
||||
/* Prepare, run and cleanup for mysql_recreate_table() */
|
||||
|
||||
static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list)
|
||||
|
|
@ -71,15 +80,16 @@ static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list)
|
|||
|
||||
|
||||
static int send_check_errmsg(THD *thd, TABLE_LIST* table,
|
||||
const char* operator_name, const char* errmsg)
|
||||
const LEX_CSTRING *operator_name,
|
||||
const char* errmsg)
|
||||
|
||||
{
|
||||
Protocol *protocol= thd->protocol;
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table->alias.str, table->alias.length, system_charset_info);
|
||||
protocol->store((char*) operator_name, system_charset_info);
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
protocol->store(errmsg, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
protocol->store(&error_clex_str, system_charset_info);
|
||||
protocol->store(errmsg, strlen(errmsg), system_charset_info);
|
||||
thd->clear_error();
|
||||
if (protocol->write())
|
||||
return -1;
|
||||
|
|
@ -148,7 +158,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
|
|||
*/
|
||||
if (table->s->tmp_table)
|
||||
{
|
||||
error= send_check_errmsg(thd, table_list, "repair",
|
||||
error= send_check_errmsg(thd, table_list, &msg_repair,
|
||||
"Cannot repair temporary table from .frm file");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -166,8 +176,12 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
|
|||
if (table->s->frm_version < FRM_VER_TRUE_VARCHAR &&
|
||||
table->s->varchar_fields)
|
||||
{
|
||||
error= send_check_errmsg(thd, table_list, "repair",
|
||||
"Failed repairing a very old .frm file as the data file format has changed between versions. Please dump the table in your old system with mysqldump and read it into this system with mysql or mysqlimport");
|
||||
error= send_check_errmsg(thd, table_list, &msg_repair,
|
||||
"Failed repairing a very old .frm file as the "
|
||||
"data file format has changed between versions. "
|
||||
"Please dump the table in your old system with "
|
||||
"mysqldump and read it into this system with "
|
||||
"mysql or mysqlimport");
|
||||
goto end;
|
||||
}
|
||||
|
||||
|
|
@ -225,12 +239,12 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
|
|||
|
||||
if (my_rename(from, tmp, MYF(MY_WME)))
|
||||
{
|
||||
error= send_check_errmsg(thd, table_list, "repair",
|
||||
error= send_check_errmsg(thd, table_list, &msg_repair,
|
||||
"Failed renaming data file");
|
||||
goto end;
|
||||
}
|
||||
if (dd_recreate_table(thd, table_list->db.str, table_list->table_name.str))
|
||||
create_error= send_check_errmsg(thd, table_list, "repair",
|
||||
create_error= send_check_errmsg(thd, table_list, &msg_repair,
|
||||
"Failed generating table from .frm file");
|
||||
/*
|
||||
'FALSE' for 'using_transactions' means don't postpone
|
||||
|
|
@ -240,7 +254,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
|
|||
query_cache_invalidate3(thd, table_list, FALSE);
|
||||
if (mysql_file_rename(key_file_misc, tmp, from, MYF(MY_WME)))
|
||||
{
|
||||
error= send_check_errmsg(thd, table_list, "repair",
|
||||
error= send_check_errmsg(thd, table_list, &msg_repair,
|
||||
"Failed restoring .MYD file");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -262,7 +276,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
|
|||
*/
|
||||
if (open_table(thd, table_list, &ot_ctx))
|
||||
{
|
||||
error= send_check_errmsg(thd, table_list, "repair",
|
||||
error= send_check_errmsg(thd, table_list, &msg_repair,
|
||||
"Failed to open partially repaired table");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -430,14 +444,17 @@ static bool open_only_one_table(THD* thd, TABLE_LIST* table,
|
|||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
/*
|
||||
OPTIMIZE, REPAIR and ALTER may take MDL locks not only for the affected table, but
|
||||
also for the table referenced by foreign key constraint.
|
||||
This wsrep_toi_replication() function handles TOI replication for OPTIMIZE and REPAIR
|
||||
so that certification keys for potential FK parent tables are also appended in the
|
||||
write set.
|
||||
ALTER TABLE case is handled elsewhere.
|
||||
*/
|
||||
/*
|
||||
OPTIMIZE, REPAIR and ALTER may take MDL locks not only for the
|
||||
affected table, but also for the table referenced by foreign key
|
||||
constraint.
|
||||
|
||||
This wsrep_toi_replication() function handles TOI replication for
|
||||
OPTIMIZE and REPAIR so that certification keys for potential FK
|
||||
parent tables are also appended in the write set. ALTER TABLE
|
||||
case is handled elsewhere.
|
||||
*/
|
||||
|
||||
static bool wsrep_toi_replication(THD *thd, TABLE_LIST *tables)
|
||||
{
|
||||
LEX *lex= thd->lex;
|
||||
|
|
@ -480,7 +497,7 @@ static bool wsrep_toi_replication(THD *thd, TABLE_LIST *tables)
|
|||
*/
|
||||
static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
||||
HA_CHECK_OPT* check_opt,
|
||||
const char *operator_name,
|
||||
const LEX_CSTRING *operator_name,
|
||||
thr_lock_type lock_type,
|
||||
bool org_open_for_modify,
|
||||
bool repair_table_use_frm,
|
||||
|
|
@ -555,7 +572,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
|
||||
for (table= tables; table; table= table->next_local)
|
||||
{
|
||||
char table_name[SAFE_NAME_LEN*2+2];
|
||||
char table_name_buff[SAFE_NAME_LEN*2+2];
|
||||
LEX_CSTRING table_name= { table_name_buff, 0};
|
||||
const char *db= table->db.str;
|
||||
bool fatal_error=0;
|
||||
bool open_error;
|
||||
|
|
@ -567,7 +585,8 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
|
||||
if (thd->is_killed())
|
||||
break;
|
||||
strxmov(table_name, db, ".", table->table_name.str, NullS);
|
||||
table_name.length= strxmov(table_name_buff, db, ".", table->table_name.str,
|
||||
NullS) - table_name_buff;
|
||||
thd->open_options|= extra_open_options;
|
||||
table->lock_type= lock_type;
|
||||
/*
|
||||
|
|
@ -645,12 +664,12 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
size_t length;
|
||||
DBUG_PRINT("admin", ("sending non existent partition error"));
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store(&table_name, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
protocol->store(&error_clex_str, system_charset_info);
|
||||
length= my_snprintf(buff, sizeof(buff),
|
||||
ER_THD(thd, ER_DROP_PARTITION_NON_EXISTENT),
|
||||
table_name);
|
||||
table_name.str);
|
||||
protocol->store(buff, length, system_charset_info);
|
||||
if(protocol->write())
|
||||
goto err;
|
||||
|
|
@ -734,11 +753,11 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
enum_sql_command save_sql_command= lex->sql_command;
|
||||
DBUG_PRINT("admin", ("sending error message"));
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store(&table_name, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
protocol->store(&error_clex_str, system_charset_info);
|
||||
length= my_snprintf(buff, sizeof(buff), ER_THD(thd, ER_OPEN_AS_READONLY),
|
||||
table_name);
|
||||
table_name.str);
|
||||
protocol->store(buff, length, system_charset_info);
|
||||
trans_commit_stmt(thd);
|
||||
trans_commit(thd);
|
||||
|
|
@ -794,7 +813,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
/* purecov: begin inspected */
|
||||
DBUG_PRINT("admin", ("sending crashed warning"));
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store(&table_name, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
protocol->store(STRING_WITH_LEN("warning"), system_charset_info);
|
||||
protocol->store(STRING_WITH_LEN("Table is marked as crashed"),
|
||||
|
|
@ -856,7 +875,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
|
||||
if (result_code == HA_ADMIN_OK)
|
||||
{
|
||||
DBUG_PRINT("admin", ("calling operator_func '%s'", operator_name));
|
||||
DBUG_PRINT("admin", ("calling operator_func '%s'", operator_name->str));
|
||||
THD_STAGE_INFO(thd, stage_executing);
|
||||
result_code = (table->table->file->*operator_func)(thd, check_opt);
|
||||
THD_STAGE_INFO(thd, stage_sending_data);
|
||||
|
|
@ -972,7 +991,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
else
|
||||
{
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store(&table_name, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
protocol->store(STRING_WITH_LEN("status"), system_charset_info);
|
||||
protocol->store(STRING_WITH_LEN("Engine-independent statistics collected"),
|
||||
|
|
@ -1000,20 +1019,21 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
const Sql_condition *err;
|
||||
while ((err= it++))
|
||||
{
|
||||
const char *err_msg= err->get_message_text();
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store((char*) operator_name, system_charset_info);
|
||||
protocol->store(&table_name, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
protocol->store(warning_level_names[err->get_level()].str,
|
||||
warning_level_names[err->get_level()].length,
|
||||
system_charset_info);
|
||||
protocol->store(err->get_message_text(), system_charset_info);
|
||||
protocol->store(err_msg, strlen(err_msg), system_charset_info);
|
||||
if (protocol->write())
|
||||
goto err;
|
||||
}
|
||||
thd->get_stmt_da()->clear_warning_info(thd->query_id);
|
||||
}
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store(&table_name, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
|
||||
send_result_message:
|
||||
|
|
@ -1025,7 +1045,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
char buf[MYSQL_ERRMSG_SIZE];
|
||||
size_t length=my_snprintf(buf, sizeof(buf),
|
||||
ER_THD(thd, ER_CHECK_NOT_IMPLEMENTED),
|
||||
operator_name);
|
||||
operator_name->str);
|
||||
protocol->store(STRING_WITH_LEN("note"), system_charset_info);
|
||||
protocol->store(buf, length, system_charset_info);
|
||||
}
|
||||
|
|
@ -1036,7 +1056,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
char buf[MYSQL_ERRMSG_SIZE];
|
||||
size_t length= my_snprintf(buf, sizeof(buf),
|
||||
ER_THD(thd, ER_BAD_TABLE_ERROR),
|
||||
table_name);
|
||||
table_name.str);
|
||||
protocol->store(STRING_WITH_LEN("note"), system_charset_info);
|
||||
protocol->store(buf, length, system_charset_info);
|
||||
}
|
||||
|
|
@ -1067,13 +1087,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
break;
|
||||
|
||||
case HA_ADMIN_CORRUPT:
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
protocol->store(&error_clex_str, system_charset_info);
|
||||
protocol->store(STRING_WITH_LEN("Corrupt"), system_charset_info);
|
||||
fatal_error=1;
|
||||
break;
|
||||
|
||||
case HA_ADMIN_INVALID:
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
protocol->store(&error_clex_str, system_charset_info);
|
||||
protocol->store(STRING_WITH_LEN("Invalid argument"),
|
||||
system_charset_info);
|
||||
break;
|
||||
|
|
@ -1141,7 +1161,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
}
|
||||
/* Start a new row for the final status row */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store(&table_name, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
if (result_code) // either mysql_recreate_table or analyze failed
|
||||
{
|
||||
|
|
@ -1156,13 +1176,13 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
else
|
||||
{
|
||||
/* Hijack the row already in-progress. */
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
protocol->store(err_msg, system_charset_info);
|
||||
protocol->store(&error_clex_str, system_charset_info);
|
||||
protocol->store(err_msg, strlen(err_msg), system_charset_info);
|
||||
if (protocol->write())
|
||||
goto err;
|
||||
/* Start off another row for HA_ADMIN_FAILED */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store(&table_name, system_charset_info);
|
||||
protocol->store(operator_name, system_charset_info);
|
||||
}
|
||||
thd->clear_error();
|
||||
|
|
@ -1193,7 +1213,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
const char *what_to_upgrade= table->view ? "VIEW" :
|
||||
table->table->file->ha_table_flags() & HA_CAN_REPAIR ? "TABLE" : 0;
|
||||
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
protocol->store(&error_clex_str, system_charset_info);
|
||||
if (what_to_upgrade)
|
||||
length= my_snprintf(buf, sizeof(buf),
|
||||
ER_THD(thd, ER_TABLE_NEEDS_UPGRADE),
|
||||
|
|
@ -1213,7 +1233,7 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
size_t length=my_snprintf(buf, sizeof(buf),
|
||||
"Unknown - internal error %d during operation",
|
||||
result_code);
|
||||
protocol->store(STRING_WITH_LEN("error"), system_charset_info);
|
||||
protocol->store(&error_clex_str, system_charset_info);
|
||||
protocol->store(buf, length, system_charset_info);
|
||||
fatal_error=1;
|
||||
break;
|
||||
|
|
@ -1363,8 +1383,9 @@ bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
|
|||
}
|
||||
check_opt.key_cache= key_cache;
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, &check_opt,
|
||||
"assign_to_keycache", TL_READ_NO_INSERT, 0, 0,
|
||||
0, 0, &handler::assign_to_keycache, 0, false));
|
||||
&msg_assign_to_keycache, TL_READ_NO_INSERT, 0,
|
||||
0, 0, 0,
|
||||
&handler::assign_to_keycache, 0, false));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1390,8 +1411,9 @@ bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
|
|||
outdated information if parallel inserts into cache blocks happen.
|
||||
*/
|
||||
DBUG_RETURN(mysql_admin_table(thd, tables, 0,
|
||||
"preload_keys", TL_READ_NO_INSERT, 0, 0, 0, 0,
|
||||
&handler::preload_keys, 0, false));
|
||||
&msg_preload_keys, TL_READ_NO_INSERT,
|
||||
0, 0, 0, 0,
|
||||
&handler::preload_keys, 0, false));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1411,9 +1433,8 @@ bool Sql_cmd_analyze_table::execute(THD *thd)
|
|||
|
||||
WSREP_TO_ISOLATION_BEGIN_WRTCHK(NULL, NULL, first_table);
|
||||
res= mysql_admin_table(thd, first_table, &m_lex->check_opt,
|
||||
"analyze", lock_type, 1, 0, 0, 0,
|
||||
&msg_analyze, lock_type, 1, 0, 0, 0,
|
||||
&handler::ha_analyze, 0, true);
|
||||
|
||||
m_lex->first_select_lex()->table_list.first= first_table;
|
||||
m_lex->query_tables= first_table;
|
||||
|
||||
|
|
@ -1437,7 +1458,7 @@ bool Sql_cmd_check_table::execute(THD *thd)
|
|||
TRUE, UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
|
||||
res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "check",
|
||||
res= mysql_admin_table(thd, first_table, &m_lex->check_opt, &msg_check,
|
||||
lock_type, 0, 0, HA_OPEN_FOR_REPAIR, 0,
|
||||
&handler::ha_check, &view_check, false);
|
||||
|
||||
|
|
@ -1463,9 +1484,8 @@ bool Sql_cmd_optimize_table::execute(THD *thd)
|
|||
res= (specialflag & SPECIAL_NO_NEW_FUNC) ?
|
||||
mysql_recreate_table(thd, first_table, true) :
|
||||
mysql_admin_table(thd, first_table, &m_lex->check_opt,
|
||||
"optimize", TL_WRITE, 1, 0, 0, 0,
|
||||
&msg_optimize, TL_WRITE, 1, 0, 0, 0,
|
||||
&handler::ha_optimize, 0, true);
|
||||
|
||||
m_lex->first_select_lex()->table_list.first= first_table;
|
||||
m_lex->query_tables= first_table;
|
||||
|
||||
|
|
@ -1484,7 +1504,7 @@ bool Sql_cmd_repair_table::execute(THD *thd)
|
|||
if (check_table_access(thd, SELECT_ACL | INSERT_ACL, first_table,
|
||||
FALSE, UINT_MAX, FALSE))
|
||||
goto error; /* purecov: inspected */
|
||||
res= mysql_admin_table(thd, first_table, &m_lex->check_opt, "repair",
|
||||
res= mysql_admin_table(thd, first_table, &m_lex->check_opt, &msg_repair,
|
||||
TL_WRITE, 1,
|
||||
MY_TEST(m_lex->check_opt.sql_flags & TT_USEFRM),
|
||||
HA_OPEN_FOR_REPAIR, &prepare_for_repair,
|
||||
|
|
|
|||
|
|
@ -116,8 +116,8 @@ class field_str :public field_info
|
|||
|
||||
public:
|
||||
field_str(Item* a, analyse* b) :field_info(a,b),
|
||||
min_arg("",default_charset_info),
|
||||
max_arg("",default_charset_info), sum(0),
|
||||
min_arg("",0,default_charset_info),
|
||||
max_arg("",0,default_charset_info), sum(0),
|
||||
must_be_blob(0), was_zero_fill(0),
|
||||
was_maybe_zerofill(0), can_be_still_num(1)
|
||||
{ init_tree(&tree, 0, 0, sizeof(String), (qsort_cmp2) sortcmp2,
|
||||
|
|
|
|||
|
|
@ -87,20 +87,20 @@ void Filesort_tracker::print_json_members(Json_writer *writer)
|
|||
void Filesort_tracker::get_data_format(String *str)
|
||||
{
|
||||
if (r_sort_keys_packed)
|
||||
str->append("packed_sort_key");
|
||||
str->append(STRING_WITH_LEN("packed_sort_key"));
|
||||
else
|
||||
str->append("sort_key");
|
||||
str->append(",");
|
||||
str->append(STRING_WITH_LEN("sort_key"));
|
||||
str->append(',');
|
||||
|
||||
if (r_using_addons)
|
||||
{
|
||||
if (r_packed_addon_fields)
|
||||
str->append("packed_addon_fields");
|
||||
str->append(STRING_WITH_LEN("packed_addon_fields"));
|
||||
else
|
||||
str->append("addon_fields");
|
||||
str->append(STRING_WITH_LEN("addon_fields"));
|
||||
}
|
||||
else
|
||||
str->append("rowid");
|
||||
str->append(STRING_WITH_LEN("rowid"));
|
||||
}
|
||||
|
||||
void attach_gap_time_tracker(THD *thd, Gap_time_tracker *gap_tracker,
|
||||
|
|
|
|||
|
|
@ -2951,9 +2951,9 @@ static bool open_table_entry_fini(THD *thd, TABLE_SHARE *share, TABLE *entry)
|
|||
String query(query_buf, sizeof(query_buf), system_charset_info);
|
||||
|
||||
query.length(0);
|
||||
query.append("DELETE FROM ");
|
||||
query.append(STRING_WITH_LEN("DELETE FROM "));
|
||||
append_identifier(thd, &query, &share->db);
|
||||
query.append(".");
|
||||
query.append('.');
|
||||
append_identifier(thd, &query, &share->table_name);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -2918,11 +2918,11 @@ bool select_result::check_simple_select() const
|
|||
}
|
||||
|
||||
|
||||
static String default_line_term("\n",default_charset_info);
|
||||
static String default_escaped("\\",default_charset_info);
|
||||
static String default_field_term("\t",default_charset_info);
|
||||
static String default_enclosed_and_line_start("", default_charset_info);
|
||||
static String default_xml_row_term("<row>", default_charset_info);
|
||||
static String default_line_term("\n", 1, default_charset_info);
|
||||
static String default_escaped("\\", 1, default_charset_info);
|
||||
static String default_field_term("\t", 1, default_charset_info);
|
||||
static String default_enclosed_and_line_start("", 0, default_charset_info);
|
||||
static String default_xml_row_term("<row>", 5, default_charset_info);
|
||||
|
||||
sql_exchange::sql_exchange(const char *name, bool flag,
|
||||
enum enum_filetype filetype_arg)
|
||||
|
|
@ -6530,7 +6530,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
|
|||
table->lock_type >= TL_FIRST_WRITE)
|
||||
{
|
||||
table_names.append(&table->table_name);
|
||||
table_names.append(",");
|
||||
table_names.append(',');
|
||||
}
|
||||
}
|
||||
if (!table_names.is_empty())
|
||||
|
|
|
|||
|
|
@ -7604,11 +7604,12 @@ class Type_holder: public Sql_alloc,
|
|||
|
||||
bool aggregate_attributes(THD *thd)
|
||||
{
|
||||
static LEX_CSTRING union_name= { STRING_WITH_LEN("UNION") };
|
||||
for (uint i= 0; i < arg_count; i++)
|
||||
m_maybe_null|= args[i]->maybe_null();
|
||||
return
|
||||
type_handler()->Item_hybrid_func_fix_attributes(thd,
|
||||
"UNION", this, this,
|
||||
union_name, this, this,
|
||||
args, arg_count);
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1478,7 +1478,7 @@ void With_clause::print(THD *thd, String *str, enum_query_type query_type)
|
|||
with_elem= with_elem->next)
|
||||
{
|
||||
if (with_elem != with_list.first)
|
||||
str->append(", ");
|
||||
str->append(STRING_WITH_LEN(", "));
|
||||
with_elem->print(thd, str, query_type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ void compute_digest_text(const sql_digest_storage* digest_storage,
|
|||
|
||||
if (byte_count > digest_storage->m_token_array_length)
|
||||
{
|
||||
digest_output->append("\0", 1);
|
||||
digest_output->append('\0');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ void compute_digest_text(const sql_digest_storage* digest_storage,
|
|||
Can happen, as we do dirty reads on digest_storage,
|
||||
which can be written to in another thread.
|
||||
*/
|
||||
digest_output->append("\0", 1);
|
||||
digest_output->append('\0');
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -256,7 +256,7 @@ void compute_digest_text(const sql_digest_storage* digest_storage,
|
|||
break;
|
||||
}
|
||||
/* Copy the converted identifier into the digest string. */
|
||||
digest_output->append("`", 1);
|
||||
digest_output->append('`');
|
||||
if (id_length > 0)
|
||||
digest_output->append(id_string, id_length);
|
||||
digest_output->append("` ", 2);
|
||||
|
|
@ -273,7 +273,7 @@ void compute_digest_text(const sql_digest_storage* digest_storage,
|
|||
|
||||
digest_output->append(tok_data->m_token_string, tok_length);
|
||||
if (tok_data->m_append_space)
|
||||
digest_output->append(" ", 1);
|
||||
digest_output->append(' ');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -296,7 +296,7 @@ static void push_string_list(THD *thd, List<Item> *item_list,
|
|||
else
|
||||
buf->append(',');
|
||||
|
||||
buf->append(line);
|
||||
buf->append(line, strlen(line));
|
||||
}
|
||||
push_string(thd, item_list, buf);
|
||||
}
|
||||
|
|
@ -406,7 +406,7 @@ int print_explain_row(select_result_sink *result,
|
|||
Item_float *fl= new (mem_root) Item_float(thd, *r_rows, 2);
|
||||
String tmp;
|
||||
String *res= fl->val_str(&tmp);
|
||||
r_rows_str.append(res->ptr());
|
||||
r_rows_str.append(*res);
|
||||
item_list.push_back(new (mem_root)
|
||||
Item_string_sys(thd, r_rows_str.ptr(),
|
||||
r_rows_str.length()), mem_root);
|
||||
|
|
@ -552,7 +552,7 @@ int Explain_union::print_explain(Explain_query *query,
|
|||
Item_float *fl= new (mem_root) Item_float(thd, avg_rows, 2);
|
||||
String tmp;
|
||||
String *res= fl->val_str(&tmp);
|
||||
r_rows_str.append(res->ptr());
|
||||
r_rows_str.append(*res);
|
||||
item_list.push_back(new (mem_root)
|
||||
Item_string_sys(thd, r_rows_str.ptr(),
|
||||
r_rows_str.length()), mem_root);
|
||||
|
|
@ -1043,11 +1043,11 @@ void Explain_aggr_filesort::print_json_members(Json_writer *writer,
|
|||
first= false;
|
||||
else
|
||||
{
|
||||
str.append(", ");
|
||||
str.append(STRING_WITH_LEN(", "));
|
||||
}
|
||||
append_item_to_str(&str, item);
|
||||
if (*direction == ORDER::ORDER_DESC)
|
||||
str.append(" desc");
|
||||
str.append(STRING_WITH_LEN(" desc"));
|
||||
}
|
||||
|
||||
writer->add_member("sort_key").add_str(str.c_ptr_safe());
|
||||
|
|
@ -1125,14 +1125,15 @@ void Explain_table_access::fill_key_str(String *key_str, bool is_json) const
|
|||
CHARSET_INFO *cs= system_charset_info;
|
||||
bool is_hj= (type == JT_HASH || type == JT_HASH_NEXT ||
|
||||
type == JT_HASH_RANGE || type == JT_HASH_INDEX_MERGE);
|
||||
const char *hash_key_prefix= "#hash#";
|
||||
LEX_CSTRING hash_key_prefix= { STRING_WITH_LEN("#hash#") };
|
||||
const char *key_name;
|
||||
|
||||
if (key.get_key_name())
|
||||
if ((key_name= key.get_key_name()))
|
||||
{
|
||||
if (is_hj)
|
||||
key_str->append(hash_key_prefix, strlen(hash_key_prefix), cs);
|
||||
key_str->append(hash_key_prefix.str, hash_key_prefix.length, cs);
|
||||
|
||||
key_str->append(key.get_key_name());
|
||||
key_str->append(key_name, strlen(key_name));
|
||||
|
||||
if (is_hj && type != JT_HASH)
|
||||
key_str->append(':');
|
||||
|
|
@ -1148,7 +1149,10 @@ void Explain_table_access::fill_key_str(String *key_str, bool is_json) const
|
|||
key_str->append(buf2);
|
||||
}
|
||||
if (type == JT_HASH_NEXT)
|
||||
key_str->append(hash_next_key.get_key_name());
|
||||
{
|
||||
key_name= hash_next_key.get_key_name();
|
||||
key_str->append(key_name, strlen(key_name));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1290,8 +1294,8 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
|||
push_str(thd, &item_list, join_type_str[type]);
|
||||
else
|
||||
{
|
||||
join_type_buf.append(join_type_str[type]);
|
||||
join_type_buf.append("|filter");
|
||||
join_type_buf.append(join_type_str[type], strlen(join_type_str[type]));
|
||||
join_type_buf.append(STRING_WITH_LEN("|filter"));
|
||||
item_list.push_back(new (mem_root)
|
||||
Item_string_sys(thd, join_type_buf.ptr(),
|
||||
join_type_buf.length()),
|
||||
|
|
@ -1311,7 +1315,7 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
|||
|
||||
if (rowid_filter)
|
||||
{
|
||||
key_str.append("|");
|
||||
key_str.append('|');
|
||||
StringBuffer<64> rowid_key_str;
|
||||
rowid_filter->quick->print_key(&rowid_key_str);
|
||||
key_str.append(rowid_key_str);
|
||||
|
|
@ -1354,10 +1358,10 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
|||
|
||||
if (rowid_filter)
|
||||
{
|
||||
rows_str.append(" (");
|
||||
rows_str.append(STRING_WITH_LEN(" ("));
|
||||
rows_str.append_ulonglong((ulonglong) (round(rowid_filter->selectivity *
|
||||
100.0)));
|
||||
rows_str.append("%)");
|
||||
rows_str.append(STRING_WITH_LEN("%)"));
|
||||
}
|
||||
item_list.push_back(new (mem_root)
|
||||
Item_string_sys(thd, rows_str.ptr(),
|
||||
|
|
@ -1380,13 +1384,13 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
|
|||
Item_float *fl= new (mem_root) Item_float(thd, avg_rows, 2);
|
||||
String tmp;
|
||||
String *res= fl->val_str(&tmp);
|
||||
r_rows_str.append(res->ptr());
|
||||
r_rows_str.append(*res);
|
||||
if (rowid_filter)
|
||||
{
|
||||
r_rows_str.append(" (");
|
||||
r_rows_str.append(STRING_WITH_LEN(" ("));
|
||||
r_rows_str.append_ulonglong(
|
||||
(ulonglong) (rowid_filter->tracker->get_r_selectivity_pct() * 100.0));
|
||||
r_rows_str.append("%)");
|
||||
r_rows_str.append(STRING_WITH_LEN("%)"));
|
||||
}
|
||||
item_list.push_back(new (mem_root)
|
||||
Item_string_sys(thd, r_rows_str.ptr(),
|
||||
|
|
@ -1929,42 +1933,41 @@ void Explain_table_access::print_explain_json(Explain_query *query,
|
|||
sql_explain.h
|
||||
*/
|
||||
|
||||
const char * extra_tag_text[]=
|
||||
const LEX_CSTRING extra_tag_text[]=
|
||||
{
|
||||
"ET_none",
|
||||
"Using index condition",
|
||||
"Using index condition(BKA)",
|
||||
"Using ", // special handling
|
||||
"Range checked for each record (index map: 0x", // special handling
|
||||
"Using where with pushed condition",
|
||||
"Using where",
|
||||
"Not exists",
|
||||
{ STRING_WITH_LEN("ET_none") },
|
||||
{ STRING_WITH_LEN("Using index condition") },
|
||||
{ STRING_WITH_LEN("Using index condition(BKA)") },
|
||||
{ STRING_WITH_LEN("Using ") }, // special handling
|
||||
{ STRING_WITH_LEN("Range checked for each record (index map: 0x") }, // special handling
|
||||
{ STRING_WITH_LEN("Using where with pushed condition") },
|
||||
{ STRING_WITH_LEN("Using where") },
|
||||
{ STRING_WITH_LEN("Not exists") },
|
||||
|
||||
"Using index",
|
||||
"Full scan on NULL key",
|
||||
"Skip_open_table",
|
||||
"Open_frm_only",
|
||||
"Open_full_table",
|
||||
{ STRING_WITH_LEN("Using index") },
|
||||
{ STRING_WITH_LEN("Full scan on NULL key") },
|
||||
{ STRING_WITH_LEN("Skip_open_table") },
|
||||
{ STRING_WITH_LEN("Open_frm_only") },
|
||||
{ STRING_WITH_LEN("Open_full_table") },
|
||||
|
||||
"Scanned 0 databases",
|
||||
"Scanned 1 database",
|
||||
"Scanned all databases",
|
||||
{ STRING_WITH_LEN("Scanned 0 databases") },
|
||||
{ STRING_WITH_LEN("Scanned 1 database") },
|
||||
{ STRING_WITH_LEN("Scanned all databases") },
|
||||
|
||||
"Using index for group-by", // special handling
|
||||
{ STRING_WITH_LEN("Using index for group-by") }, // special handling
|
||||
{ STRING_WITH_LEN("USING MRR: DONT PRINT ME") }, // special handling
|
||||
|
||||
"USING MRR: DONT PRINT ME", // special handling
|
||||
{ STRING_WITH_LEN("Distinct") },
|
||||
{ STRING_WITH_LEN("LooseScan") },
|
||||
{ STRING_WITH_LEN("Start temporary") },
|
||||
{ STRING_WITH_LEN("End temporary") },
|
||||
{ STRING_WITH_LEN("FirstMatch") }, // special handling
|
||||
|
||||
"Distinct",
|
||||
"LooseScan",
|
||||
"Start temporary",
|
||||
"End temporary",
|
||||
"FirstMatch", // special handling
|
||||
{ STRING_WITH_LEN("Using join buffer") }, // special handling
|
||||
|
||||
"Using join buffer", // special handling
|
||||
|
||||
"Const row not found",
|
||||
"Unique row not found",
|
||||
"Impossible ON condition",
|
||||
{ STRING_WITH_LEN("Const row not found") },
|
||||
{ STRING_WITH_LEN("Unique row not found") },
|
||||
{ STRING_WITH_LEN("Impossible ON condition") }
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -1984,7 +1987,8 @@ void Explain_table_access::append_tag_name(String *str, enum explain_extra_tag t
|
|||
char buf[MAX_KEY / 4 + 1];
|
||||
str->append(STRING_WITH_LEN("Range checked for each "
|
||||
"record (index map: 0x"));
|
||||
str->append(range_checked_fer->keys_map.print(buf));
|
||||
range_checked_fer->keys_map.print(buf);
|
||||
str->append(buf, strlen(buf));
|
||||
str->append(')');
|
||||
break;
|
||||
}
|
||||
|
|
@ -1998,12 +2002,16 @@ void Explain_table_access::append_tag_name(String *str, enum explain_extra_tag t
|
|||
str->append(extra_tag_text[tag]);
|
||||
|
||||
str->append(STRING_WITH_LEN(" ("));
|
||||
const char *buffer_type= bka_type.incremental ? "incremental" : "flat";
|
||||
LEX_CSTRING buffer_type;
|
||||
if (bka_type.incremental)
|
||||
buffer_type= { STRING_WITH_LEN("incremental") };
|
||||
else
|
||||
buffer_type= { STRING_WITH_LEN("flat") };
|
||||
str->append(buffer_type);
|
||||
str->append(STRING_WITH_LEN(", "));
|
||||
str->append(bka_type.join_alg);
|
||||
str->append(bka_type.join_alg, strlen(bka_type.join_alg));
|
||||
str->append(STRING_WITH_LEN(" join"));
|
||||
str->append(STRING_WITH_LEN(")"));
|
||||
str->append(')');
|
||||
if (bka_type.mrr_type.length())
|
||||
{
|
||||
str->append(STRING_WITH_LEN("; "));
|
||||
|
|
@ -2016,9 +2024,9 @@ void Explain_table_access::append_tag_name(String *str, enum explain_extra_tag t
|
|||
{
|
||||
if (firstmatch_table_name.length())
|
||||
{
|
||||
str->append("FirstMatch(");
|
||||
str->append(STRING_WITH_LEN("FirstMatch("));
|
||||
str->append(firstmatch_table_name);
|
||||
str->append(")");
|
||||
str->append(')');
|
||||
}
|
||||
else
|
||||
str->append(extra_tag_text[tag]);
|
||||
|
|
@ -2028,10 +2036,10 @@ void Explain_table_access::append_tag_name(String *str, enum explain_extra_tag t
|
|||
{
|
||||
str->append(extra_tag_text[tag]);
|
||||
if (loose_scan_is_scanning)
|
||||
str->append(" (scanning)");
|
||||
str->append(STRING_WITH_LEN(" (scanning)"));
|
||||
break;
|
||||
case ET_TABLE_FUNCTION:
|
||||
str->append("Table function: json_table");
|
||||
str->append(STRING_WITH_LEN("Table function: json_table"));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
@ -2086,13 +2094,16 @@ void Explain_quick_select::print_json(Json_writer *writer)
|
|||
|
||||
void Explain_quick_select::print_extra_recursive(String *str)
|
||||
{
|
||||
const char *name;
|
||||
if (is_basic())
|
||||
{
|
||||
str->append(range.get_key_name());
|
||||
name= range.get_key_name();
|
||||
str->append(name, strlen(name));
|
||||
}
|
||||
else
|
||||
{
|
||||
str->append(get_name_by_type());
|
||||
name= get_name_by_type();
|
||||
str->append(name, strlen(name));
|
||||
str->append('(');
|
||||
List_iterator_fast<Explain_quick_select> it (children);
|
||||
Explain_quick_select* child;
|
||||
|
|
@ -2141,7 +2152,7 @@ void Explain_quick_select::print_key(String *str)
|
|||
{
|
||||
if (str->length() > 0)
|
||||
str->append(',');
|
||||
str->append(range.get_key_name());
|
||||
str->append(range.get_key_name(), strlen(range.get_key_name()));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -297,10 +297,10 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
|
|||
DBUG_ENTER("get_topics_for_keyword");
|
||||
|
||||
if ((iindex_topic=
|
||||
find_type(primary_key_name, &topics->s->keynames,
|
||||
find_type(primary_key_name.str, &topics->s->keynames,
|
||||
FIND_TYPE_NO_PREFIX) - 1) < 0 ||
|
||||
(iindex_relations=
|
||||
find_type(primary_key_name, &relations->s->keynames,
|
||||
find_type(primary_key_name.str, &relations->s->keynames,
|
||||
FIND_TYPE_NO_PREFIX) - 1) < 0)
|
||||
{
|
||||
my_message(ER_CORRUPT_HELP_DB, ER_THD(thd, ER_CORRUPT_HELP_DB), MYF(0));
|
||||
|
|
|
|||
|
|
@ -642,7 +642,7 @@ static int
|
|||
create_insert_stmt_from_insert_delayed(THD *thd, String *buf)
|
||||
{
|
||||
/* Make a copy of thd->query() and then remove the "DELAYED" keyword */
|
||||
if (buf->append(thd->query()) ||
|
||||
if (buf->append(thd->query(), thd->query_length()) ||
|
||||
buf->replace(thd->lex->keyword_delayed_begin_offset,
|
||||
thd->lex->keyword_delayed_end_offset -
|
||||
thd->lex->keyword_delayed_begin_offset, NULL, 0))
|
||||
|
|
@ -4864,12 +4864,12 @@ bool binlog_drop_table(THD *thd, TABLE *table)
|
|||
if (!thd->binlog_table_should_be_logged(&table->s->db))
|
||||
return 0;
|
||||
|
||||
query.append("DROP ");
|
||||
query.append(STRING_WITH_LEN("DROP "));
|
||||
if (table->s->tmp_table)
|
||||
query.append("TEMPORARY ");
|
||||
query.append("TABLE IF EXISTS ");
|
||||
query.append(STRING_WITH_LEN("TEMPORARY "));
|
||||
query.append(STRING_WITH_LEN("TABLE IF EXISTS "));
|
||||
append_identifier(thd, &query, &table->s->db);
|
||||
query.append(".");
|
||||
query.append('.');
|
||||
append_identifier(thd, &query, &table->s->table_name);
|
||||
|
||||
return thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
|
|
|
|||
|
|
@ -51,7 +51,8 @@ const LEX_CSTRING null_clex_str= {NULL, 0};
|
|||
const LEX_CSTRING empty_clex_str= {"", 0};
|
||||
const LEX_CSTRING star_clex_str= {"*", 1};
|
||||
const LEX_CSTRING param_clex_str= {"?", 1};
|
||||
|
||||
const LEX_CSTRING NULL_clex_str= {STRING_WITH_LEN("NULL")};
|
||||
const LEX_CSTRING error_clex_str= {STRING_WITH_LEN("error")};
|
||||
|
||||
/**
|
||||
Helper action for a case expression statement (the expr in 'CASE expr').
|
||||
|
|
|
|||
|
|
@ -877,18 +877,18 @@ static bool write_execute_load_query_log_event(THD *thd, const sql_exchange* ex,
|
|||
{
|
||||
List_iterator<Item> li(thd->lex->field_list);
|
||||
|
||||
query_str.append(" (");
|
||||
query_str.append(STRING_WITH_LEN(" ("));
|
||||
n= 0;
|
||||
|
||||
while ((item= li++))
|
||||
{
|
||||
if (n++)
|
||||
query_str.append(", ");
|
||||
query_str.append(STRING_WITH_LEN(", "));
|
||||
const Load_data_outvar *var= item->get_load_data_outvar();
|
||||
DBUG_ASSERT(var);
|
||||
var->load_data_print_for_log_event(thd, &query_str);
|
||||
}
|
||||
query_str.append(")");
|
||||
query_str.append(')');
|
||||
}
|
||||
|
||||
if (!thd->lex->update_list.is_empty())
|
||||
|
|
|
|||
|
|
@ -2119,17 +2119,17 @@ static int add_keyword_string(String *str, const char *keyword,
|
|||
bool quoted, const char *keystr)
|
||||
{
|
||||
int err= str->append(' ');
|
||||
err+= str->append(keyword);
|
||||
err+= str->append(keyword, strlen(keyword));
|
||||
|
||||
str->append(STRING_WITH_LEN(" = "));
|
||||
if (quoted)
|
||||
{
|
||||
err+= str->append('\'');
|
||||
err+= str->append_for_single_quote(keystr);
|
||||
err+= str->append_for_single_quote(keystr, strlen(keystr));
|
||||
err+= str->append('\'');
|
||||
}
|
||||
else
|
||||
err+= str->append(keystr);
|
||||
err+= str->append(keystr, strlen(keystr));
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
@ -2205,7 +2205,7 @@ static int add_keyword_path(String *str, const char *keyword,
|
|||
static int add_keyword_int(String *str, const char *keyword, longlong num)
|
||||
{
|
||||
int err= str->append(' ');
|
||||
err+= str->append(keyword);
|
||||
err+= str->append(keyword, strlen(keyword));
|
||||
str->append(STRING_WITH_LEN(" = "));
|
||||
return err + str->append_longlong(num);
|
||||
}
|
||||
|
|
@ -2294,12 +2294,12 @@ static int add_column_list_values(String *str, partition_info *part_info,
|
|||
if (col_val->max_value)
|
||||
err+= str->append(STRING_WITH_LEN("MAXVALUE"));
|
||||
else if (col_val->null_value)
|
||||
err+= str->append(STRING_WITH_LEN("NULL"));
|
||||
err+= str->append(NULL_clex_str);
|
||||
else
|
||||
{
|
||||
Item *item_expr= col_val->item_expression;
|
||||
if (item_expr->null_value)
|
||||
err+= str->append(STRING_WITH_LEN("NULL"));
|
||||
err+= str->append(NULL_clex_str);
|
||||
else
|
||||
{
|
||||
CHARSET_INFO *field_cs;
|
||||
|
|
@ -2404,7 +2404,7 @@ static int add_partition_values(String *str, partition_info *part_info,
|
|||
err+= str->append('(');
|
||||
if (p_elem->has_null_value)
|
||||
{
|
||||
err+= str->append(STRING_WITH_LEN("NULL"));
|
||||
err+= str->append(NULL_clex_str);
|
||||
if (num_items == 0)
|
||||
{
|
||||
err+= str->append(')');
|
||||
|
|
@ -7545,9 +7545,9 @@ void append_row_to_str(String &str, const uchar *row, TABLE *table)
|
|||
field_ptr++)
|
||||
{
|
||||
Field *field= *field_ptr;
|
||||
str.append(" ");
|
||||
str.append(' ');
|
||||
str.append(&field->field_name);
|
||||
str.append(":");
|
||||
str.append(':');
|
||||
field_unpack(&str, field, rec, 0, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -870,7 +870,7 @@ bool Sql_cmd_alter_table_truncate_partition::execute(THD *thd)
|
|||
{
|
||||
const char *partition_name= partition_names_it++;
|
||||
String *str_partition_name= new (thd->mem_root)
|
||||
String(partition_name, system_charset_info);
|
||||
String(partition_name, strlen(partition_name), system_charset_info);
|
||||
if (!str_partition_name)
|
||||
DBUG_RETURN(true);
|
||||
partition_names_list.push_back(str_partition_name, thd->mem_root);
|
||||
|
|
|
|||
|
|
@ -4323,7 +4323,9 @@ bool show_binlog_info(THD* thd)
|
|||
LOG_INFO li;
|
||||
mysql_bin_log.get_current_log(&li);
|
||||
size_t dir_len = dirname_length(li.log_file_name);
|
||||
protocol->store(li.log_file_name + dir_len, &my_charset_bin);
|
||||
const char *base= li.log_file_name + dir_len;
|
||||
|
||||
protocol->store(base, strlen(base), &my_charset_bin);
|
||||
protocol->store((ulonglong) li.pos);
|
||||
protocol->store(binlog_filter->get_do_db());
|
||||
protocol->store(binlog_filter->get_ignore_db());
|
||||
|
|
|
|||
|
|
@ -804,7 +804,7 @@ void vers_select_conds_t::print(String *str, enum_query_type query_type) const
|
|||
DBUG_ASSERT(0);
|
||||
break;
|
||||
case SYSTEM_TIME_ALL:
|
||||
str->append(" FOR SYSTEM_TIME ALL");
|
||||
str->append(STRING_WITH_LEN(" FOR SYSTEM_TIME ALL"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -13477,8 +13477,11 @@ make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
|
|||
char buff[256];
|
||||
String str(buff,sizeof(buff),system_charset_info);
|
||||
str.length(0);
|
||||
str.append(tab->table? tab->table->alias.c_ptr() :"<no_table_name>");
|
||||
str.append(" final_pushdown_cond");
|
||||
if (tab->table)
|
||||
str.append(tab->table->alias);
|
||||
else
|
||||
str.append(STRING_WITH_LEN("<no_table_name>"));
|
||||
str.append(STRING_WITH_LEN(" final_pushdown_cond"));
|
||||
print_where(tab->select_cond, str.c_ptr_safe(), QT_ORDINARY););
|
||||
}
|
||||
uint n_top_tables= (uint)(join->join_tab_ranges.head()->end -
|
||||
|
|
@ -27733,13 +27736,13 @@ Index_hint::print(THD *thd, String *str)
|
|||
case INDEX_HINT_USE: str->append(STRING_WITH_LEN("USE INDEX")); break;
|
||||
case INDEX_HINT_FORCE: str->append(STRING_WITH_LEN("FORCE INDEX")); break;
|
||||
}
|
||||
str->append (STRING_WITH_LEN(" ("));
|
||||
str->append(STRING_WITH_LEN(" ("));
|
||||
if (key_name.length)
|
||||
{
|
||||
if (thd && !system_charset_info->strnncoll(
|
||||
(const uchar *)key_name.str, key_name.length,
|
||||
(const uchar *)primary_key_name,
|
||||
strlen(primary_key_name)))
|
||||
(const uchar *)primary_key_name.str,
|
||||
primary_key_name.length))
|
||||
str->append(primary_key_name);
|
||||
else
|
||||
append_identifier(thd, str, &key_name);
|
||||
|
|
@ -27897,8 +27900,8 @@ void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str,
|
|||
|
||||
while ((hint= it++))
|
||||
{
|
||||
str->append (STRING_WITH_LEN(" "));
|
||||
hint->print (thd, str);
|
||||
str->append(' ');
|
||||
hint->print(thd, str);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27920,21 +27923,21 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
|
|||
thd->lex->all_selects_list->link_next &&
|
||||
select_number != FAKE_SELECT_LEX_ID)
|
||||
{
|
||||
str->append("/* select#");
|
||||
str->append(STRING_WITH_LEN("/* select#"));
|
||||
str->append_ulonglong(select_number);
|
||||
if (thd->lex->describe & DESCRIBE_EXTENDED2)
|
||||
{
|
||||
str->append("/");
|
||||
str->append('/');
|
||||
str->append_ulonglong(nest_level);
|
||||
|
||||
if (master_unit()->fake_select_lex &&
|
||||
master_unit()->first_select() == this)
|
||||
{
|
||||
str->append(" Filter Select: ");
|
||||
str->append(STRING_WITH_LEN(" Filter Select: "));
|
||||
master_unit()->fake_select_lex->print(thd, str, query_type);
|
||||
}
|
||||
}
|
||||
str->append(" */ ");
|
||||
str->append(STRING_WITH_LEN(" */ "));
|
||||
}
|
||||
|
||||
str->append(STRING_WITH_LEN("select "));
|
||||
|
|
@ -28034,7 +28037,7 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
|
|||
if (cur_where)
|
||||
cur_where->print(str, query_type);
|
||||
else
|
||||
str->append(cond_value != Item::COND_FALSE ? "1" : "0");
|
||||
str->append(cond_value != Item::COND_FALSE ? '1' : '0');
|
||||
}
|
||||
|
||||
// group by & olap
|
||||
|
|
@ -28066,7 +28069,7 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
|
|||
if (cur_having)
|
||||
cur_having->print(str, query_type);
|
||||
else
|
||||
str->append(having_value != Item::COND_FALSE ? "1" : "0");
|
||||
str->append(having_value != Item::COND_FALSE ? '1' : '0');
|
||||
}
|
||||
|
||||
if (order_list.elements)
|
||||
|
|
@ -28080,12 +28083,11 @@ void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)
|
|||
|
||||
// lock type
|
||||
if (select_lock == select_lock_type::IN_SHARE_MODE)
|
||||
str->append(" lock in share mode");
|
||||
str->append(STRING_WITH_LEN(" lock in share mode"));
|
||||
else if (select_lock == select_lock_type::FOR_UPDATE)
|
||||
str->append(" for update");
|
||||
|
||||
str->append(STRING_WITH_LEN(" for update"));
|
||||
if (unlikely(skip_locked))
|
||||
str->append(" skip locked");
|
||||
str->append(STRING_WITH_LEN(" skip locked"));
|
||||
|
||||
// PROCEDURE unsupported here
|
||||
}
|
||||
|
|
|
|||
147
sql/sql_show.cc
147
sql/sql_show.cc
|
|
@ -108,6 +108,10 @@ static const LEX_CSTRING trg_event_type_names[]=
|
|||
{ STRING_WITH_LEN("DELETE") }
|
||||
};
|
||||
|
||||
|
||||
LEX_CSTRING DATA_clex_str= { STRING_WITH_LEN("DATA") };
|
||||
LEX_CSTRING INDEX_clex_str= { STRING_WITH_LEN("INDEX") };
|
||||
|
||||
#ifndef NO_EMBEDDED_ACCESS_CHECKS
|
||||
static const char *grant_names[]={
|
||||
"select","insert","update","delete","create","drop","reload","shutdown",
|
||||
|
|
@ -119,7 +123,12 @@ static TYPELIB grant_types = { sizeof(grant_names)/sizeof(char **),
|
|||
#endif
|
||||
|
||||
/* Match the values of enum ha_choice */
|
||||
static const char *ha_choice_values[] = {"", "0", "1"};
|
||||
static const LEX_CSTRING ha_choice_values[]=
|
||||
{
|
||||
{ STRING_WITH_LEN("") },
|
||||
{ STRING_WITH_LEN("0") },
|
||||
{ STRING_WITH_LEN("1") }
|
||||
};
|
||||
|
||||
static void store_key_options(THD *, String *, TABLE *, KEY *);
|
||||
|
||||
|
|
@ -396,9 +405,11 @@ bool mysqld_show_authors(THD *thd)
|
|||
for (authors= show_table_authors; authors->name; authors++)
|
||||
{
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(authors->name, system_charset_info);
|
||||
protocol->store(authors->location, system_charset_info);
|
||||
protocol->store(authors->comment, system_charset_info);
|
||||
protocol->store(authors->name, strlen(authors->name), system_charset_info);
|
||||
protocol->store(authors->location, strlen(authors->location),
|
||||
system_charset_info);
|
||||
protocol->store(authors->comment, strlen(authors->comment),
|
||||
system_charset_info);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
|
@ -435,9 +446,12 @@ bool mysqld_show_contributors(THD *thd)
|
|||
for (contributors= show_table_contributors; contributors->name; contributors++)
|
||||
{
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(contributors->name, system_charset_info);
|
||||
protocol->store(contributors->location, system_charset_info);
|
||||
protocol->store(contributors->comment, system_charset_info);
|
||||
protocol->store(contributors->name, strlen(contributors->name),
|
||||
system_charset_info);
|
||||
protocol->store(contributors->location, strlen(contributors->location),
|
||||
system_charset_info);
|
||||
protocol->store(contributors->comment, strlen(contributors->comment),
|
||||
system_charset_info);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
|
@ -528,9 +542,12 @@ bool mysqld_show_privileges(THD *thd)
|
|||
for (privilege= sys_privileges; privilege->privilege ; privilege++)
|
||||
{
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(privilege->privilege, system_charset_info);
|
||||
protocol->store(privilege->context, system_charset_info);
|
||||
protocol->store(privilege->comment, system_charset_info);
|
||||
protocol->store(privilege->privilege, strlen(privilege->privilege),
|
||||
system_charset_info);
|
||||
protocol->store(privilege->context, strlen(privilege->context),
|
||||
system_charset_info);
|
||||
protocol->store(privilege->comment, strlen(privilege->comment),
|
||||
system_charset_info);
|
||||
if (protocol->write())
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
|
@ -1298,19 +1315,23 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
|||
|
||||
protocol->prepare_for_resend();
|
||||
if (table_list->view)
|
||||
protocol->store(table_list->view_name.str, system_charset_info);
|
||||
protocol->store(&table_list->view_name, system_charset_info);
|
||||
else
|
||||
{
|
||||
if (table_list->schema_table)
|
||||
protocol->store(table_list->schema_table->table_name, system_charset_info);
|
||||
protocol->store(table_list->schema_table->table_name,
|
||||
strlen(table_list->schema_table->table_name),
|
||||
system_charset_info);
|
||||
else
|
||||
protocol->store(table_list->table->alias.c_ptr(), system_charset_info);
|
||||
protocol->store(table_list->table->alias.ptr(),
|
||||
table_list->table->alias.length(),
|
||||
system_charset_info);
|
||||
}
|
||||
|
||||
if (table_list->view)
|
||||
{
|
||||
protocol->store(buffer.ptr(), buffer.length(),
|
||||
table_list->view_creation_ctx->get_client_cs());
|
||||
buffer.set_charset(table_list->view_creation_ctx->get_client_cs());
|
||||
protocol->store(&buffer);
|
||||
|
||||
protocol->store(table_list->view_creation_ctx->get_client_cs()->csname,
|
||||
system_charset_info);
|
||||
|
|
@ -1319,7 +1340,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
|
|||
system_charset_info);
|
||||
}
|
||||
else
|
||||
protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
|
||||
protocol->store(&buffer);
|
||||
|
||||
if (protocol->write())
|
||||
goto exit;
|
||||
|
|
@ -1419,11 +1440,13 @@ bool mysqld_show_create_db(THD *thd, LEX_CSTRING *dbname,
|
|||
{
|
||||
buffer.append(STRING_WITH_LEN(" /*!40100"));
|
||||
buffer.append(STRING_WITH_LEN(" DEFAULT CHARACTER SET "));
|
||||
buffer.append(create.default_table_charset->csname);
|
||||
buffer.append(create.default_table_charset->csname,
|
||||
strlen(create.default_table_charset->csname));
|
||||
if (!(create.default_table_charset->state & MY_CS_PRIMARY))
|
||||
{
|
||||
buffer.append(STRING_WITH_LEN(" COLLATE "));
|
||||
buffer.append(create.default_table_charset->name);
|
||||
buffer.append(create.default_table_charset->name,
|
||||
strlen(create.default_table_charset->name));
|
||||
}
|
||||
buffer.append(STRING_WITH_LEN(" */"));
|
||||
}
|
||||
|
|
@ -1621,7 +1644,7 @@ int get_quote_char_for_identifier(THD *thd, const char *name, size_t length)
|
|||
|
||||
/* Append directory name (if exists) to CREATE INFO */
|
||||
|
||||
static void append_directory(THD *thd, String *packet, const char *dir_type,
|
||||
static void append_directory(THD *thd, String *packet, LEX_CSTRING *dir_type,
|
||||
const char *filename)
|
||||
{
|
||||
if (filename && !(thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE))
|
||||
|
|
@ -1879,11 +1902,13 @@ static void add_table_options(THD *thd, TABLE *table,
|
|||
(create_info_arg->used_fields & HA_CREATE_USED_DEFAULT_CHARSET))
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" DEFAULT CHARSET="));
|
||||
packet->append(share->table_charset->csname);
|
||||
packet->append(share->table_charset->csname,
|
||||
strlen(share->table_charset->csname));
|
||||
if (!(share->table_charset->state & MY_CS_PRIMARY))
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" COLLATE="));
|
||||
packet->append(table->s->table_charset->name);
|
||||
packet->append(table->s->table_charset->name,
|
||||
strlen(table->s->table_charset->name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1930,19 +1955,19 @@ static void add_table_options(THD *thd, TABLE *table,
|
|||
if (create_info.page_checksum != HA_CHOICE_UNDEF)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" PAGE_CHECKSUM="));
|
||||
packet->append(ha_choice_values[create_info.page_checksum], 1);
|
||||
packet->append(ha_choice_values[create_info.page_checksum]);
|
||||
}
|
||||
if (create_info.options & HA_OPTION_DELAY_KEY_WRITE)
|
||||
packet->append(STRING_WITH_LEN(" DELAY_KEY_WRITE=1"));
|
||||
if (create_info.row_type != ROW_TYPE_DEFAULT)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" ROW_FORMAT="));
|
||||
packet->append(ha_row_type[(uint) create_info.row_type]);
|
||||
packet->append(&ha_row_type[(uint) create_info.row_type]);
|
||||
}
|
||||
if (share->transactional != HA_CHOICE_UNDEF)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" TRANSACTIONAL="));
|
||||
packet->append(ha_choice_values[(uint) share->transactional], 1);
|
||||
packet->append(ha_choice_values[(uint) share->transactional]);
|
||||
}
|
||||
if (share->table_type == TABLE_TYPE_SEQUENCE)
|
||||
packet->append(STRING_WITH_LEN(" SEQUENCE=1"));
|
||||
|
|
@ -1966,8 +1991,8 @@ static void add_table_options(THD *thd, TABLE *table,
|
|||
}
|
||||
append_create_options(thd, packet, share->option_list, check_options,
|
||||
hton->table_options);
|
||||
append_directory(thd, packet, "DATA", create_info.data_file_name);
|
||||
append_directory(thd, packet, "INDEX", create_info.index_file_name);
|
||||
append_directory(thd, packet, &DATA_clex_str, create_info.data_file_name);
|
||||
append_directory(thd, packet, &INDEX_clex_str, create_info.index_file_name);
|
||||
}
|
||||
|
||||
static void append_period(THD *thd, String *packet, const LEX_CSTRING &start,
|
||||
|
|
@ -2165,7 +2190,8 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||
if (field->charset() != share->table_charset)
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" CHARACTER SET "));
|
||||
packet->append(field->charset()->csname);
|
||||
packet->append(field->charset()->csname,
|
||||
strlen(field->charset()->csname));
|
||||
}
|
||||
/*
|
||||
For string types dump collation name only if
|
||||
|
|
@ -2179,7 +2205,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||
field->charset() != field->vcol_info->expr->collation.collation))
|
||||
{
|
||||
packet->append(STRING_WITH_LEN(" COLLATE "));
|
||||
packet->append(field->charset()->name);
|
||||
packet->append(field->charset()->name, strlen(field->charset()->name));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2287,7 +2313,7 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list,
|
|||
bool found_primary=0;
|
||||
packet->append(STRING_WITH_LEN(",\n "));
|
||||
|
||||
if (i == primary_key && !strcmp(key_info->name.str, primary_key_name))
|
||||
if (i == primary_key && !strcmp(key_info->name.str, primary_key_name.str))
|
||||
{
|
||||
found_primary=1;
|
||||
/*
|
||||
|
|
@ -2900,22 +2926,23 @@ void mysqld_list_processes(THD *thd,const char *user, bool verbose)
|
|||
|
||||
ulonglong now= microsecond_interval_timer();
|
||||
|
||||
while (auto thd_info= arg.thread_infos.get())
|
||||
while (thread_info *thd_info= arg.thread_infos.get())
|
||||
{
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(thd_info->thread_id);
|
||||
protocol->store(thd_info->user, system_charset_info);
|
||||
protocol->store(thd_info->host, system_charset_info);
|
||||
protocol->store(thd_info->db, system_charset_info);
|
||||
protocol->store(thd_info->user, strlen(thd_info->user), system_charset_info);
|
||||
protocol->store(thd_info->host, strlen(thd_info->host), system_charset_info);
|
||||
protocol->store_string_or_null(thd_info->db, system_charset_info);
|
||||
if (thd_info->proc_info)
|
||||
protocol->store(thd_info->proc_info, system_charset_info);
|
||||
protocol->store(thd_info->proc_info, strlen(thd_info->proc_info),
|
||||
system_charset_info);
|
||||
else
|
||||
protocol->store(command_name[thd_info->command].str, system_charset_info);
|
||||
protocol->store(&command_name[thd_info->command], system_charset_info);
|
||||
if (thd_info->start_time && now > thd_info->start_time)
|
||||
protocol->store_long((now - thd_info->start_time) / HRTIME_RESOLUTION);
|
||||
else
|
||||
protocol->store_null();
|
||||
protocol->store(thd_info->state_info, system_charset_info);
|
||||
protocol->store_string_or_null(thd_info->state_info, system_charset_info);
|
||||
if (thd_info->query_string.length())
|
||||
protocol->store(thd_info->query_string.str(),
|
||||
thd_info->query_string.length(),
|
||||
|
|
@ -3058,19 +3085,19 @@ void select_result_text_buffer::save_to(String *res)
|
|||
{
|
||||
List_iterator<char*> it(rows);
|
||||
char **row;
|
||||
res->append("#\n");
|
||||
res->append(STRING_WITH_LEN("#\n"));
|
||||
while ((row= it++))
|
||||
{
|
||||
res->append("# explain: ");
|
||||
res->append(STRING_WITH_LEN("# explain: "));
|
||||
for (int i=0; i < n_columns; i++)
|
||||
{
|
||||
if (i)
|
||||
res->append('\t');
|
||||
res->append(row[i]);
|
||||
res->append(row[i], strlen(row[i]));
|
||||
}
|
||||
res->append("\n");
|
||||
res->append('\n');
|
||||
}
|
||||
res->append("#\n");
|
||||
res->append(STRING_WITH_LEN("#\n"));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -5514,7 +5541,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
|||
if (share->page_checksum != HA_CHOICE_UNDEF)
|
||||
{
|
||||
str.qs_append(STRING_WITH_LEN(" page_checksum="));
|
||||
str.qs_append(ha_choice_values[(uint) share->page_checksum]);
|
||||
str.qs_append(&ha_choice_values[(uint) share->page_checksum]);
|
||||
}
|
||||
|
||||
if (share->db_create_options & HA_OPTION_DELAY_KEY_WRITE)
|
||||
|
|
@ -5523,7 +5550,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
|||
if (share->row_type != ROW_TYPE_DEFAULT)
|
||||
{
|
||||
str.qs_append(STRING_WITH_LEN(" row_format="));
|
||||
str.qs_append(ha_row_type[(uint) share->row_type]);
|
||||
str.qs_append(&ha_row_type[(uint) share->row_type]);
|
||||
}
|
||||
|
||||
if (share->key_block_size)
|
||||
|
|
@ -5555,7 +5582,7 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
|||
HA_CHOICE_NO : HA_CHOICE_YES);
|
||||
|
||||
str.qs_append(STRING_WITH_LEN(" transactional="));
|
||||
str.qs_append(ha_choice_values[choice]);
|
||||
str.qs_append(&ha_choice_values[choice]);
|
||||
}
|
||||
append_create_options(thd, &str, share->option_list, false, 0);
|
||||
|
||||
|
|
@ -5564,8 +5591,8 @@ static int get_schema_tables_record(THD *thd, TABLE_LIST *tables,
|
|||
HA_CREATE_INFO create_info;
|
||||
create_info.init();
|
||||
file->update_create_info(&create_info);
|
||||
append_directory(thd, &str, "DATA", create_info.data_file_name);
|
||||
append_directory(thd, &str, "INDEX", create_info.index_file_name);
|
||||
append_directory(thd, &str, &DATA_clex_str, create_info.data_file_name);
|
||||
append_directory(thd, &str, &INDEX_clex_str, create_info.index_file_name);
|
||||
}
|
||||
|
||||
if (str.length())
|
||||
|
|
@ -6978,7 +7005,7 @@ static int get_schema_constraints_record(THD *thd, TABLE_LIST *tables,
|
|||
if (i != primary_key && !(key_info->flags & HA_NOSAME))
|
||||
continue;
|
||||
|
||||
if (i == primary_key && !strcmp(key_info->name.str, primary_key_name))
|
||||
if (i == primary_key && !strcmp(key_info->name.str, primary_key_name.str))
|
||||
{
|
||||
if (store_constraints(thd, table, db_name, table_name,
|
||||
key_info->name.str, key_info->name.length,
|
||||
|
|
@ -7247,7 +7274,7 @@ static void collect_partition_expr(THD *thd, List<const char> &field_list,
|
|||
{
|
||||
append_identifier(thd, str, field_str, strlen(field_str));
|
||||
if (--no_fields != 0)
|
||||
str->append(",");
|
||||
str->append(',');
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -7340,7 +7367,7 @@ static int get_partition_column_description(THD *thd, partition_info *part_info,
|
|||
if (col_val->max_value)
|
||||
tmp_str.append(STRING_WITH_LEN("MAXVALUE"));
|
||||
else if (col_val->null_value)
|
||||
tmp_str.append("NULL");
|
||||
tmp_str.append(NULL_clex_str);
|
||||
else
|
||||
{
|
||||
Item *item= col_val->item_expression;
|
||||
|
|
@ -7353,7 +7380,7 @@ static int get_partition_column_description(THD *thd, partition_info *part_info,
|
|||
tmp_str.append(val);
|
||||
}
|
||||
if (i != num_elements - 1)
|
||||
tmp_str.append(",");
|
||||
tmp_str.append(',');
|
||||
}
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
|
@ -7514,9 +7541,9 @@ static int get_schema_partitions_record(THD *thd, TABLE_LIST *tables,
|
|||
tmp_res.length(0);
|
||||
if (part_elem->has_null_value)
|
||||
{
|
||||
tmp_str.append(STRING_WITH_LEN("NULL"));
|
||||
tmp_str.append(NULL_clex_str);
|
||||
if (num_items > 0)
|
||||
tmp_str.append(",");
|
||||
tmp_str.append(',');
|
||||
}
|
||||
while ((list_value= list_val_it++))
|
||||
{
|
||||
|
|
@ -7528,7 +7555,7 @@ static int get_schema_partitions_record(THD *thd, TABLE_LIST *tables,
|
|||
tmp_str))
|
||||
DBUG_RETURN(1);
|
||||
if (part_info->part_field_list.elements > 1U)
|
||||
tmp_str.append(")");
|
||||
tmp_str.append(')');
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -7539,7 +7566,7 @@ static int get_schema_partitions_record(THD *thd, TABLE_LIST *tables,
|
|||
tmp_str.append(tmp_res);
|
||||
}
|
||||
if (--num_items != 0)
|
||||
tmp_str.append(",");
|
||||
tmp_str.append(',');
|
||||
}
|
||||
table->field[11]->store(tmp_str.ptr(), tmp_str.length(), cs);
|
||||
table->field[11]->set_notnull();
|
||||
|
|
@ -8174,7 +8201,7 @@ int make_schemata_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||
if (lex->wild && lex->wild->ptr())
|
||||
{
|
||||
buffer.append(STRING_WITH_LEN(" ("));
|
||||
buffer.append(lex->wild->ptr());
|
||||
buffer.append(*lex->wild);
|
||||
buffer.append(')');
|
||||
}
|
||||
field->set_name(thd, &buffer);
|
||||
|
|
@ -8198,7 +8225,7 @@ int make_table_names_old_format(THD *thd, ST_SCHEMA_TABLE *schema_table)
|
|||
if (lex->wild && lex->wild->ptr())
|
||||
{
|
||||
buffer.append(STRING_WITH_LEN(" ("));
|
||||
buffer.append(lex->wild->ptr());
|
||||
buffer.append(*lex->wild);
|
||||
buffer.append(')');
|
||||
}
|
||||
Item_field *field= new (thd->mem_root) Item_field(thd, context, field_name);
|
||||
|
|
@ -10076,19 +10103,19 @@ char *thd_get_error_context_description(THD *thd, char *buffer,
|
|||
if (sctx->host)
|
||||
{
|
||||
str.append(' ');
|
||||
str.append(sctx->host);
|
||||
str.append(sctx->host, strlen(sctx->host));
|
||||
}
|
||||
|
||||
if (sctx->ip)
|
||||
{
|
||||
str.append(' ');
|
||||
str.append(sctx->ip);
|
||||
str.append(sctx->ip, strlen(sctx->ip));
|
||||
}
|
||||
|
||||
if (sctx->user)
|
||||
{
|
||||
str.append(' ');
|
||||
str.append(sctx->user);
|
||||
str.append(sctx->user, strlen(sctx->user));
|
||||
}
|
||||
|
||||
/* Don't wait if LOCK_thd_data is used as this could cause a deadlock */
|
||||
|
|
@ -10097,7 +10124,7 @@ char *thd_get_error_context_description(THD *thd, char *buffer,
|
|||
if (const char *info= thread_state_info(thd))
|
||||
{
|
||||
str.append(' ');
|
||||
str.append(info);
|
||||
str.append(info, strlen(info));
|
||||
}
|
||||
|
||||
if (thd->query())
|
||||
|
|
|
|||
|
|
@ -332,10 +332,6 @@ class Static_binary_string : public Sql_alloc
|
|||
int4store(Ptr + position,value);
|
||||
}
|
||||
|
||||
void qs_append(const char *str)
|
||||
{
|
||||
qs_append(str, (uint32)strlen(str));
|
||||
}
|
||||
void qs_append(const LEX_CSTRING *ls)
|
||||
{
|
||||
DBUG_ASSERT(ls->length < UINT_MAX32 &&
|
||||
|
|
@ -390,9 +386,6 @@ class Binary_string: public Static_binary_string
|
|||
init_private_data();
|
||||
(void) real_alloc(length_arg);
|
||||
}
|
||||
explicit Binary_string(const char *str)
|
||||
:Binary_string(str, strlen(str))
|
||||
{ }
|
||||
/*
|
||||
NOTE: If one intend to use the c_ptr() method, the following two
|
||||
contructors need the size of memory for STR to be at least LEN+1 (to make
|
||||
|
|
@ -418,7 +411,10 @@ class Binary_string: public Static_binary_string
|
|||
alloced= thread_specific= 0;
|
||||
}
|
||||
|
||||
~Binary_string() { free(); }
|
||||
~Binary_string()
|
||||
{
|
||||
free();
|
||||
}
|
||||
|
||||
/* Mark variable thread specific it it's not allocated already */
|
||||
inline void set_thread_specific()
|
||||
|
|
@ -500,10 +496,20 @@ class Binary_string: public Static_binary_string
|
|||
return old;
|
||||
}
|
||||
|
||||
inline void set_quick(char *str, size_t arg_length)
|
||||
/*
|
||||
This is used to set a new buffer for String.
|
||||
However if the String already has an allocated buffer, it will
|
||||
keep that one.
|
||||
It's not to be used to set the value or length of the string.
|
||||
*/
|
||||
inline void set_buffer_if_not_allocated(char *str, size_t arg_length)
|
||||
{
|
||||
if (!alloced)
|
||||
{
|
||||
/*
|
||||
Following should really be set_str(str, 0), but some code may
|
||||
depend on that the String lenth is same as buffer length.
|
||||
*/
|
||||
Static_binary_string::set(str, arg_length);
|
||||
Alloced_length= (uint32) arg_length;
|
||||
}
|
||||
|
|
@ -660,8 +666,9 @@ class Binary_string: public Static_binary_string
|
|||
my_free(Ptr);
|
||||
}
|
||||
Alloced_length= extra_alloc= 0;
|
||||
Static_binary_string::set(NULL, 0); // Safety
|
||||
Static_binary_string::set(NULL, 0); // Safety, probably not needed
|
||||
}
|
||||
|
||||
inline bool alloc(size_t arg_length)
|
||||
{
|
||||
/*
|
||||
|
|
@ -771,10 +778,6 @@ class String: public Charset, public Binary_string
|
|||
String(size_t length_arg)
|
||||
:Binary_string(length_arg)
|
||||
{ }
|
||||
String(const char *str, CHARSET_INFO *cs)
|
||||
:Charset(cs),
|
||||
Binary_string(str)
|
||||
{ }
|
||||
/*
|
||||
NOTE: If one intend to use the c_ptr() method, the following two
|
||||
contructors need the size of memory for STR to be at least LEN+1 (to make
|
||||
|
|
@ -809,9 +812,10 @@ class String: public Charset, public Binary_string
|
|||
set_charset(cs);
|
||||
}
|
||||
bool set_ascii(const char *str, size_t arg_length);
|
||||
inline void set_quick(char *str,size_t arg_length, CHARSET_INFO *cs)
|
||||
inline void set_buffer_if_not_allocated(char *str,size_t arg_length,
|
||||
CHARSET_INFO *cs)
|
||||
{
|
||||
Binary_string::set_quick(str, arg_length);
|
||||
Binary_string::set_buffer_if_not_allocated(str, arg_length);
|
||||
set_charset(cs);
|
||||
}
|
||||
bool set_int(longlong num, bool unsigned_flag, CHARSET_INFO *cs);
|
||||
|
|
@ -931,8 +935,8 @@ class String: public Charset, public Binary_string
|
|||
bool append_introducer_and_hex(const String *str)
|
||||
{
|
||||
return
|
||||
append(STRING_WITH_LEN("_")) ||
|
||||
append(str->charset()->csname) ||
|
||||
append('_') ||
|
||||
append(str->charset()->csname, strlen(str->charset()->csname)) ||
|
||||
append(STRING_WITH_LEN(" 0x")) ||
|
||||
append_hex(str->ptr(), (uint32) str->length());
|
||||
}
|
||||
|
|
@ -946,10 +950,6 @@ class String: public Charset, public Binary_string
|
|||
}
|
||||
|
||||
// Append with optional character set conversion from ASCII (e.g. to UCS2)
|
||||
bool append(const char *s)
|
||||
{
|
||||
return append(s, strlen(s));
|
||||
}
|
||||
bool append(const LEX_STRING *ls)
|
||||
{
|
||||
DBUG_ASSERT(ls->length < UINT_MAX32 &&
|
||||
|
|
@ -1015,12 +1015,6 @@ class String: public Charset, public Binary_string
|
|||
{
|
||||
return append_for_single_quote(s->ptr(), s->length());
|
||||
}
|
||||
bool append_for_single_quote(const char *st)
|
||||
{
|
||||
size_t len= strlen(st);
|
||||
DBUG_ASSERT(len < UINT_MAX32);
|
||||
return append_for_single_quote(st, (uint32) len);
|
||||
}
|
||||
|
||||
void swap(String &s)
|
||||
{
|
||||
|
|
@ -1083,18 +1077,6 @@ class BinaryStringBuffer : public Binary_string
|
|||
BinaryStringBuffer() : Binary_string(buff, buff_sz) { length(0); }
|
||||
};
|
||||
|
||||
|
||||
class String_space: public String
|
||||
{
|
||||
public:
|
||||
String_space(uint n)
|
||||
{
|
||||
if (fill(n, ' '))
|
||||
set("", 0, &my_charset_bin);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
static inline bool check_if_only_end_space(CHARSET_INFO *cs,
|
||||
const char *str,
|
||||
const char *end)
|
||||
|
|
|
|||
|
|
@ -61,7 +61,11 @@
|
|||
#include <io.h>
|
||||
#endif
|
||||
|
||||
const char *primary_key_name="PRIMARY";
|
||||
const LEX_CSTRING primary_key_name= { STRING_WITH_LEN("PRIMARY") };
|
||||
static const LEX_CSTRING generated_by_server=
|
||||
{ STRING_WITH_LEN(" /* generated by server */") };
|
||||
static const LEX_CSTRING SEQUENCE_clex_str= { STRING_WITH_LEN("SEQUENCE") };
|
||||
static const LEX_CSTRING TABLE_clex_str= { STRING_WITH_LEN("TABLE") };
|
||||
|
||||
static int check_if_keyname_exists(const char *name,KEY *start, KEY *end);
|
||||
static char *make_unique_key_name(THD *, const char *, KEY *, KEY *);
|
||||
|
|
@ -2241,7 +2245,9 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||
bool non_tmp_table_deleted= 0;
|
||||
bool is_drop_tmp_if_exists_added= 0;
|
||||
bool was_view= 0, was_table= 0, log_if_exists= if_exists;
|
||||
const char *object_to_drop= (drop_sequence) ? "SEQUENCE" : "TABLE";
|
||||
const LEX_CSTRING *object_to_drop= ((drop_sequence) ?
|
||||
&SEQUENCE_clex_str :
|
||||
&TABLE_clex_str);
|
||||
String normal_tables;
|
||||
String built_trans_tmp_query, built_non_trans_tmp_query;
|
||||
DBUG_ENTER("mysql_rm_table_no_locks");
|
||||
|
|
@ -2286,13 +2292,13 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||
if (!dont_log_query)
|
||||
{
|
||||
built_trans_tmp_query.set_charset(system_charset_info);
|
||||
built_trans_tmp_query.append("DROP TEMPORARY ");
|
||||
built_trans_tmp_query.append(STRING_WITH_LEN("DROP TEMPORARY "));
|
||||
built_trans_tmp_query.append(object_to_drop);
|
||||
built_trans_tmp_query.append(' ');
|
||||
if (thd->is_current_stmt_binlog_format_row() || if_exists)
|
||||
{
|
||||
is_drop_tmp_if_exists_added= true;
|
||||
built_trans_tmp_query.append("IF EXISTS ");
|
||||
built_trans_tmp_query.append(STRING_WITH_LEN("IF EXISTS "));
|
||||
}
|
||||
built_non_trans_tmp_query.set_charset(system_charset_info);
|
||||
built_non_trans_tmp_query.copy(built_trans_tmp_query);
|
||||
|
|
@ -2400,10 +2406,10 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||
is_drop_tmp_if_exists_added )
|
||||
{
|
||||
append_identifier(thd, built_ptr_query, &db);
|
||||
built_ptr_query->append(".");
|
||||
built_ptr_query->append('.');
|
||||
}
|
||||
append_identifier(thd, built_ptr_query, &table_name);
|
||||
built_ptr_query->append(",");
|
||||
built_ptr_query->append(',');
|
||||
}
|
||||
/*
|
||||
This means that a temporary table was droped and as such there
|
||||
|
|
@ -2670,11 +2676,11 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||
if (thd->db.str == NULL || cmp(&db, &thd->db) != 0)
|
||||
{
|
||||
append_identifier(thd, &normal_tables, &db);
|
||||
normal_tables.append(".");
|
||||
normal_tables.append('.');
|
||||
}
|
||||
|
||||
append_identifier(thd, &normal_tables, &table_name);
|
||||
normal_tables.append(",");
|
||||
normal_tables.append(',');
|
||||
}
|
||||
DBUG_PRINT("table", ("table: %p s: %p", table->table,
|
||||
table->table ? table->table->s : NULL));
|
||||
|
|
@ -2718,7 +2724,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||
{
|
||||
/* Chop of the last comma */
|
||||
built_non_trans_tmp_query.chop();
|
||||
built_non_trans_tmp_query.append(" /* generated by server */");
|
||||
built_non_trans_tmp_query.append(generated_by_server);
|
||||
error |= (thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
built_non_trans_tmp_query.ptr(),
|
||||
built_non_trans_tmp_query.length(),
|
||||
|
|
@ -2730,7 +2736,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||
{
|
||||
/* Chop of the last comma */
|
||||
built_trans_tmp_query.chop();
|
||||
built_trans_tmp_query.append(" /* generated by server */");
|
||||
built_trans_tmp_query.append(generated_by_server);
|
||||
error |= (thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
built_trans_tmp_query.ptr(),
|
||||
built_trans_tmp_query.length(),
|
||||
|
|
@ -2745,24 +2751,24 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists,
|
|||
uint32 comment_len;
|
||||
|
||||
built_query.set_charset(thd->charset());
|
||||
built_query.append("DROP ");
|
||||
built_query.append(STRING_WITH_LEN("DROP "));
|
||||
built_query.append(object_to_drop);
|
||||
built_query.append(' ');
|
||||
if (log_if_exists)
|
||||
built_query.append("IF EXISTS ");
|
||||
built_query.append(STRING_WITH_LEN("IF EXISTS "));
|
||||
|
||||
/* Preserve comment in original query */
|
||||
if ((comment_len= comment_length(thd, if_exists ? 17:9,
|
||||
&comment_start)))
|
||||
{
|
||||
built_query.append(comment_start, comment_len);
|
||||
built_query.append(" ");
|
||||
built_query.append(' ');
|
||||
}
|
||||
|
||||
/* Chop of the last comma */
|
||||
normal_tables.chop();
|
||||
built_query.append(normal_tables.ptr(), normal_tables.length());
|
||||
built_query.append(" /* generated by server */");
|
||||
built_query.append(generated_by_server);
|
||||
error |= (thd->binlog_query(THD::STMT_QUERY_TYPE,
|
||||
built_query.ptr(),
|
||||
built_query.length(),
|
||||
|
|
@ -2845,7 +2851,7 @@ bool log_drop_table(THD *thd, const LEX_CSTRING *db_name,
|
|||
query.append(STRING_WITH_LEN("TEMPORARY "));
|
||||
query.append(STRING_WITH_LEN("TABLE IF EXISTS "));
|
||||
append_identifier(thd, &query, db_name);
|
||||
query.append(".");
|
||||
query.append('.');
|
||||
append_identifier(thd, &query, table_name);
|
||||
query.append(STRING_WITH_LEN("/* Generated to handle "
|
||||
"failed CREATE OR REPLACE */"));
|
||||
|
|
@ -2956,9 +2962,9 @@ static int sort_keys(KEY *a, KEY *b)
|
|||
/* Sort NOT NULL keys before other keys */
|
||||
return (a_flags & HA_NULL_PART_KEY) ? 1 : -1;
|
||||
}
|
||||
if (a->name.str == primary_key_name)
|
||||
if (a->name.str == primary_key_name.str)
|
||||
return -1;
|
||||
if (b->name.str == primary_key_name)
|
||||
if (b->name.str == primary_key_name.str)
|
||||
return 1;
|
||||
/* Sort keys don't containing partial segments before others */
|
||||
if ((a_flags ^ b_flags) & HA_KEY_HAS_PART_KEY_SEG)
|
||||
|
|
@ -3616,7 +3622,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
if (!(file->ha_table_flags() & HA_CAN_TABLES_WITHOUT_ROLLBACK))
|
||||
{
|
||||
my_error(ER_ILLEGAL_HA_CREATE_OPTION, MYF(0), file->table_type(),
|
||||
"SEQUENCE");
|
||||
SEQUENCE_clex_str.str);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
|
@ -3864,13 +3870,14 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
else
|
||||
(*key_count)--;
|
||||
if (key->name.str && !tmp_table && (key->type != Key::PRIMARY) &&
|
||||
!my_strcasecmp(system_charset_info, key->name.str, primary_key_name))
|
||||
!my_strcasecmp(system_charset_info, key->name.str,
|
||||
primary_key_name.str))
|
||||
{
|
||||
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name.str);
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
if (key->type == Key::PRIMARY && key->name.str &&
|
||||
my_strcasecmp(system_charset_info, key->name.str, primary_key_name) != 0)
|
||||
my_strcasecmp(system_charset_info, key->name.str, primary_key_name.str) != 0)
|
||||
{
|
||||
bool sav_abort_on_warning= thd->abort_on_warning;
|
||||
thd->abort_on_warning= FALSE; /* Don't make an error out of this. */
|
||||
|
|
@ -3891,7 +3898,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
{
|
||||
if (key->name.str == ignore_key || key->type == Key::FOREIGN_KEY)
|
||||
continue;
|
||||
/* Create the key->ame based on the first column (if not given) */
|
||||
/* Create the key name based on the first column (if not given) */
|
||||
if (key->type == Key::PRIMARY)
|
||||
{
|
||||
if (primary_key)
|
||||
|
|
@ -3900,7 +3907,7 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
|
|||
MYF(0));
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
key_name=primary_key_name;
|
||||
key_name= primary_key_name.str;
|
||||
primary_key=1;
|
||||
}
|
||||
else if (!(key_name= key->name.str))
|
||||
|
|
@ -5696,7 +5703,7 @@ make_unique_key_name(THD *thd, const char *field_name,KEY *start,KEY *end)
|
|||
char buff[MAX_FIELD_NAME],*buff_end;
|
||||
|
||||
if (!check_if_keyname_exists(field_name,start,end) &&
|
||||
my_strcasecmp(system_charset_info,field_name,primary_key_name))
|
||||
my_strcasecmp(system_charset_info,field_name,primary_key_name.str))
|
||||
return (char*) field_name; // Use fieldname
|
||||
buff_end=strmake(buff,field_name, sizeof(buff)-4);
|
||||
|
||||
|
|
@ -6713,7 +6720,7 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info,
|
|||
key->type == Key::PRIMARY &&
|
||||
table->s->primary_key != MAX_KEY &&
|
||||
(keyname= table->s->key_info[table->s->primary_key].name.str) &&
|
||||
my_strcasecmp(system_charset_info, keyname, primary_key_name) == 0;
|
||||
my_strcasecmp(system_charset_info, keyname, primary_key_name.str) == 0;
|
||||
if (dup_primary_key)
|
||||
goto remove_key;
|
||||
|
||||
|
|
@ -6722,7 +6729,7 @@ handle_if_exists_options(THD *thd, TABLE *table, Alter_info *alter_info,
|
|||
if ((keyname= key->name.str) == NULL)
|
||||
{
|
||||
if (key->type == Key::PRIMARY)
|
||||
keyname= primary_key_name;
|
||||
keyname= primary_key_name.str;
|
||||
else
|
||||
{
|
||||
List_iterator<Key_part_spec> part_it(key->columns);
|
||||
|
|
@ -7437,7 +7444,7 @@ static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
|
|||
const KEY* const new_pk= (ha_alter_info->key_count > 0 &&
|
||||
(!my_strcasecmp(system_charset_info,
|
||||
ha_alter_info->key_info_buffer->name.str,
|
||||
primary_key_name) ||
|
||||
primary_key_name.str) ||
|
||||
is_candidate_key(ha_alter_info->key_info_buffer))) ?
|
||||
ha_alter_info->key_info_buffer : NULL;
|
||||
const KEY *const old_pk= table->s->primary_key == MAX_KEY ? NULL :
|
||||
|
|
@ -8918,13 +8925,13 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
{
|
||||
if (!my_strcasecmp(system_charset_info, key_name, rename_key->old_name.str))
|
||||
{
|
||||
if (!my_strcasecmp(system_charset_info, key_name, primary_key_name))
|
||||
if (!my_strcasecmp(system_charset_info, key_name, primary_key_name.str))
|
||||
{
|
||||
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), rename_key->old_name.str);
|
||||
goto err;
|
||||
}
|
||||
else if (!my_strcasecmp(system_charset_info, rename_key->new_name.str,
|
||||
primary_key_name))
|
||||
primary_key_name.str))
|
||||
{
|
||||
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), rename_key->new_name.str);
|
||||
goto err;
|
||||
|
|
@ -9081,7 +9088,7 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
key_type= Key::SPATIAL;
|
||||
else if (key_info->flags & HA_NOSAME)
|
||||
{
|
||||
if (! my_strcasecmp(system_charset_info, key_name, primary_key_name))
|
||||
if (! my_strcasecmp(system_charset_info, key_name, primary_key_name.str))
|
||||
key_type= Key::PRIMARY;
|
||||
else
|
||||
key_type= Key::UNIQUE;
|
||||
|
|
@ -9144,7 +9151,8 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
|
|||
goto err;
|
||||
new_key_list.push_back(key, thd->mem_root);
|
||||
if (key->name.str &&
|
||||
!my_strcasecmp(system_charset_info, key->name.str, primary_key_name))
|
||||
!my_strcasecmp(system_charset_info, key->name.str,
|
||||
primary_key_name.str))
|
||||
{
|
||||
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name.str);
|
||||
goto err;
|
||||
|
|
@ -11837,11 +11845,13 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
|
|||
/* Open one table after the other to keep lock time as short as possible. */
|
||||
for (table= tables; table; table= table->next_local)
|
||||
{
|
||||
char table_name[SAFE_NAME_LEN*2+2];
|
||||
char table_name_buff[SAFE_NAME_LEN*2+2];
|
||||
LEX_CSTRING table_name= { table_name_buff, 0};
|
||||
TABLE *t;
|
||||
TABLE_LIST *save_next_global;
|
||||
|
||||
strxmov(table_name, table->db.str ,".", table->table_name.str, NullS);
|
||||
table_name.length= strxmov(table_name_buff, table->db.str ,".",
|
||||
table->table_name.str, NullS) - table_name_buff;
|
||||
|
||||
/* Remember old 'next' pointer and break the list. */
|
||||
save_next_global= table->next_global;
|
||||
|
|
@ -11861,7 +11871,7 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
|
|||
table->next_global= save_next_global;
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(table_name, system_charset_info);
|
||||
protocol->store(&table_name, system_charset_info);
|
||||
|
||||
if (!t)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ uint explain_filename(THD* thd, const char *from, char *to, uint to_length,
|
|||
enum_explain_filename_mode explain_mode);
|
||||
|
||||
|
||||
extern MYSQL_PLUGIN_IMPORT const char *primary_key_name;
|
||||
extern MYSQL_PLUGIN_IMPORT const LEX_CSTRING primary_key_name;
|
||||
extern mysql_mutex_t LOCK_gdl;
|
||||
|
||||
bool check_engine(THD *, const char *, const char *, HA_CREATE_INFO *);
|
||||
|
|
|
|||
|
|
@ -127,25 +127,26 @@ void TEST_filesort(SORT_FIELD *sortorder,uint s_length)
|
|||
char buff[256],buff2[256];
|
||||
String str(buff,sizeof(buff),system_charset_info);
|
||||
String out(buff2,sizeof(buff2),system_charset_info);
|
||||
const char *sep;
|
||||
DBUG_ASSERT(s_length > 0);
|
||||
DBUG_ENTER("TEST_filesort");
|
||||
|
||||
out.length(0);
|
||||
for (sep=""; s_length-- ; sortorder++, sep=" ")
|
||||
for (; s_length-- ; sortorder++)
|
||||
{
|
||||
out.append(sep);
|
||||
if (sortorder->reverse)
|
||||
out.append('-');
|
||||
if (sortorder->field)
|
||||
{
|
||||
if (sortorder->field->table_name)
|
||||
{
|
||||
out.append(*sortorder->field->table_name);
|
||||
const char *table_name= *sortorder->field->table_name;
|
||||
out.append(table_name, strlen(table_name));
|
||||
out.append('.');
|
||||
}
|
||||
out.append(sortorder->field->field_name.str ?
|
||||
sortorder->field->field_name.str :
|
||||
"tmp_table_column");
|
||||
const char *name= sortorder->field->field_name.str;
|
||||
if (!name)
|
||||
name= "tmp_table_column";
|
||||
out.append(name, strlen(name));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -153,7 +154,9 @@ void TEST_filesort(SORT_FIELD *sortorder,uint s_length)
|
|||
sortorder->item->print(&str, QT_ORDINARY);
|
||||
out.append(str);
|
||||
}
|
||||
out.append(' ');
|
||||
}
|
||||
out.chop(); // Remove last space
|
||||
DBUG_LOCK_FILE;
|
||||
(void) fputs("\nInfo about FILESORT\n",DBUG_FILE);
|
||||
fprintf(DBUG_FILE,"Sortorder: %s\n",out.c_ptr_safe());
|
||||
|
|
@ -186,8 +189,9 @@ TEST_join(JOIN *join)
|
|||
JOIN_TAB *tab= jt_range->start + i;
|
||||
for (ref= 0; ref < tab->ref.key_parts; ref++)
|
||||
{
|
||||
ref_key_parts[i].append(tab->ref.items[ref]->full_name());
|
||||
ref_key_parts[i].append(" ");
|
||||
const char *full_name=(tab->ref.items[ref]->full_name());
|
||||
ref_key_parts[i].append(full_name, strlen(full_name));
|
||||
ref_key_parts[i].append(STRING_WITH_LEN(" "));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ static bool fk_info_append_fields(THD *thd, String *str,
|
|||
while ((field= it++))
|
||||
{
|
||||
res|= append_identifier(thd, str, field);
|
||||
res|= str->append(", ");
|
||||
res|= str->append(STRING_WITH_LEN(", "));
|
||||
}
|
||||
|
||||
str->chop();
|
||||
|
|
@ -81,17 +81,17 @@ static const char *fk_info_str(THD *thd, FOREIGN_KEY_INFO *fk_info)
|
|||
*/
|
||||
|
||||
res|= append_identifier(thd, &str, fk_info->foreign_db);
|
||||
res|= str.append(".");
|
||||
res|= str.append('.');
|
||||
res|= append_identifier(thd, &str, fk_info->foreign_table);
|
||||
res|= str.append(", CONSTRAINT ");
|
||||
res|= str.append(STRING_WITH_LEN(", CONSTRAINT "));
|
||||
res|= append_identifier(thd, &str, fk_info->foreign_id);
|
||||
res|= str.append(" FOREIGN KEY (");
|
||||
res|= str.append(STRING_WITH_LEN(" FOREIGN KEY ("));
|
||||
res|= fk_info_append_fields(thd, &str, &fk_info->foreign_fields);
|
||||
res|= str.append(") REFERENCES ");
|
||||
res|= str.append(STRING_WITH_LEN(") REFERENCES "));
|
||||
res|= append_identifier(thd, &str, fk_info->referenced_db);
|
||||
res|= str.append(".");
|
||||
res|= str.append('.');
|
||||
res|= append_identifier(thd, &str, fk_info->referenced_table);
|
||||
res|= str.append(" (");
|
||||
res|= str.append(STRING_WITH_LEN(" ("));
|
||||
res|= fk_info_append_fields(thd, &str, &fk_info->referenced_fields);
|
||||
res|= str.append(')');
|
||||
|
||||
|
|
|
|||
|
|
@ -1294,8 +1294,9 @@ Type_numeric_attributes::aggregate_numeric_attributes_real(Item **items,
|
|||
|
||||
@retval False on success, true on error.
|
||||
*/
|
||||
bool Type_std_attributes::aggregate_attributes_string(const char *func_name,
|
||||
Item **items, uint nitems)
|
||||
bool Type_std_attributes::
|
||||
aggregate_attributes_string(const LEX_CSTRING &func_name,
|
||||
Item **items, uint nitems)
|
||||
{
|
||||
if (agg_arg_charsets_for_string_result(collation, func_name,
|
||||
items, nitems, 1))
|
||||
|
|
@ -1424,10 +1425,10 @@ CHARSET_INFO *Type_handler::charset_for_protocol(const Item *item) const
|
|||
|
||||
|
||||
bool
|
||||
Type_handler::Item_func_or_sum_illegal_param(const char *funcname) const
|
||||
Type_handler::Item_func_or_sum_illegal_param(const LEX_CSTRING &funcname) const
|
||||
{
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
name().ptr(), funcname);
|
||||
name().ptr(), funcname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -1435,7 +1436,7 @@ Type_handler::Item_func_or_sum_illegal_param(const char *funcname) const
|
|||
bool
|
||||
Type_handler::Item_func_or_sum_illegal_param(const Item_func_or_sum *it) const
|
||||
{
|
||||
return Item_func_or_sum_illegal_param(it->func_name());
|
||||
return Item_func_or_sum_illegal_param(it->func_name_cstring());
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1831,10 +1832,9 @@ Type_handler::bit_and_int_mixture_handler(uint max_char_length)
|
|||
@retval true - on error
|
||||
*/
|
||||
|
||||
bool
|
||||
Type_handler_hybrid_field_type::aggregate_for_result(const char *funcname,
|
||||
Item **items, uint nitems,
|
||||
bool treat_bit_as_number)
|
||||
bool Type_handler_hybrid_field_type::
|
||||
aggregate_for_result(const LEX_CSTRING &funcname, Item **items, uint nitems,
|
||||
bool treat_bit_as_number)
|
||||
{
|
||||
bool bit_and_non_bit_mixture_found= false;
|
||||
uint32 max_display_length;
|
||||
|
|
@ -1862,7 +1862,7 @@ Type_handler_hybrid_field_type::aggregate_for_result(const char *funcname,
|
|||
if (aggregate_for_result(cur))
|
||||
{
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0),
|
||||
type_handler()->name().ptr(), cur->name().ptr(), funcname);
|
||||
type_handler()->name().ptr(), cur->name().ptr(), funcname.str);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -2051,7 +2051,7 @@ Type_collection_std::aggregate_for_min_max(const Type_handler *ha,
|
|||
|
||||
|
||||
bool
|
||||
Type_handler_hybrid_field_type::aggregate_for_min_max(const char *funcname,
|
||||
Type_handler_hybrid_field_type::aggregate_for_min_max(const LEX_CSTRING &funcname,
|
||||
Item **items, uint nitems)
|
||||
{
|
||||
bool bit_and_non_bit_mixture_found= false;
|
||||
|
|
@ -2067,7 +2067,7 @@ Type_handler_hybrid_field_type::aggregate_for_min_max(const char *funcname,
|
|||
if (aggregate_for_min_max(cur))
|
||||
{
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION, MYF(0),
|
||||
type_handler()->name().ptr(), cur->name().ptr(), funcname);
|
||||
type_handler()->name().ptr(), cur->name().ptr(), funcname.str);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -4579,7 +4579,7 @@ Type_handler_timestamp_common::create_item_copy(THD *thd, Item *item) const
|
|||
|
||||
bool Type_handler_int_result::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4605,7 +4605,7 @@ bool Type_handler_int_result::
|
|||
|
||||
bool Type_handler_real_result::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4617,7 +4617,7 @@ bool Type_handler_real_result::
|
|||
|
||||
bool Type_handler_decimal_result::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4630,7 +4630,7 @@ bool Type_handler_decimal_result::
|
|||
|
||||
bool Type_handler_string_result::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &func_name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4646,7 +4646,7 @@ bool Type_handler_string_result::
|
|||
*/
|
||||
bool Type_handler_typelib::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &func_name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4678,7 +4678,7 @@ bool Type_handler_typelib::
|
|||
|
||||
bool Type_handler_blob_common::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &func_name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4692,7 +4692,7 @@ bool Type_handler_blob_common::
|
|||
|
||||
bool Type_handler_date_common::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4704,7 +4704,7 @@ bool Type_handler_date_common::
|
|||
|
||||
bool Type_handler_time_common::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4716,7 +4716,7 @@ bool Type_handler_time_common::
|
|||
|
||||
bool Type_handler_datetime_common::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4728,7 +4728,7 @@ bool Type_handler_datetime_common::
|
|||
|
||||
bool Type_handler_timestamp_common::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -4748,7 +4748,7 @@ bool Type_handler::
|
|||
with aggregating for CASE-alike functions (e.g. COALESCE)
|
||||
for the majority of data type handlers.
|
||||
*/
|
||||
return Item_hybrid_func_fix_attributes(thd, func->func_name(),
|
||||
return Item_hybrid_func_fix_attributes(thd, func->func_name_cstring(),
|
||||
func, func, items, nitems);
|
||||
}
|
||||
|
||||
|
|
@ -6209,9 +6209,9 @@ String *Type_handler_row::
|
|||
if (tmp)
|
||||
str->append(*tmp);
|
||||
else
|
||||
str->append(STRING_WITH_LEN("NULL"));
|
||||
str->append(NULL_clex_str);
|
||||
}
|
||||
str->append(STRING_WITH_LEN(")"));
|
||||
str->append(')');
|
||||
return str;
|
||||
}
|
||||
|
||||
|
|
@ -6231,15 +6231,17 @@ String *Type_handler::
|
|||
|
||||
StringBuffer<STRING_BUFFER_USUAL_SIZE> buf(result->charset());
|
||||
CHARSET_INFO *cs= thd->variables.character_set_client;
|
||||
const char *res_cs_name= result->charset()->csname;
|
||||
const char *collation_name= item->collation.collation->name;
|
||||
|
||||
buf.append('_');
|
||||
buf.append(result->charset()->csname);
|
||||
buf.append(res_cs_name, strlen(res_cs_name));
|
||||
if (cs->escape_with_backslash_is_dangerous)
|
||||
buf.append(' ');
|
||||
append_query_string(cs, &buf, result->ptr(), result->length(),
|
||||
thd->variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES);
|
||||
buf.append(" COLLATE '");
|
||||
buf.append(item->collation.collation->name);
|
||||
buf.append(STRING_WITH_LEN(" COLLATE '"));
|
||||
buf.append(collation_name, strlen(collation_name));
|
||||
buf.append('\'');
|
||||
str->copy(buf);
|
||||
|
||||
|
|
@ -9219,7 +9221,7 @@ bool Type_handler::Column_definition_data_type_info_image(Binary_string *to,
|
|||
// Have *some* columns write type info (let's use string fields as an example)
|
||||
DBUG_EXECUTE_IF("frm_data_type_info_emulate",
|
||||
if (cmp_type() == STRING_RESULT)
|
||||
return to->append("x", 1) ||
|
||||
return to->append_char('x') ||
|
||||
to->append(name().lex_cstring()););
|
||||
if (type_collection() != &type_collection_std)
|
||||
return to->append(name().lex_cstring());
|
||||
|
|
@ -9339,7 +9341,7 @@ bool Type_handler::partition_field_append_value(
|
|||
String *res;
|
||||
|
||||
if (!(res= item_expr->val_str(&buf)))
|
||||
return str->append(STRING_WITH_LEN("NULL"), system_charset_info);
|
||||
return str->append(NULL_clex_str, system_charset_info);
|
||||
|
||||
if (!res->length())
|
||||
return str->append(STRING_WITH_LEN("''"), system_charset_info);
|
||||
|
|
|
|||
|
|
@ -3193,7 +3193,7 @@ class Type_std_attributes: public Type_numeric_attributes
|
|||
aggregate_numeric_attributes_decimal(items, nitems,
|
||||
(unsigned_flag= unsigned_arg));
|
||||
}
|
||||
bool aggregate_attributes_string(const char *func_name,
|
||||
bool aggregate_attributes_string(const LEX_CSTRING &func_name,
|
||||
Item **item, uint nitems);
|
||||
void aggregate_attributes_temporal(uint int_part_length,
|
||||
Item **item, uint nitems)
|
||||
|
|
@ -3201,10 +3201,11 @@ class Type_std_attributes: public Type_numeric_attributes
|
|||
fix_attributes_temporal(int_part_length, find_max_decimals(item, nitems));
|
||||
}
|
||||
|
||||
bool agg_item_collations(DTCollation &c, const char *name,
|
||||
bool agg_item_collations(DTCollation &c, const LEX_CSTRING &name,
|
||||
Item **items, uint nitems,
|
||||
uint flags, int item_sep);
|
||||
bool agg_item_set_converter(const DTCollation &coll, const char *fname,
|
||||
bool agg_item_set_converter(const DTCollation &coll,
|
||||
const LEX_CSTRING &name,
|
||||
Item **args, uint nargs,
|
||||
uint flags, int item_sep);
|
||||
|
||||
|
|
@ -3236,7 +3237,7 @@ class Type_std_attributes: public Type_numeric_attributes
|
|||
|
||||
agg_item_charsets(coll, fname, &args[2], 2, flags, 3)
|
||||
*/
|
||||
bool agg_arg_charsets(DTCollation &c, const char *func_name,
|
||||
bool agg_arg_charsets(DTCollation &c, const LEX_CSTRING &func_name,
|
||||
Item **items, uint nitems,
|
||||
uint flags, int item_sep)
|
||||
{
|
||||
|
|
@ -3249,7 +3250,8 @@ class Type_std_attributes: public Type_numeric_attributes
|
|||
- convert to @@character_set_connection if all arguments are numbers
|
||||
- allow DERIVATION_NONE
|
||||
*/
|
||||
bool agg_arg_charsets_for_string_result(DTCollation &c, const char *func_name,
|
||||
bool agg_arg_charsets_for_string_result(DTCollation &c,
|
||||
const LEX_CSTRING &func_name,
|
||||
Item **items, uint nitems,
|
||||
int item_sep)
|
||||
{
|
||||
|
|
@ -3265,7 +3267,7 @@ class Type_std_attributes: public Type_numeric_attributes
|
|||
- disallow DERIVATION_NONE
|
||||
*/
|
||||
bool agg_arg_charsets_for_string_result_with_comparison(DTCollation &c,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &func_name,
|
||||
Item **items,
|
||||
uint nitems,
|
||||
int item_sep)
|
||||
|
|
@ -3283,7 +3285,7 @@ class Type_std_attributes: public Type_numeric_attributes
|
|||
- don't allow DERIVATION_NONE
|
||||
*/
|
||||
bool agg_arg_charsets_for_comparison(DTCollation &c,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &func_name,
|
||||
Item **items, uint nitems,
|
||||
int item_sep)
|
||||
{
|
||||
|
|
@ -3589,7 +3591,7 @@ class Type_handler
|
|||
longlong value,
|
||||
const SORT_FIELD_ATTR *sort_field) const;
|
||||
|
||||
bool Item_func_or_sum_illegal_param(const char *name) const;
|
||||
bool Item_func_or_sum_illegal_param(const LEX_CSTRING &name) const;
|
||||
bool Item_func_or_sum_illegal_param(const Item_func_or_sum *) const;
|
||||
bool check_null(const Item *item, st_value *value) const;
|
||||
bool Item_send_str(Item *item, Protocol *protocol, st_value *buf) const;
|
||||
|
|
@ -4190,7 +4192,7 @@ class Type_handler
|
|||
virtual bool Item_eq_value(THD *thd, const Type_cmp_attributes *attr,
|
||||
Item *a, Item *b) const= 0;
|
||||
virtual bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items,
|
||||
|
|
@ -4523,7 +4525,7 @@ class Type_handler_row: public Type_handler
|
|||
}
|
||||
bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems)
|
||||
|
|
@ -4820,7 +4822,7 @@ class Type_handler_real_result: public Type_handler_numeric
|
|||
const override;
|
||||
bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems)
|
||||
|
|
@ -4956,7 +4958,7 @@ class Type_handler_decimal_result: public Type_handler_numeric
|
|||
Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
|
||||
bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems)
|
||||
|
|
@ -5190,7 +5192,7 @@ class Type_handler_int_result: public Type_handler_numeric
|
|||
Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
|
||||
bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems) const override;
|
||||
|
|
@ -5454,7 +5456,7 @@ class Type_handler_string_result: public Type_handler
|
|||
Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
|
||||
bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -6135,7 +6137,7 @@ class Type_handler_time_common: public Type_handler_temporal_result
|
|||
Item_cache *Item_get_cache(THD *thd, const Item *item) const override;
|
||||
longlong Item_val_int_unsigned_typecast(Item *item) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems)
|
||||
|
|
@ -6329,7 +6331,7 @@ class Type_handler_date_common: public Type_handler_temporal_with_date
|
|||
bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
|
||||
bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -6470,7 +6472,7 @@ class Type_handler_datetime_common: public Type_handler_temporal_with_date
|
|||
const override;
|
||||
bool Item_func_round_fix_length_and_dec(Item_func_round *) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems)
|
||||
|
|
@ -6634,7 +6636,7 @@ class Type_handler_timestamp_common: public Type_handler_temporal_with_date
|
|||
my_decimal *) const override;
|
||||
bool set_comparator_func(THD *thd, Arg_comparator *cmp) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems)
|
||||
|
|
@ -7121,7 +7123,7 @@ class Type_handler_blob_common: public Type_handler_longstr
|
|||
const Column_definition &def,
|
||||
const handler *file) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -7253,7 +7255,7 @@ class Type_handler_typelib: public Type_handler_general_purpose_string
|
|||
bool Item_func_int_val_fix_length_and_dec(Item_func_int_val*) const override;
|
||||
uint32 max_display_length_for_field(const Conv_source &src) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *,
|
||||
Type_all_attributes *atrr,
|
||||
Item **items, uint nitems)
|
||||
|
|
@ -7456,13 +7458,14 @@ class Type_handler_hybrid_field_type
|
|||
return (m_type_handler= Type_handler::get_handler_by_real_type(type));
|
||||
}
|
||||
bool aggregate_for_comparison(const Type_handler *other);
|
||||
bool aggregate_for_comparison(const char *funcname,
|
||||
bool aggregate_for_comparison(const LEX_CSTRING &funcname,
|
||||
Item **items, uint nitems,
|
||||
bool treat_int_to_uint_as_decimal);
|
||||
bool aggregate_for_result(const Type_handler *other);
|
||||
bool aggregate_for_result(const char *funcname,
|
||||
bool aggregate_for_result(const LEX_CSTRING &funcname,
|
||||
Item **item, uint nitems, bool treat_bit_as_number);
|
||||
bool aggregate_for_min_max(const char *funcname, Item **item, uint nitems);
|
||||
bool aggregate_for_min_max(const LEX_CSTRING &funcname, Item **item,
|
||||
uint nitems);
|
||||
|
||||
bool aggregate_for_num_op(const class Type_aggregator *aggregator,
|
||||
const Type_handler *h0, const Type_handler *h1);
|
||||
|
|
|
|||
|
|
@ -205,8 +205,9 @@ bool Type_collection_geometry::init(Type_handler_data *data)
|
|||
}
|
||||
|
||||
|
||||
bool Type_handler_geometry::check_type_geom_or_binary(const char *opname,
|
||||
const Item *item)
|
||||
bool Type_handler_geometry::
|
||||
check_type_geom_or_binary(const LEX_CSTRING &opname,
|
||||
const Item *item)
|
||||
{
|
||||
const Type_handler *handler= item->type_handler();
|
||||
if (handler->type_handler_for_comparison() == &type_handler_geometry ||
|
||||
|
|
@ -214,14 +215,15 @@ bool Type_handler_geometry::check_type_geom_or_binary(const char *opname,
|
|||
item->collation.collation == &my_charset_bin))
|
||||
return false;
|
||||
my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0),
|
||||
handler->name().ptr(), opname);
|
||||
handler->name().ptr(), opname.str);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_geometry::check_types_geom_or_binary(const char *opname,
|
||||
Item* const *args,
|
||||
uint start, uint end)
|
||||
bool Type_handler_geometry::
|
||||
check_types_geom_or_binary(const LEX_CSTRING &opname,
|
||||
Item* const *args,
|
||||
uint start, uint end)
|
||||
{
|
||||
for (uint i= start; i < end ; i++)
|
||||
{
|
||||
|
|
@ -491,7 +493,7 @@ Field *Type_handler_geometry::make_table_field(MEM_ROOT *root,
|
|||
|
||||
bool Type_handler_geometry::
|
||||
Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *func_name,
|
||||
const LEX_CSTRING &func_name,
|
||||
Type_handler_hybrid_field_type *handler,
|
||||
Type_all_attributes *func,
|
||||
Item **items, uint nitems) const
|
||||
|
|
@ -509,14 +511,16 @@ bool Type_handler_geometry::
|
|||
bool Type_handler_geometry::
|
||||
Item_sum_sum_fix_length_and_dec(Item_sum_sum *item) const
|
||||
{
|
||||
return Item_func_or_sum_illegal_param("sum");
|
||||
LEX_CSTRING name= {STRING_WITH_LEN("sum") };
|
||||
return Item_func_or_sum_illegal_param(name);
|
||||
}
|
||||
|
||||
|
||||
bool Type_handler_geometry::
|
||||
Item_sum_avg_fix_length_and_dec(Item_sum_avg *item) const
|
||||
{
|
||||
return Item_func_or_sum_illegal_param("avg");
|
||||
LEX_CSTRING name= {STRING_WITH_LEN("avg") };
|
||||
return Item_func_or_sum_illegal_param(name);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,9 @@ class Type_handler_geometry: public Type_handler_string_result
|
|||
GEOM_MULTIPOINT = 4, GEOM_MULTILINESTRING = 5, GEOM_MULTIPOLYGON = 6,
|
||||
GEOM_GEOMETRYCOLLECTION = 7
|
||||
};
|
||||
static bool check_type_geom_or_binary(const char *opname, const Item *item);
|
||||
static bool check_types_geom_or_binary(const char *opname,
|
||||
static bool check_type_geom_or_binary(const LEX_CSTRING &opname,
|
||||
const Item *item);
|
||||
static bool check_types_geom_or_binary(const LEX_CSTRING &opname,
|
||||
Item * const *args,
|
||||
uint start, uint end);
|
||||
static const Type_handler_geometry *type_handler_geom_by_type(uint type);
|
||||
|
|
@ -155,7 +156,7 @@ class Type_handler_geometry: public Type_handler_string_result
|
|||
bool Item_func_abs_fix_length_and_dec(Item_func_abs *) const override;
|
||||
bool Item_func_neg_fix_length_and_dec(Item_func_neg *) const override;
|
||||
bool Item_hybrid_func_fix_attributes(THD *thd,
|
||||
const char *name,
|
||||
const LEX_CSTRING &name,
|
||||
Type_handler_hybrid_field_type *h,
|
||||
Type_all_attributes *attr,
|
||||
Item **items, uint nitems) const
|
||||
|
|
|
|||
|
|
@ -689,11 +689,13 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
|||
LEX_CSTRING *name;
|
||||
int i;
|
||||
|
||||
buff.append('(');
|
||||
for (i= 0; (name= names++); i++)
|
||||
{
|
||||
buff.append(i ? ", " : "(");
|
||||
append_identifier(thd, &buff, name);
|
||||
buff.append(", ", 2);
|
||||
}
|
||||
buff.length(buff.length()-2);
|
||||
buff.append(')');
|
||||
}
|
||||
buff.append(STRING_WITH_LEN(" AS "));
|
||||
|
|
@ -1843,11 +1845,11 @@ bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
|
|||
if ((not_exist= my_access(path, F_OK)) || !dd_frm_is_view(thd, path))
|
||||
{
|
||||
char name[FN_REFLEN];
|
||||
my_snprintf(name, sizeof(name), "%s.%s", view->db.str,
|
||||
view->table_name.str);
|
||||
size_t length= my_snprintf(name, sizeof(name), "%s.%s", view->db.str,
|
||||
view->table_name.str);
|
||||
if (non_existant_views.length())
|
||||
non_existant_views.append(',');
|
||||
non_existant_views.append(name);
|
||||
non_existant_views.append(name, length);
|
||||
|
||||
if (!not_exist)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7793,7 +7793,7 @@ alter_list_item:
|
|||
{
|
||||
LEX *lex=Lex;
|
||||
Alter_drop *ad= (new (thd->mem_root)
|
||||
Alter_drop(Alter_drop::KEY, primary_key_name,
|
||||
Alter_drop(Alter_drop::KEY, primary_key_name.str,
|
||||
FALSE));
|
||||
if (unlikely(ad == NULL))
|
||||
MYSQL_YYABORT;
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@ const char *set_to_string(THD *thd, LEX_CSTRING *result, ulonglong set,
|
|||
|
||||
for (uint i= 0; set; i++, set >>= 1)
|
||||
if (set & 1) {
|
||||
tmp.append(lib[i]);
|
||||
tmp.append(lib[i], strlen(lib[i]));
|
||||
tmp.append(',');
|
||||
}
|
||||
|
||||
|
|
@ -396,8 +396,11 @@ const char *flagset_to_string(THD *thd, LEX_CSTRING *result, ulonglong set,
|
|||
// note that the last element is always "default", and it's ignored below
|
||||
for (uint i= 0; lib[i+1]; i++, set >>= 1)
|
||||
{
|
||||
tmp.append(lib[i]);
|
||||
tmp.append(set & 1 ? "=on," : "=off,");
|
||||
tmp.append(lib[i], strlen(lib[i]));
|
||||
if (set & 1)
|
||||
tmp.append(STRING_WITH_LEN("=on,"));
|
||||
else
|
||||
tmp.append(STRING_WITH_LEN("=off,"));
|
||||
}
|
||||
|
||||
result->str= thd->strmake(tmp.ptr(), tmp.length()-1);
|
||||
|
|
|
|||
11
sql/table.cc
11
sql/table.cc
|
|
@ -2800,8 +2800,9 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write,
|
|||
uint add_first_key_parts= 0;
|
||||
longlong ha_option= handler_file->ha_table_flags();
|
||||
keyinfo= share->key_info;
|
||||
uint primary_key= my_strcasecmp(system_charset_info, share->keynames.type_names[0],
|
||||
primary_key_name) ? MAX_KEY : 0;
|
||||
uint primary_key= my_strcasecmp(system_charset_info,
|
||||
share->keynames.type_names[0],
|
||||
primary_key_name.str) ? MAX_KEY : 0;
|
||||
KEY* key_first_info= NULL;
|
||||
|
||||
if (primary_key >= MAX_KEY && keyinfo->flags & HA_NOSAME &&
|
||||
|
|
@ -6157,10 +6158,10 @@ int TABLE::verify_constraints(bool ignore_failure)
|
|||
vcol_type == VCOL_CHECK_FIELD);
|
||||
if (vcol_type == VCOL_CHECK_FIELD)
|
||||
{
|
||||
field_error.append(s->table_name.str);
|
||||
field_error.append(".");
|
||||
field_error.append(s->table_name);
|
||||
field_error.append('.');
|
||||
}
|
||||
field_error.append((*chk)->name.str);
|
||||
field_error.append((*chk)->name);
|
||||
my_error(ER_CONSTRAINT_FAILED,
|
||||
MYF(ignore_failure ? ME_WARNING : 0), field_error.c_ptr(),
|
||||
s->db.str, s->table_name.str);
|
||||
|
|
|
|||
|
|
@ -1769,7 +1769,8 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
|
|||
/* If we have default time zone try to load it */
|
||||
if (default_tzname)
|
||||
{
|
||||
String tmp_tzname2(default_tzname, &my_charset_latin1);
|
||||
String tmp_tzname2(default_tzname, strlen(default_tzname),
|
||||
&my_charset_latin1);
|
||||
/*
|
||||
Time zone tables may be open here, and my_tz_find() may open
|
||||
most of them once more, but this is OK for system tables open
|
||||
|
|
|
|||
|
|
@ -2130,11 +2130,14 @@ create_view_query(THD *thd, uchar** buf, size_t* buf_len)
|
|||
LEX_CSTRING *name;
|
||||
int i;
|
||||
|
||||
buff.append('(');
|
||||
for (i= 0; (name= names++); i++)
|
||||
{
|
||||
buff.append(i ? ", " : "(");
|
||||
append_identifier(thd, &buff, name);
|
||||
buff.append(", ", 2);
|
||||
}
|
||||
if (i)
|
||||
buff.length(buff.length()-2);
|
||||
buff.append(')');
|
||||
}
|
||||
buff.append(STRING_WITH_LEN(" AS "));
|
||||
|
|
@ -2172,25 +2175,25 @@ static int wsrep_drop_table_query(THD* thd, uchar** buf, size_t* buf_len)
|
|||
|
||||
if (found_temp_table)
|
||||
{
|
||||
buff.append("DROP TABLE ");
|
||||
buff.append(STRING_WITH_LEN("DROP TABLE "));
|
||||
if (lex->check_exists)
|
||||
buff.append("IF EXISTS ");
|
||||
buff.append(STRING_WITH_LEN("IF EXISTS "));
|
||||
|
||||
for (TABLE_LIST* table= first_table; table; table= table->next_global)
|
||||
{
|
||||
if (!thd->find_temporary_table(table->db.str, table->table_name.str))
|
||||
{
|
||||
append_identifier(thd, &buff, table->db.str, table->db.length);
|
||||
buff.append(".");
|
||||
buff.append('.');
|
||||
append_identifier(thd, &buff,
|
||||
table->table_name.str, table->table_name.length);
|
||||
buff.append(",");
|
||||
buff.append(',');
|
||||
}
|
||||
}
|
||||
|
||||
/* Chop the last comma */
|
||||
buff.chop();
|
||||
buff.append(" /* generated by wsrep */");
|
||||
buff.append(STRING_WITH_LEN(" /* generated by wsrep */"));
|
||||
|
||||
WSREP_DEBUG("Rewrote '%s' as '%s'", thd->query(), buff.ptr());
|
||||
|
||||
|
|
|
|||
|
|
@ -2586,11 +2586,9 @@ bool ha_connect::MakeKeyWhere(PGLOBAL g, PSTRG qry, OPVAL vop, char q,
|
|||
qry->Append('\'');
|
||||
|
||||
if (kpart->key_part_flag & HA_VAR_LENGTH_PART) {
|
||||
String varchar;
|
||||
uint var_length= uint2korr(ptr);
|
||||
|
||||
varchar.set_quick((char*)ptr + HA_KEY_BLOB_LENGTH,
|
||||
var_length, &my_charset_bin);
|
||||
uint var_length= uint2korr(ptr);
|
||||
String varchar((char*) ptr + HA_KEY_BLOB_LENGTH,
|
||||
var_length, &my_charset_bin);
|
||||
qry->Append(varchar.ptr(), varchar.length(), nq);
|
||||
} else {
|
||||
char strbuff[MAX_FIELD_WIDTH];
|
||||
|
|
@ -3484,7 +3482,7 @@ bool ha_connect::get_error_message(int error, String* buf)
|
|||
strlen(g->Message),
|
||||
&my_charset_latin1).lex_cstring());
|
||||
} else
|
||||
buf->append(STRING_WITH_LEN("Cannot retrieve error message"));
|
||||
buf->append(STRING_WITH_LEN("Cannot retrieve error message"));
|
||||
|
||||
DBUG_RETURN(false);
|
||||
} // end of get_error_message
|
||||
|
|
@ -5422,10 +5420,10 @@ static bool add_field(String* sql, TABTYPE ttp, const char* field_name, int typ,
|
|||
bool q, error = false;
|
||||
const char* type = PLGtoMYSQLtype(typ, dbf, var);
|
||||
|
||||
error |= sql->append('`');
|
||||
error |= sql->append(field_name);
|
||||
error |= sql->append("` ");
|
||||
error |= sql->append(type);
|
||||
error|= sql->append('`');
|
||||
error|= sql->append(field_name, strlen(field_name));
|
||||
error|= sql->append(STRING_WITH_LEN("` "));
|
||||
error|= sql->append(type, strlen(type));
|
||||
|
||||
if (typ == TYPE_STRING ||
|
||||
(len && typ != TYPE_DATE && (typ != TYPE_DOUBLE || dec >= 0))) {
|
||||
|
|
@ -5446,20 +5444,20 @@ static bool add_field(String* sql, TABTYPE ttp, const char* field_name, int typ,
|
|||
} // endif len
|
||||
|
||||
if (v == 'U')
|
||||
error |= sql->append(" UNSIGNED");
|
||||
error |= sql->append(STRING_WITH_LEN(" UNSIGNED"));
|
||||
else if (v == 'Z')
|
||||
error |= sql->append(" ZEROFILL");
|
||||
error |= sql->append(STRING_WITH_LEN(" ZEROFILL"));
|
||||
|
||||
if (key && *key) {
|
||||
error |= sql->append(" ");
|
||||
error |= sql->append(key);
|
||||
error |= sql->append(' ');
|
||||
error |= sql->append(key, strlen(key));
|
||||
} // endif key
|
||||
|
||||
if (tm)
|
||||
error |= sql->append(STRING_WITH_LEN(" NOT NULL"), system_charset_info);
|
||||
|
||||
if (dft && *dft) {
|
||||
error |= sql->append(" DEFAULT ");
|
||||
error |= sql->append(STRING_WITH_LEN(" DEFAULT "));
|
||||
|
||||
if (typ == TYPE_DATE)
|
||||
q = (strspn(dft, "0123456789 -:/") == strlen(dft));
|
||||
|
|
@ -5467,41 +5465,41 @@ static bool add_field(String* sql, TABTYPE ttp, const char* field_name, int typ,
|
|||
q = !IsTypeNum(typ);
|
||||
|
||||
if (q) {
|
||||
error |= sql->append("'");
|
||||
error |= sql->append(STRING_WITH_LEN("'"));
|
||||
error |= sql->append_for_single_quote(dft, strlen(dft));
|
||||
error |= sql->append("'");
|
||||
error |= sql->append('\'');
|
||||
} else
|
||||
error |= sql->append(dft);
|
||||
error |= sql->append(dft, strlen(dft));
|
||||
|
||||
} // endif dft
|
||||
|
||||
if (xtra && *xtra) {
|
||||
error |= sql->append(" ");
|
||||
error |= sql->append(xtra);
|
||||
error |= sql->append(' ');
|
||||
error |= sql->append(xtra, strlen(xtra));
|
||||
} // endif rem
|
||||
|
||||
if (rem && *rem) {
|
||||
error |= sql->append(" COMMENT '");
|
||||
error |= sql->append(STRING_WITH_LEN(" COMMENT '"));
|
||||
error |= sql->append_for_single_quote(rem, strlen(rem));
|
||||
error |= sql->append("'");
|
||||
error |= sql->append(STRING_WITH_LEN("'"));
|
||||
} // endif rem
|
||||
|
||||
if (fmt && *fmt) {
|
||||
switch (ttp) {
|
||||
case TAB_JSON: error |= sql->append(" JPATH='"); break;
|
||||
case TAB_JSON: error |= sql->append(STRING_WITH_LEN(" JPATH='")); break;
|
||||
#if defined(BSON_SUPPORT)
|
||||
case TAB_BSON: error |= sql->append(" JPATH='"); break;
|
||||
case TAB_BSON: error |= sql->append(STRING_WITH_LEN(" JPATH='")); break;
|
||||
#endif // BSON_SUPPORT
|
||||
case TAB_XML: error |= sql->append(" XPATH='"); break;
|
||||
default: error |= sql->append(" FIELD_FORMAT='");
|
||||
case TAB_XML: error |= sql->append(STRING_WITH_LEN(" XPATH='")); break;
|
||||
default: error |= sql->append(STRING_WITH_LEN(" FIELD_FORMAT='"));
|
||||
} // endswitch ttp
|
||||
|
||||
error |= sql->append_for_single_quote(fmt, strlen(fmt));
|
||||
error |= sql->append("'");
|
||||
error |= sql->append('\'');
|
||||
} // endif flag
|
||||
|
||||
if (flag) {
|
||||
error |= sql->append(" FLAG=");
|
||||
error |= sql->append(STRING_WITH_LEN(" FLAG="));
|
||||
error |= sql->append_ulonglong(flag);
|
||||
} // endif flag
|
||||
|
||||
|
|
@ -5537,7 +5535,7 @@ static int init_table_share(THD* thd,
|
|||
|
||||
if (vull != opt->def_value) {
|
||||
oom|= sql->append(' ');
|
||||
oom|= sql->append(opt->name);
|
||||
oom|= sql->append(opt->name, strlen(opt->name));
|
||||
oom|= sql->append('=');
|
||||
oom|= sql->append_ulonglong(vull);
|
||||
} // endif vull
|
||||
|
|
@ -5548,8 +5546,8 @@ static int init_table_share(THD* thd,
|
|||
|
||||
if (vstr) {
|
||||
oom|= sql->append(' ');
|
||||
oom|= sql->append(opt->name);
|
||||
oom|= sql->append("='");
|
||||
oom|= sql->append(opt->name, strlen(opt->name));
|
||||
oom|= sql->append(STRING_WITH_LEN("='"));
|
||||
oom|= sql->append_for_single_quote(vstr, strlen(vstr));
|
||||
oom|= sql->append('\'');
|
||||
} // endif vstr
|
||||
|
|
@ -5560,9 +5558,12 @@ static int init_table_share(THD* thd,
|
|||
|
||||
if (vull != opt->def_value) {
|
||||
oom|= sql->append(' ');
|
||||
oom|= sql->append(opt->name);
|
||||
oom|= sql->append(opt->name, strlen(opt->name));
|
||||
oom|= sql->append('=');
|
||||
oom|= sql->append(vull ? "YES" : "NO");
|
||||
if (vull)
|
||||
oom|= sql->append("YES", 3);
|
||||
else
|
||||
oom|= sql->append("NO", 2);
|
||||
} // endif vull
|
||||
|
||||
break;
|
||||
|
|
@ -5577,7 +5578,7 @@ static int init_table_share(THD* thd,
|
|||
|
||||
if (create_info->connect_string.length) {
|
||||
oom|= sql->append(' ');
|
||||
oom|= sql->append("CONNECTION='");
|
||||
oom|= sql->append(STRING_WITH_LEN("CONNECTION='"));
|
||||
oom|= sql->append_for_single_quote(create_info->connect_string.str,
|
||||
create_info->connect_string.length);
|
||||
oom|= sql->append('\'');
|
||||
|
|
@ -5589,8 +5590,9 @@ static int init_table_share(THD* thd,
|
|||
|
||||
if (create_info->default_table_charset) {
|
||||
oom|= sql->append(' ');
|
||||
oom|= sql->append("CHARSET=");
|
||||
oom|= sql->append(create_info->default_table_charset->csname);
|
||||
oom|= sql->append(STRING_WITH_LEN("CHARSET="));
|
||||
oom|= sql->append(create_info->default_table_charset->csname,
|
||||
strlen(create_info->default_table_charset->csname));
|
||||
|
||||
if (oom)
|
||||
return HA_ERR_OUT_OF_MEM;
|
||||
|
|
|
|||
|
|
@ -1000,19 +1000,17 @@ static bool emit_key_part_element(String *to, KEY_PART_INFO *part,
|
|||
}
|
||||
else if (part->key_part_flag & HA_BLOB_PART)
|
||||
{
|
||||
String blob;
|
||||
uint blob_length= uint2korr(ptr);
|
||||
blob.set_quick((char*) ptr+HA_KEY_BLOB_LENGTH,
|
||||
blob_length, &my_charset_bin);
|
||||
String blob((char*) ptr+HA_KEY_BLOB_LENGTH,
|
||||
blob_length, &my_charset_bin);
|
||||
if (to->append_for_single_quote(&blob))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
else if (part->key_part_flag & HA_VAR_LENGTH_PART)
|
||||
{
|
||||
String varchar;
|
||||
uint var_length= uint2korr(ptr);
|
||||
varchar.set_quick((char*) ptr+HA_KEY_BLOB_LENGTH,
|
||||
var_length, &my_charset_bin);
|
||||
String varchar((char*) ptr+HA_KEY_BLOB_LENGTH,
|
||||
var_length, &my_charset_bin);
|
||||
if (to->append_for_single_quote(&varchar))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
|
@ -1392,7 +1390,7 @@ bool ha_federated::create_where_from_key(String *to,
|
|||
case HA_READ_AFTER_KEY:
|
||||
if (eq_range_arg)
|
||||
{
|
||||
if (tmp.append("1=1")) // Dummy
|
||||
if (tmp.append(STRING_WITH_LEN("1=1"))) // Dummy
|
||||
goto err;
|
||||
break;
|
||||
}
|
||||
|
|
@ -2428,7 +2426,7 @@ int ha_federated::index_read_idx_with_result_set(uchar *buf, uint index,
|
|||
index_string.length(0);
|
||||
sql_query.length(0);
|
||||
|
||||
sql_query.append(share->select_query);
|
||||
sql_query.append(share->select_query, strlen(share->select_query));
|
||||
|
||||
range.key= key;
|
||||
range.length= key_len;
|
||||
|
|
@ -2512,7 +2510,7 @@ int ha_federated::read_range_first(const key_range *start_key,
|
|||
DBUG_ASSERT(!(start_key == NULL && end_key == NULL));
|
||||
|
||||
sql_query.length(0);
|
||||
sql_query.append(share->select_query);
|
||||
sql_query.append(share->select_query, strlen(share->select_query));
|
||||
create_where_from_key(&sql_query,
|
||||
&table->key_info[active_index],
|
||||
start_key, end_key, 0, eq_range_arg);
|
||||
|
|
@ -3168,16 +3166,17 @@ int ha_federated::real_connect()
|
|||
We have established a connection, lets try a simple dummy query just
|
||||
to check that the table and expected columns are present.
|
||||
*/
|
||||
sql_query.append(share->select_query);
|
||||
sql_query.append(share->select_query, strlen(share->select_query));
|
||||
sql_query.append(STRING_WITH_LEN(" WHERE 1=0"));
|
||||
if (mysql_real_query(mysql, sql_query.ptr(), sql_query.length()))
|
||||
{
|
||||
sql_query.length(0);
|
||||
sql_query.append("error: ");
|
||||
sql_query.append(STRING_WITH_LEN("error: "));
|
||||
sql_query.qs_append(mysql_errno(mysql));
|
||||
sql_query.append(" '");
|
||||
sql_query.append(mysql_error(mysql));
|
||||
sql_query.append("'");
|
||||
sql_query.append(STRING_WITH_LEN(" '"));
|
||||
const char *errmsg= mysql_error(mysql);
|
||||
sql_query.append(errmsg, strlen(errmsg));
|
||||
sql_query.append('\'');
|
||||
mysql_close(mysql);
|
||||
mysql= NULL;
|
||||
my_error(ER_FOREIGN_DATA_SOURCE_DOESNT_EXIST, MYF(0), sql_query.ptr());
|
||||
|
|
@ -3242,7 +3241,7 @@ bool ha_federated::get_error_message(int error, String* buf)
|
|||
buf->append(STRING_WITH_LEN("Error on remote system: "));
|
||||
buf->qs_append(remote_error_number);
|
||||
buf->append(STRING_WITH_LEN(": "));
|
||||
buf->append(remote_error_buf);
|
||||
buf->append(remote_error_buf, strlen(remote_error_buf));
|
||||
|
||||
remote_error_number= 0;
|
||||
remote_error_buf[0]= '\0';
|
||||
|
|
|
|||
|
|
@ -937,19 +937,17 @@ static bool emit_key_part_element(String *to, KEY_PART_INFO *part,
|
|||
}
|
||||
else if (part->key_part_flag & HA_BLOB_PART)
|
||||
{
|
||||
String blob;
|
||||
uint blob_length= uint2korr(ptr);
|
||||
blob.set_quick((char*) ptr+HA_KEY_BLOB_LENGTH,
|
||||
blob_length, &my_charset_bin);
|
||||
String blob((char*) ptr+HA_KEY_BLOB_LENGTH,
|
||||
blob_length, &my_charset_bin);
|
||||
if (to->append_for_single_quote(&blob))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
else if (part->key_part_flag & HA_VAR_LENGTH_PART)
|
||||
{
|
||||
String varchar;
|
||||
uint var_length= uint2korr(ptr);
|
||||
varchar.set_quick((char*) ptr+HA_KEY_BLOB_LENGTH,
|
||||
var_length, &my_charset_bin);
|
||||
String varchar((char*) ptr+HA_KEY_BLOB_LENGTH,
|
||||
var_length, &my_charset_bin);
|
||||
if (to->append_for_single_quote(&varchar))
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
|
@ -1271,14 +1269,18 @@ bool ha_federatedx::create_where_from_key(String *to,
|
|||
{
|
||||
if (*ptr++)
|
||||
{
|
||||
LEX_CSTRING constraint;
|
||||
if (ranges[i]->flag == HA_READ_KEY_EXACT)
|
||||
constraint= {STRING_WITH_LEN(" IS NULL ") };
|
||||
else
|
||||
constraint= {STRING_WITH_LEN(" IS NOT NULL ") };
|
||||
/*
|
||||
We got "IS [NOT] NULL" condition against nullable column. We
|
||||
distinguish between "IS NOT NULL" and "IS NULL" by flag. For
|
||||
"IS NULL", flag is set to HA_READ_KEY_EXACT.
|
||||
*/
|
||||
if (emit_key_part_name(&tmp, key_part) ||
|
||||
tmp.append(ranges[i]->flag == HA_READ_KEY_EXACT ?
|
||||
" IS NULL " : " IS NOT NULL "))
|
||||
tmp.append(constraint))
|
||||
goto err;
|
||||
/*
|
||||
We need to adjust pointer and length to be prepared for next
|
||||
|
|
@ -1330,7 +1332,7 @@ bool ha_federatedx::create_where_from_key(String *to,
|
|||
case HA_READ_AFTER_KEY:
|
||||
if (eq_range)
|
||||
{
|
||||
if (tmp.append("1=1")) // Dummy
|
||||
if (tmp.append(STRING_WITH_LEN("1=1"))) // Dummy
|
||||
goto err;
|
||||
break;
|
||||
}
|
||||
|
|
@ -1439,13 +1441,16 @@ static void fill_server(MEM_ROOT *mem_root, FEDERATEDX_SERVER *server,
|
|||
FEDERATEDX_SHARE *share, CHARSET_INFO *table_charset)
|
||||
{
|
||||
char buffer[STRING_BUFFER_USUAL_SIZE];
|
||||
const char *socket_arg= share->socket ? share->socket : "";
|
||||
const char *password_arg= share->password ? share->password : "";
|
||||
|
||||
String key(buffer, sizeof(buffer), &my_charset_bin);
|
||||
String scheme(share->scheme, &my_charset_latin1);
|
||||
String hostname(share->hostname, &my_charset_latin1);
|
||||
String database(share->database, system_charset_info);
|
||||
String username(share->username, system_charset_info);
|
||||
String socket(share->socket ? share->socket : "", files_charset_info);
|
||||
String password(share->password ? share->password : "", &my_charset_bin);
|
||||
String scheme(share->scheme, strlen(share->scheme), &my_charset_latin1);
|
||||
String hostname(share->hostname, strlen(share->hostname), &my_charset_latin1);
|
||||
String database(share->database, strlen(share->database), system_charset_info);
|
||||
String username(share->username, strlen(share->username), system_charset_info);
|
||||
String socket(socket_arg, strlen(socket_arg), files_charset_info);
|
||||
String password(password_arg, strlen(password_arg), &my_charset_bin);
|
||||
DBUG_ENTER("fill_server");
|
||||
|
||||
/* Do some case conversions */
|
||||
|
|
@ -1529,13 +1534,16 @@ static FEDERATEDX_SERVER *get_server(FEDERATEDX_SHARE *share, TABLE *table)
|
|||
FEDERATEDX_SERVER *server= NULL, tmp_server;
|
||||
MEM_ROOT mem_root;
|
||||
char buffer[STRING_BUFFER_USUAL_SIZE];
|
||||
const char *socket_arg= share->socket ? share->socket : "";
|
||||
const char *password_arg= share->password ? share->password : "";
|
||||
|
||||
String key(buffer, sizeof(buffer), &my_charset_bin);
|
||||
String scheme(share->scheme, &my_charset_latin1);
|
||||
String hostname(share->hostname, &my_charset_latin1);
|
||||
String database(share->database, system_charset_info);
|
||||
String username(share->username, system_charset_info);
|
||||
String socket(share->socket ? share->socket : "", files_charset_info);
|
||||
String password(share->password ? share->password : "", &my_charset_bin);
|
||||
String scheme(share->scheme, strlen(share->scheme), &my_charset_latin1);
|
||||
String hostname(share->hostname, strlen(share->hostname), &my_charset_latin1);
|
||||
String database(share->database, strlen(share->database), system_charset_info);
|
||||
String username(share->username, strlen(share->username), system_charset_info);
|
||||
String socket(socket_arg, strlen(socket_arg), files_charset_info);
|
||||
String password(password_arg, strlen(password_arg), &my_charset_bin);
|
||||
DBUG_ENTER("ha_federated.cc::get_server");
|
||||
|
||||
mysql_mutex_assert_owner(&federatedx_mutex);
|
||||
|
|
@ -1637,13 +1645,14 @@ static FEDERATEDX_SHARE *get_share(const char *table_name, TABLE *table)
|
|||
|
||||
if (!(share= (FEDERATEDX_SHARE *) memdup_root(&mem_root, (char*)&tmp_share, sizeof(*share))) ||
|
||||
!(share->share_key= (char*) memdup_root(&mem_root, tmp_share.share_key, tmp_share.share_key_length+1)) ||
|
||||
!(share->select_query= (char*) strmake_root(&mem_root, query.ptr(), query.length())))
|
||||
!(share->select_query.str= (char*) strmake_root(&mem_root, query.ptr(), query.length())))
|
||||
goto error;
|
||||
share->select_query.length= query.length();
|
||||
|
||||
share->mem_root= mem_root;
|
||||
|
||||
DBUG_PRINT("info",
|
||||
("share->select_query %s", share->select_query));
|
||||
("share->select_query %s", share->select_query.str));
|
||||
|
||||
if (!(share->s= get_server(share, table)))
|
||||
goto error;
|
||||
|
|
@ -2822,8 +2831,7 @@ int ha_federatedx::rnd_init(bool scan)
|
|||
if (stored_result)
|
||||
(void) free_result();
|
||||
|
||||
if (io->query(share->select_query,
|
||||
strlen(share->select_query)))
|
||||
if (io->query(share->select_query.str, share->select_query.length))
|
||||
goto error;
|
||||
|
||||
stored_result= io->store_result();
|
||||
|
|
@ -3476,7 +3484,7 @@ bool ha_federatedx::get_error_message(int error, String* buf)
|
|||
buf->append(STRING_WITH_LEN("Error on remote system: "));
|
||||
buf->qs_append(remote_error_number);
|
||||
buf->append(STRING_WITH_LEN(": "));
|
||||
buf->append(remote_error_buf);
|
||||
buf->append(remote_error_buf, strlen(remote_error_buf));
|
||||
/* Ensure string ends with \0 */
|
||||
(void) buf->c_ptr_safe();
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ typedef struct st_federatedx_share {
|
|||
/*
|
||||
the primary select query to be used in rnd_init
|
||||
*/
|
||||
char *select_query;
|
||||
LEX_CSTRING select_query;
|
||||
/*
|
||||
remote host info, parse_url supplies
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -390,9 +390,9 @@ static void init_aria_psi_keys(void)
|
|||
#define init_aria_psi_keys() /* no-op */
|
||||
#endif /* HAVE_PSI_INTERFACE */
|
||||
|
||||
const char *MA_CHECK_INFO= "info";
|
||||
const char *MA_CHECK_WARNING= "warning";
|
||||
const char *MA_CHECK_ERROR= "error";
|
||||
const LEX_CSTRING MA_CHECK_INFO= { STRING_WITH_LEN("info") };
|
||||
const LEX_CSTRING MA_CHECK_WARNING= { STRING_WITH_LEN("warning") };
|
||||
const LEX_CSTRING MA_CHECK_ERROR= { STRING_WITH_LEN("error") };
|
||||
|
||||
/*****************************************************************************
|
||||
** MARIA tables
|
||||
|
|
@ -406,13 +406,13 @@ static handler *maria_create_handler(handlerton *hton,
|
|||
}
|
||||
|
||||
|
||||
static void _ma_check_print(HA_CHECK *param, const char* msg_type,
|
||||
static void _ma_check_print(HA_CHECK *param, const LEX_CSTRING *msg_type,
|
||||
const char *msgbuf)
|
||||
{
|
||||
if (msg_type == MA_CHECK_INFO)
|
||||
if (msg_type == &MA_CHECK_INFO)
|
||||
sql_print_information("%s.%s: %s", param->db_name, param->table_name,
|
||||
msgbuf);
|
||||
else if (msg_type == MA_CHECK_WARNING)
|
||||
else if (msg_type == &MA_CHECK_WARNING)
|
||||
sql_print_warning("%s.%s: %s", param->db_name, param->table_name,
|
||||
msgbuf);
|
||||
else
|
||||
|
|
@ -422,7 +422,7 @@ static void _ma_check_print(HA_CHECK *param, const char* msg_type,
|
|||
|
||||
// collect errors printed by maria_check routines
|
||||
|
||||
static void _ma_check_print_msg(HA_CHECK *param, const char *msg_type,
|
||||
static void _ma_check_print_msg(HA_CHECK *param, const LEX_CSTRING *msg_type,
|
||||
const char *fmt, va_list args)
|
||||
{
|
||||
THD *thd= (THD *) param->thd;
|
||||
|
|
@ -437,7 +437,7 @@ static void _ma_check_print_msg(HA_CHECK *param, const char *msg_type,
|
|||
msg_length= my_vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
|
||||
msgbuf[sizeof(msgbuf) - 1]= 0; // healthy paranoia
|
||||
|
||||
DBUG_PRINT(msg_type, ("message: %s", msgbuf));
|
||||
DBUG_PRINT(msg_type->str, ("message: %s", msgbuf));
|
||||
|
||||
if (!thd->vio_ok())
|
||||
{
|
||||
|
|
@ -449,9 +449,9 @@ static void _ma_check_print_msg(HA_CHECK *param, const char *msg_type,
|
|||
(T_CREATE_MISSING_KEYS | T_SAFE_REPAIR | T_AUTO_REPAIR))
|
||||
{
|
||||
myf flag= 0;
|
||||
if (msg_type == MA_CHECK_INFO)
|
||||
if (msg_type == &MA_CHECK_INFO)
|
||||
flag= ME_NOTE;
|
||||
else if (msg_type == MA_CHECK_WARNING)
|
||||
else if (msg_type == &MA_CHECK_WARNING)
|
||||
flag= ME_WARNING;
|
||||
my_message(ER_NOT_KEYFILE, msgbuf, MYF(flag));
|
||||
if (thd->variables.log_warnings > 2)
|
||||
|
|
@ -470,9 +470,9 @@ static void _ma_check_print_msg(HA_CHECK *param, const char *msg_type,
|
|||
*/
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(name, (uint)length, system_charset_info);
|
||||
protocol->store(param->op_name, system_charset_info);
|
||||
protocol->store(param->op_name, strlen(param->op_name), system_charset_info);
|
||||
protocol->store(msg_type, system_charset_info);
|
||||
protocol->store(msgbuf, (uint)msg_length, system_charset_info);
|
||||
protocol->store(msgbuf, msg_length, system_charset_info);
|
||||
if (protocol->write())
|
||||
sql_print_error("Failed on my_net_write, writing to stderr instead: %s.%s: %s\n",
|
||||
param->db_name, param->table_name, msgbuf);
|
||||
|
|
@ -910,7 +910,7 @@ void _ma_check_print_error(HA_CHECK *param, const char *fmt, ...)
|
|||
if (param->testflag & T_SUPPRESS_ERR_HANDLING)
|
||||
DBUG_VOID_RETURN;
|
||||
va_start(args, fmt);
|
||||
_ma_check_print_msg(param, MA_CHECK_ERROR, fmt, args);
|
||||
_ma_check_print_msg(param, &MA_CHECK_ERROR, fmt, args);
|
||||
va_end(args);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
@ -921,7 +921,7 @@ void _ma_check_print_info(HA_CHECK *param, const char *fmt, ...)
|
|||
va_list args;
|
||||
DBUG_ENTER("_ma_check_print_info");
|
||||
va_start(args, fmt);
|
||||
_ma_check_print_msg(param, MA_CHECK_INFO, fmt, args);
|
||||
_ma_check_print_msg(param, &MA_CHECK_INFO, fmt, args);
|
||||
va_end(args);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
@ -934,7 +934,7 @@ void _ma_check_print_warning(HA_CHECK *param, const char *fmt, ...)
|
|||
param->warning_printed++;
|
||||
param->out_flag |= O_DATA_LOST;
|
||||
va_start(args, fmt);
|
||||
_ma_check_print_msg(param, MA_CHECK_WARNING, fmt, args);
|
||||
_ma_check_print_msg(param, &MA_CHECK_WARNING, fmt, args);
|
||||
va_end(args);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -96,9 +96,9 @@ static MYSQL_THDVAR_ENUM(stats_method, PLUGIN_VAR_RQCMDARG,
|
|||
"and NULLS_IGNORED", NULL, NULL,
|
||||
MI_STATS_METHOD_NULLS_NOT_EQUAL, &myisam_stats_method_typelib);
|
||||
|
||||
const char *MI_CHECK_INFO= "info";
|
||||
const char *MI_CHECK_WARNING= "warning";
|
||||
const char *MI_CHECK_ERROR= "error";
|
||||
const LEX_CSTRING MI_CHECK_INFO= { STRING_WITH_LEN("info") };
|
||||
const LEX_CSTRING MI_CHECK_WARNING= { STRING_WITH_LEN("warning") };
|
||||
const LEX_CSTRING MI_CHECK_ERROR= { STRING_WITH_LEN("error") };
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
/**
|
||||
|
|
@ -135,13 +135,13 @@ static handler *myisam_create_handler(handlerton *hton,
|
|||
}
|
||||
|
||||
|
||||
static void mi_check_print(HA_CHECK *param, const char* msg_type,
|
||||
static void mi_check_print(HA_CHECK *param, const LEX_CSTRING* msg_type,
|
||||
const char *msgbuf)
|
||||
{
|
||||
if (msg_type == MI_CHECK_INFO)
|
||||
if (msg_type == &MI_CHECK_INFO)
|
||||
sql_print_information("%s.%s: %s", param->db_name, param->table_name,
|
||||
msgbuf);
|
||||
else if (msg_type == MI_CHECK_WARNING)
|
||||
else if (msg_type == &MI_CHECK_WARNING)
|
||||
sql_print_warning("%s.%s: %s", param->db_name, param->table_name,
|
||||
msgbuf);
|
||||
else
|
||||
|
|
@ -150,7 +150,7 @@ static void mi_check_print(HA_CHECK *param, const char* msg_type,
|
|||
|
||||
// collect errors printed by mi_check routines
|
||||
|
||||
static void mi_check_print_msg(HA_CHECK *param, const char* msg_type,
|
||||
static void mi_check_print_msg(HA_CHECK *param, const LEX_CSTRING *msg_type,
|
||||
const char *fmt, va_list args)
|
||||
{
|
||||
THD* thd = (THD*)param->thd;
|
||||
|
|
@ -165,7 +165,7 @@ static void mi_check_print_msg(HA_CHECK *param, const char* msg_type,
|
|||
msg_length= my_vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
|
||||
msgbuf[sizeof(msgbuf) - 1] = 0; // healthy paranoia
|
||||
|
||||
DBUG_PRINT(msg_type,("message: %s",msgbuf));
|
||||
DBUG_PRINT(msg_type->str,("message: %s",msgbuf));
|
||||
|
||||
if (!thd->vio_ok())
|
||||
{
|
||||
|
|
@ -177,9 +177,9 @@ static void mi_check_print_msg(HA_CHECK *param, const char* msg_type,
|
|||
T_AUTO_REPAIR))
|
||||
{
|
||||
myf flag= 0;
|
||||
if (msg_type == MI_CHECK_INFO)
|
||||
if (msg_type == &MI_CHECK_INFO)
|
||||
flag= ME_NOTE;
|
||||
else if (msg_type == MI_CHECK_WARNING)
|
||||
else if (msg_type == &MI_CHECK_WARNING)
|
||||
flag= ME_WARNING;
|
||||
my_message(ER_NOT_KEYFILE, msgbuf, MYF(flag));
|
||||
if (thd->variables.log_warnings > 2 && ! thd->log_all_errors)
|
||||
|
|
@ -201,7 +201,7 @@ static void mi_check_print_msg(HA_CHECK *param, const char* msg_type,
|
|||
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(name, length, system_charset_info);
|
||||
protocol->store(param->op_name, system_charset_info);
|
||||
protocol->store(param->op_name, strlen(param->op_name), system_charset_info);
|
||||
protocol->store(msg_type, system_charset_info);
|
||||
protocol->store(msgbuf, msg_length, system_charset_info);
|
||||
if (protocol->write())
|
||||
|
|
@ -615,7 +615,7 @@ void mi_check_print_error(HA_CHECK *param, const char *fmt,...)
|
|||
return;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
mi_check_print_msg(param, MI_CHECK_ERROR, fmt, args);
|
||||
mi_check_print_msg(param, &MI_CHECK_ERROR, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
|
@ -623,7 +623,7 @@ void mi_check_print_info(HA_CHECK *param, const char *fmt,...)
|
|||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
mi_check_print_msg(param, MI_CHECK_INFO, fmt, args);
|
||||
mi_check_print_msg(param, &MI_CHECK_INFO, fmt, args);
|
||||
param->note_printed= 1;
|
||||
va_end(args);
|
||||
}
|
||||
|
|
@ -634,7 +634,7 @@ void mi_check_print_warning(HA_CHECK *param, const char *fmt,...)
|
|||
param->out_flag|= O_DATA_LOST;
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
mi_check_print_msg(param, MI_CHECK_WARNING, fmt, args);
|
||||
mi_check_print_msg(param, &MI_CHECK_WARNING, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user