mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge remote-tracking branch 'origin/bb-10.2-ext' into 10.3
TODO: enable MDEV-13049 optimization for 10.3
This commit is contained in:
@ -725,13 +725,36 @@ void set_param_date(Item_param *param, uchar **pos, ulong len)
|
||||
#endif /*!EMBEDDED_LIBRARY*/
|
||||
|
||||
|
||||
static void set_param_str(Item_param *param, uchar **pos, ulong len)
|
||||
static void set_param_str_or_null(Item_param *param, uchar **pos, ulong len,
|
||||
bool empty_string_is_null)
|
||||
{
|
||||
ulong length= get_param_length(pos, len);
|
||||
if (length > len)
|
||||
length= len;
|
||||
param->set_str((const char *)*pos, length);
|
||||
*pos+= length;
|
||||
if (length == 0 && empty_string_is_null)
|
||||
param->set_null();
|
||||
else
|
||||
{
|
||||
if (length > len)
|
||||
length= len;
|
||||
param->set_str((const char *) *pos, length);
|
||||
*pos+= length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void set_param_str(Item_param *param, uchar **pos, ulong len)
|
||||
{
|
||||
set_param_str_or_null(param, pos, len, false);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
set_param_str_empty_is_null : bind empty string as null value
|
||||
when sql_mode=MODE_EMPTY_STRING_IS_NULL
|
||||
*/
|
||||
static void set_param_str_empty_is_null(Item_param *param, uchar **pos,
|
||||
ulong len)
|
||||
{
|
||||
set_param_str_or_null(param, pos, len, true);
|
||||
}
|
||||
|
||||
|
||||
@ -806,7 +829,10 @@ static void setup_one_conversion_function(THD *thd, Item_param *param,
|
||||
param->value.cs_info.final_character_set_of_str_value=
|
||||
String::needs_conversion(0, fromcs, tocs, &dummy_offset) ?
|
||||
tocs : fromcs;
|
||||
param->set_param_func= set_param_str;
|
||||
|
||||
param->set_param_func=
|
||||
(thd->variables.sql_mode & MODE_EMPTY_STRING_IS_NULL) ?
|
||||
set_param_str_empty_is_null : set_param_str;
|
||||
/*
|
||||
Exact value of max_length is not known unless data is converted to
|
||||
charset of connection, so we have to set it later.
|
||||
@ -1365,7 +1391,8 @@ static bool mysql_test_insert(Prepared_statement *stmt,
|
||||
my_error(ER_WRONG_VALUE_COUNT_ON_ROW, MYF(0), counter);
|
||||
goto error;
|
||||
}
|
||||
if (setup_fields(thd, Ref_ptr_array(), *values, MARK_COLUMNS_NONE, 0, 0))
|
||||
if (setup_fields(thd, Ref_ptr_array(),
|
||||
*values, MARK_COLUMNS_NONE, 0, NULL, 0))
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
@ -1459,7 +1486,7 @@ static int mysql_test_update(Prepared_statement *stmt,
|
||||
#endif
|
||||
thd->lex->select_lex.no_wrap_view_item= TRUE;
|
||||
res= setup_fields(thd, Ref_ptr_array(),
|
||||
select->item_list, MARK_COLUMNS_READ, 0, 0);
|
||||
select->item_list, MARK_COLUMNS_READ, 0, NULL, 0);
|
||||
thd->lex->select_lex.no_wrap_view_item= FALSE;
|
||||
if (res)
|
||||
goto error;
|
||||
@ -1471,7 +1498,7 @@ static int mysql_test_update(Prepared_statement *stmt,
|
||||
table_list->register_want_access(SELECT_ACL);
|
||||
#endif
|
||||
if (setup_fields(thd, Ref_ptr_array(),
|
||||
stmt->lex->value_list, MARK_COLUMNS_NONE, 0, 0) ||
|
||||
stmt->lex->value_list, MARK_COLUMNS_NONE, 0, NULL, 0) ||
|
||||
check_unique_table(thd, table_list))
|
||||
goto error;
|
||||
/* TODO: here we should send types of placeholders to the client. */
|
||||
@ -1646,7 +1673,7 @@ static bool mysql_test_do_fields(Prepared_statement *stmt,
|
||||
DT_PREPARE | DT_CREATE))
|
||||
DBUG_RETURN(TRUE);
|
||||
DBUG_RETURN(setup_fields(thd, Ref_ptr_array(),
|
||||
*values, MARK_COLUMNS_NONE, 0, 0));
|
||||
*values, MARK_COLUMNS_NONE, 0, NULL, 0));
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user