diff options
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/feedback/sender_thread.cc | 6 | ||||
-rw-r--r-- | plugin/func_test/plugin.cc | 6 | ||||
-rw-r--r-- | plugin/type_inet/item_inetfunc.h | 55 | ||||
-rw-r--r-- | plugin/type_inet/sql_type_inet.cc | 8 | ||||
-rw-r--r-- | plugin/type_inet/sql_type_inet.h | 4 | ||||
-rw-r--r-- | plugin/type_mysql_json/mysql_json.cc | 28 |
6 files changed, 70 insertions, 37 deletions
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc index 73b1bc67e79..1aac71b132a 100644 --- a/plugin/feedback/sender_thread.cc +++ b/plugin/feedback/sender_thread.cc @@ -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'); } diff --git a/plugin/func_test/plugin.cc b/plugin/func_test/plugin.cc index 5e1f1a66fa2..b49f87832d6 100644 --- a/plugin/func_test/plugin.cc +++ b/plugin/func_test/plugin.cc @@ -35,7 +35,11 @@ public: 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); } diff --git a/plugin/type_inet/item_inetfunc.h b/plugin/type_inet/item_inetfunc.h index f74eadb717c..5568bf55bdf 100644 --- a/plugin/type_inet/item_inetfunc.h +++ b/plugin/type_inet/item_inetfunc.h @@ -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 @@ public: 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 @@ public: { } 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 @@ public: { } 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 @@ public: { } 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 @@ public: 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 @@ public: 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 @@ public: 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(); diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc index a3e7a4d6ca1..822502053e0 100644 --- a/plugin/type_inet/sql_type_inet.cc +++ b/plugin/type_inet/sql_type_inet.cc @@ -1044,7 +1044,11 @@ public: 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 @@ public: { StringBufferInet6 tmp; m_value.to_string(&tmp); - str->append("INET6'"); + str->append(STRING_WITH_LEN("INET6'")); str->append(tmp); str->append('\''); } diff --git a/plugin/type_inet/sql_type_inet.h b/plugin/type_inet/sql_type_inet.h index a00b2d35f18..23fb18ec41f 100644 --- a/plugin/type_inet/sql_type_inet.h +++ b/plugin/type_inet/sql_type_inet.h @@ -714,7 +714,7 @@ public: 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 @@ public: 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); } diff --git a/plugin/type_mysql_json/mysql_json.cc b/plugin/type_mysql_json/mysql_json.cc index 4a75cae3909..c28a403a603 100644 --- a/plugin/type_mysql_json/mysql_json.cc +++ b/plugin/type_mysql_json/mysql_json.cc @@ -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; } |