mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Use default character set for expressions
- Force usage of () around complex DEFAULT expressions - Give error if DEFAULT expression contains invalid characters - Don't use const_charset_conversion for stored Item_func_sysconf expressions as the result is not constaint over different executions - Fixed Item_func_user() to not store calculated value in str_value
This commit is contained in:
committed by
Sergei Golubchik
parent
8f226121e5
commit
fb67cde237
@ -870,7 +870,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier)
|
||||
is_fatal_sub_stmt_error(false),
|
||||
rand_used(0),
|
||||
time_zone_used(0),
|
||||
in_lock_tables(0),
|
||||
in_lock_tables(0), in_stored_expression(0),
|
||||
bootstrap(0),
|
||||
derived_tables_processing(FALSE),
|
||||
waiting_on_group_commit(FALSE), has_waiter(FALSE),
|
||||
@ -1417,7 +1417,7 @@ void THD::init(void)
|
||||
TL_WRITE);
|
||||
tx_isolation= (enum_tx_isolation) variables.tx_isolation;
|
||||
tx_read_only= variables.tx_read_only;
|
||||
update_charset();
|
||||
update_charset(); // plugin_thd_var() changed character sets
|
||||
reset_current_stmt_binlog_format_row();
|
||||
reset_binlog_local_stmt_filter();
|
||||
set_status_var_init();
|
||||
@ -2311,12 +2311,19 @@ bool THD::convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
|
||||
{
|
||||
DBUG_ENTER("THD::convert_string");
|
||||
size_t new_length= to_cs->mbmaxlen * from_length;
|
||||
uint dummy_errors;
|
||||
uint errors;
|
||||
if (alloc_lex_string(to, new_length + 1))
|
||||
DBUG_RETURN(true); // EOM
|
||||
to->length= copy_and_convert((char*) to->str, new_length, to_cs,
|
||||
from, from_length, from_cs, &dummy_errors);
|
||||
from, from_length, from_cs, &errors);
|
||||
to->str[to->length]= 0; // Safety
|
||||
if (errors && in_stored_expression)
|
||||
{
|
||||
my_error(ER_BAD_DATA, MYF(0),
|
||||
ErrConvString(from, from_length, from_cs).ptr(),
|
||||
to_cs->csname);
|
||||
DBUG_RETURN(true);
|
||||
}
|
||||
DBUG_RETURN(false);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user