cleanup: formatting
also avoid an oxymoron of using `MYSQL_PLUGIN_IMPORT` under `#ifdef MYSQL_SERVER`, and empty_clex_str is so trivial that a plugin can define it if needed.
This commit is contained in:
parent
89342a3bd5
commit
3648b333c7
@ -1342,15 +1342,13 @@ Type_handler_inet6::character_or_binary_string_to_native(THD *thd,
|
||||
Inet6_null tmp(*str);
|
||||
if (tmp.is_null())
|
||||
thd->push_warning_wrong_value(Sql_condition::WARN_LEVEL_WARN,
|
||||
name().ptr(),
|
||||
ErrConvString(str).ptr());
|
||||
name().ptr(), ErrConvString(str).ptr());
|
||||
return tmp.is_null() || tmp.to_native(to);
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
Type_handler_inet6::Item_save_in_value(THD *thd,
|
||||
Item *item,
|
||||
Type_handler_inet6::Item_save_in_value(THD *thd, Item *item,
|
||||
st_value *value) const
|
||||
{
|
||||
value->m_type= DYN_COL_STRING;
|
||||
@ -1366,8 +1364,7 @@ Type_handler_inet6::Item_save_in_value(THD *thd,
|
||||
FROM t1;
|
||||
*/
|
||||
thd->push_warning_wrong_value(Sql_condition::WARN_LEVEL_WARN,
|
||||
name().ptr(),
|
||||
ErrConvString(str).ptr());
|
||||
name().ptr(), ErrConvString(str).ptr());
|
||||
value->m_type= DYN_COL_NULL;
|
||||
return true;
|
||||
}
|
||||
|
@ -1891,8 +1891,7 @@ void Field::copy_from_tmp(int row_offset)
|
||||
|
||||
bool Field::send(Protocol *protocol)
|
||||
{
|
||||
char buff[MAX_FIELD_WIDTH];
|
||||
String tmp(buff,sizeof(buff),charset());
|
||||
StringBuffer<MAX_FIELD_WIDTH> tmp(charset());
|
||||
val_str(&tmp);
|
||||
return protocol->store(tmp.ptr(), tmp.length(), tmp.charset());
|
||||
}
|
||||
@ -9401,8 +9400,7 @@ String *Field_set::val_str(String *val_buffer,
|
||||
{
|
||||
if (val_buffer->length())
|
||||
val_buffer->append(&field_separator, 1, &my_charset_latin1);
|
||||
String str(typelib->type_names[bitnr],
|
||||
typelib->type_lengths[bitnr],
|
||||
String str(typelib->type_names[bitnr], typelib->type_lengths[bitnr],
|
||||
field_charset());
|
||||
val_buffer->append(str);
|
||||
}
|
||||
|
11
sql/field.h
11
sql/field.h
@ -4805,14 +4805,11 @@ private:
|
||||
class Field_set final :public Field_enum {
|
||||
public:
|
||||
Field_set(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg,
|
||||
uchar null_bit_arg,
|
||||
enum utype unireg_check_arg, const LEX_CSTRING *field_name_arg,
|
||||
uint32 packlength_arg,
|
||||
uchar null_bit_arg, enum utype unireg_check_arg,
|
||||
const LEX_CSTRING *field_name_arg, uint32 packlength_arg,
|
||||
const TYPELIB *typelib_arg, const DTCollation &collation)
|
||||
:Field_enum(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
|
||||
unireg_check_arg, field_name_arg,
|
||||
packlength_arg,
|
||||
typelib_arg, collation),
|
||||
:Field_enum(ptr_arg, len_arg, null_ptr_arg, null_bit_arg, unireg_check_arg,
|
||||
field_name_arg, packlength_arg, typelib_arg, collation),
|
||||
empty_set_string("", 0, collation.collation)
|
||||
{
|
||||
flags=(flags & ~ENUM_FLAG) | SET_FLAG;
|
||||
|
18
sql/item.h
18
sql/item.h
@ -7517,27 +7517,21 @@ public:
|
||||
Item_type_holder do not need cleanup() because its time of live limited by
|
||||
single SP/PS execution.
|
||||
*/
|
||||
class Item_type_holder: public Item,
|
||||
public Type_handler_hybrid_field_type
|
||||
class Item_type_holder: public Item, public Type_handler_hybrid_field_type
|
||||
{
|
||||
protected:
|
||||
const TYPELIB *enum_set_typelib;
|
||||
public:
|
||||
Item_type_holder(THD *thd,
|
||||
Item *item,
|
||||
const Type_handler *handler,
|
||||
const Type_all_attributes *attr,
|
||||
bool maybe_null_arg)
|
||||
:Item(thd),
|
||||
Type_handler_hybrid_field_type(handler),
|
||||
Item_type_holder(THD *thd, Item *item, const Type_handler *handler,
|
||||
const Type_all_attributes *attr, bool maybe_null_arg)
|
||||
:Item(thd), Type_handler_hybrid_field_type(handler),
|
||||
enum_set_typelib(attr->get_typelib())
|
||||
{
|
||||
name= item->name;
|
||||
Type_std_attributes::set(*attr);
|
||||
set_maybe_null(maybe_null_arg);
|
||||
copy_flags(item,
|
||||
item_base_t::IS_EXPLICIT_NAME |
|
||||
item_base_t::IS_IN_WITH_CYCLE);
|
||||
copy_flags(item, item_base_t::IS_EXPLICIT_NAME |
|
||||
item_base_t::IS_IN_WITH_CYCLE);
|
||||
}
|
||||
|
||||
const Type_handler *type_handler() const override
|
||||
|
@ -4532,9 +4532,9 @@ error:
|
||||
@retval TRUE Failure (OOM).
|
||||
*/
|
||||
|
||||
bool DML_prelocking_strategy::
|
||||
handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
Sroutine_hash_entry *rt, sp_head *sp, bool *need_prelocking)
|
||||
bool DML_prelocking_strategy::handle_routine(THD *thd,
|
||||
Query_tables_list *prelocking_ctx, Sroutine_hash_entry *rt,
|
||||
sp_head *sp, bool *need_prelocking)
|
||||
{
|
||||
/*
|
||||
We assume that for any "CALL proc(...)" statement sroutines_list will
|
||||
@ -4668,8 +4668,8 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
// FK_OPTION_RESTRICT and FK_OPTION_NO_ACTION only need read access
|
||||
thr_lock_type lock_type;
|
||||
|
||||
if ((op & (1 << TRG_EVENT_DELETE) && fk_modifies_child(fk->delete_method))
|
||||
|| (op & (1 << TRG_EVENT_UPDATE) && fk_modifies_child(fk->update_method)))
|
||||
if ((op & trg2bit(TRG_EVENT_DELETE) && fk_modifies_child(fk->delete_method))
|
||||
|| (op & trg2bit(TRG_EVENT_UPDATE) && fk_modifies_child(fk->update_method)))
|
||||
lock_type= TL_WRITE_ALLOW_WRITE;
|
||||
else
|
||||
lock_type= TL_READ;
|
||||
@ -4715,9 +4715,9 @@ prepare_fk_prelocking_list(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
@retval TRUE Failure (OOM).
|
||||
*/
|
||||
|
||||
bool DML_prelocking_strategy::
|
||||
handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
TABLE_LIST *table_list, bool *need_prelocking)
|
||||
bool DML_prelocking_strategy::handle_table(THD *thd,
|
||||
Query_tables_list *prelocking_ctx, TABLE_LIST *table_list,
|
||||
bool *need_prelocking)
|
||||
{
|
||||
DBUG_ENTER("handle_table");
|
||||
TABLE *table= table_list->table;
|
||||
@ -4846,9 +4846,9 @@ err:
|
||||
@retval TRUE Failure (OOM).
|
||||
*/
|
||||
|
||||
bool DML_prelocking_strategy::
|
||||
handle_view(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
TABLE_LIST *table_list, bool *need_prelocking)
|
||||
bool DML_prelocking_strategy::handle_view(THD *thd,
|
||||
Query_tables_list *prelocking_ctx, TABLE_LIST *table_list,
|
||||
bool *need_prelocking)
|
||||
{
|
||||
if (table_list->view->uses_stored_routines())
|
||||
{
|
||||
@ -4886,9 +4886,9 @@ handle_view(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
@retval TRUE Failure (OOM).
|
||||
*/
|
||||
|
||||
bool Lock_tables_prelocking_strategy::
|
||||
handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
TABLE_LIST *table_list, bool *need_prelocking)
|
||||
bool Lock_tables_prelocking_strategy::handle_table(THD *thd,
|
||||
Query_tables_list *prelocking_ctx, TABLE_LIST *table_list,
|
||||
bool *need_prelocking)
|
||||
{
|
||||
TABLE_LIST **last= prelocking_ctx->query_tables_last;
|
||||
|
||||
@ -4919,9 +4919,9 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
a simple view, but one that uses stored routines.
|
||||
*/
|
||||
|
||||
bool Alter_table_prelocking_strategy::
|
||||
handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
Sroutine_hash_entry *rt, sp_head *sp, bool *need_prelocking)
|
||||
bool Alter_table_prelocking_strategy::handle_routine(THD *thd,
|
||||
Query_tables_list *prelocking_ctx, Sroutine_hash_entry *rt,
|
||||
sp_head *sp, bool *need_prelocking)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -4945,9 +4945,9 @@ handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
@retval TRUE Failure (OOM).
|
||||
*/
|
||||
|
||||
bool Alter_table_prelocking_strategy::
|
||||
handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
TABLE_LIST *table_list, bool *need_prelocking)
|
||||
bool Alter_table_prelocking_strategy::handle_table(THD *thd,
|
||||
Query_tables_list *prelocking_ctx, TABLE_LIST *table_list,
|
||||
bool *need_prelocking)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -4960,9 +4960,9 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
to be materialized.
|
||||
*/
|
||||
|
||||
bool Alter_table_prelocking_strategy::
|
||||
handle_view(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
TABLE_LIST *table_list, bool *need_prelocking)
|
||||
bool Alter_table_prelocking_strategy::handle_view(THD *thd,
|
||||
Query_tables_list *prelocking_ctx, TABLE_LIST *table_list,
|
||||
bool *need_prelocking)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -2977,8 +2977,8 @@ public:
|
||||
};
|
||||
|
||||
|
||||
bool Delayed_prelocking_strategy::
|
||||
handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
bool Delayed_prelocking_strategy::handle_table(THD *thd,
|
||||
Query_tables_list *prelocking_ctx,
|
||||
TABLE_LIST *table_list, bool *need_prelocking)
|
||||
{
|
||||
DBUG_ASSERT(table_list->lock_type == TL_WRITE_DELAYED);
|
||||
@ -2992,10 +2992,9 @@ handle_table(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
}
|
||||
|
||||
|
||||
bool Delayed_prelocking_strategy::
|
||||
handle_routine(THD *thd, Query_tables_list *prelocking_ctx,
|
||||
Sroutine_hash_entry *rt, sp_head *sp,
|
||||
bool *need_prelocking)
|
||||
bool Delayed_prelocking_strategy::handle_routine(THD *thd,
|
||||
Query_tables_list *prelocking_ctx, Sroutine_hash_entry *rt,
|
||||
sp_head *sp, bool *need_prelocking)
|
||||
{
|
||||
/* LEX used by the delayed insert thread has no routines. */
|
||||
DBUG_ASSERT(0);
|
||||
|
@ -388,7 +388,7 @@ void binlog_unsafe_map_init();
|
||||
#ifdef MYSQL_SERVER
|
||||
|
||||
extern const LEX_STRING empty_lex_str;
|
||||
extern MYSQL_PLUGIN_IMPORT const LEX_CSTRING empty_clex_str;
|
||||
extern const LEX_CSTRING empty_clex_str;
|
||||
extern const LEX_CSTRING star_clex_str;
|
||||
extern const LEX_CSTRING param_clex_str;
|
||||
|
||||
|
@ -51,11 +51,11 @@ public:
|
||||
int level;
|
||||
String field;
|
||||
String value;
|
||||
XML_TAG(int l, String f, String v);
|
||||
XML_TAG(int l, const String &f, const String &v);
|
||||
};
|
||||
|
||||
|
||||
XML_TAG::XML_TAG(int l, String f, String v)
|
||||
XML_TAG::XML_TAG(int l, const String &f, const String &v)
|
||||
{
|
||||
level= l;
|
||||
field.append(f);
|
||||
|
@ -10364,10 +10364,8 @@ bool parse_sql(THD *thd, Parser_state *parser_state,
|
||||
|
||||
/* Parse the query. */
|
||||
|
||||
bool mysql_parse_status=
|
||||
((thd->variables.sql_mode & MODE_ORACLE) ?
|
||||
ORAparse(thd) :
|
||||
MYSQLparse(thd)) != 0;
|
||||
bool mysql_parse_status= thd->variables.sql_mode & MODE_ORACLE
|
||||
? ORAparse(thd) : MYSQLparse(thd);
|
||||
DBUG_ASSERT(opt_bootstrap || mysql_parse_status ||
|
||||
thd->lex->select_stack_top == 0);
|
||||
thd->lex->current_select= thd->lex->first_select_lex();
|
||||
|
@ -5002,8 +5002,7 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
|
||||
/* Allocate query. */
|
||||
|
||||
if (expanded_query->length() &&
|
||||
alloc_query(thd, (char*) expanded_query->ptr(),
|
||||
expanded_query->length()))
|
||||
alloc_query(thd, expanded_query->ptr(), expanded_query->length()))
|
||||
{
|
||||
my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), expanded_query->length());
|
||||
goto error;
|
||||
@ -5040,12 +5039,9 @@ bool Prepared_statement::execute(String *expanded_query, bool open_cursor)
|
||||
if (query_cache_send_result_to_client(thd, thd->query(),
|
||||
thd->query_length()) <= 0)
|
||||
{
|
||||
MYSQL_QUERY_EXEC_START(thd->query(),
|
||||
thd->thread_id,
|
||||
thd->get_db(),
|
||||
MYSQL_QUERY_EXEC_START(thd->query(), thd->thread_id, thd->get_db(),
|
||||
&thd->security_ctx->priv_user[0],
|
||||
(char *) thd->security_ctx->host_or_ip,
|
||||
1);
|
||||
(char *) thd->security_ctx->host_or_ip, 1);
|
||||
error= mysql_execute_command(thd);
|
||||
MYSQL_QUERY_EXEC_DONE(error);
|
||||
}
|
||||
|
@ -848,10 +848,9 @@ bool Binary_string::copy_printable_hhhh(CHARSET_INFO *to_cs,
|
||||
*/
|
||||
|
||||
|
||||
int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
|
||||
int sortcmp(const Binary_string *s, const Binary_string *t, CHARSET_INFO *cs)
|
||||
{
|
||||
return cs->strnncollsp(s->ptr(), s->length(),
|
||||
t->ptr(), t->length());
|
||||
return cs->strnncollsp(s->ptr(), s->length(), t->ptr(), t->length());
|
||||
}
|
||||
|
||||
|
||||
@ -873,7 +872,7 @@ int sortcmp(const String *s,const String *t, CHARSET_INFO *cs)
|
||||
*/
|
||||
|
||||
|
||||
int stringcmp(const String *s,const String *t)
|
||||
int stringcmp(const Binary_string *s, const Binary_string *t)
|
||||
{
|
||||
uint32 s_len=s->length(),t_len=t->length(),len=MY_MIN(s_len,t_len);
|
||||
int cmp= len ? memcmp(s->ptr(), t->ptr(), len) : 0;
|
||||
|
@ -42,10 +42,11 @@ typedef struct st_mem_root MEM_ROOT;
|
||||
#define ASSERT_LENGTH(A) DBUG_ASSERT(str_length + (uint32) (A) <= Alloced_length)
|
||||
|
||||
#include "pack.h"
|
||||
int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
|
||||
class Binary_string;
|
||||
int sortcmp(const Binary_string *s, const Binary_string *t, CHARSET_INFO *cs);
|
||||
int stringcmp(const Binary_string *s, const Binary_string *t);
|
||||
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
||||
inline uint32 copy_and_convert(char *to, size_t to_length,
|
||||
CHARSET_INFO *to_cs,
|
||||
inline uint32 copy_and_convert(char *to, size_t to_length, CHARSET_INFO *to_cs,
|
||||
const char *from, size_t from_length,
|
||||
CHARSET_INFO *from_cs, uint *errors)
|
||||
{
|
||||
@ -787,8 +788,7 @@ class String: public Charset, public Binary_string
|
||||
{
|
||||
public:
|
||||
String() { }
|
||||
String(size_t length_arg)
|
||||
:Binary_string(length_arg)
|
||||
String(size_t length_arg) :Binary_string(length_arg)
|
||||
{ }
|
||||
/*
|
||||
NOTE: If one intend to use the c_ptr() method, the following two
|
||||
@ -796,16 +796,13 @@ public:
|
||||
room for zero termination).
|
||||
*/
|
||||
String(const char *str, size_t len, CHARSET_INFO *cs)
|
||||
:Charset(cs),
|
||||
Binary_string(str, len)
|
||||
:Charset(cs), Binary_string(str, len)
|
||||
{ }
|
||||
String(char *str, size_t len, CHARSET_INFO *cs)
|
||||
:Charset(cs),
|
||||
Binary_string(str, len)
|
||||
:Charset(cs), Binary_string(str, len)
|
||||
{ }
|
||||
String(const String &str)
|
||||
:Charset(str),
|
||||
Binary_string(str)
|
||||
:Charset(str), Binary_string(str)
|
||||
{ }
|
||||
|
||||
void set(String &str,size_t offset,size_t arg_length)
|
||||
@ -994,8 +991,6 @@ public:
|
||||
}
|
||||
|
||||
void strip_sp();
|
||||
friend int sortcmp(const String *a,const String *b, CHARSET_INFO *cs);
|
||||
friend int stringcmp(const String *a,const String *b);
|
||||
friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);
|
||||
friend class Field;
|
||||
uint32 numchars() const
|
||||
|
@ -80,6 +80,8 @@ static my_bool g_allow_create_integer_latch = FALSE;
|
||||
|
||||
using namespace open_query;
|
||||
|
||||
static const LEX_CSTRING empty_lex_cstring= {"", 0};
|
||||
|
||||
// Table of varchar latch operations.
|
||||
// In the future this needs to be refactactored to live somewhere else
|
||||
struct oqgraph_latch_op_table { const char *key; int latch; };
|
||||
@ -623,7 +625,7 @@ int ha_oqgraph::open(const char *name, int mode, uint test_if_locked)
|
||||
}
|
||||
|
||||
if (enum open_frm_error err= open_table_from_share(thd, share,
|
||||
&empty_clex_str,
|
||||
&empty_lex_cstring,
|
||||
(uint) (HA_OPEN_KEYFILE | HA_TRY_READ_ONLY),
|
||||
EXTRA_RECORD,
|
||||
thd->open_options, edges, FALSE))
|
||||
|
Loading…
x
Reference in New Issue
Block a user