mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Merge tag 'mariadb-5.5.58' into 5.5-galera
This commit is contained in:
@ -927,8 +927,7 @@ out:
|
||||
@retval FALSE The statement isn't updating any relevant tables.
|
||||
*/
|
||||
|
||||
static my_bool deny_updates_if_read_only_option(THD *thd,
|
||||
TABLE_LIST *all_tables)
|
||||
static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables)
|
||||
{
|
||||
DBUG_ENTER("deny_updates_if_read_only_option");
|
||||
|
||||
@ -937,11 +936,7 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
|
||||
|
||||
LEX *lex= thd->lex;
|
||||
|
||||
const my_bool user_is_super=
|
||||
((ulong)(thd->security_ctx->master_access & SUPER_ACL) ==
|
||||
(ulong)SUPER_ACL);
|
||||
|
||||
if (user_is_super)
|
||||
if (thd->security_ctx->master_access & SUPER_ACL)
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
if (!(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA))
|
||||
@ -951,30 +946,26 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
|
||||
if (lex->sql_command == SQLCOM_UPDATE_MULTI)
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
if (lex->sql_command == SQLCOM_CREATE_DB ||
|
||||
lex->sql_command == SQLCOM_DROP_DB)
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
/*
|
||||
a table-to-be-created is not in the temp table list yet,
|
||||
so CREATE TABLE needs a special treatment
|
||||
*/
|
||||
const bool update_real_tables=
|
||||
lex->sql_command == SQLCOM_CREATE_TABLE
|
||||
? !(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)
|
||||
: some_non_temp_table_to_be_updated(thd, all_tables);
|
||||
if (lex->sql_command == SQLCOM_CREATE_TABLE)
|
||||
DBUG_RETURN(!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE));
|
||||
|
||||
const bool create_or_drop_databases=
|
||||
(lex->sql_command == SQLCOM_CREATE_DB) ||
|
||||
(lex->sql_command == SQLCOM_DROP_DB);
|
||||
/*
|
||||
a table-to-be-dropped might not exist (DROP TEMPORARY TABLE IF EXISTS),
|
||||
cannot use the temp table list either.
|
||||
*/
|
||||
if (lex->sql_command == SQLCOM_DROP_TABLE && lex->drop_temporary)
|
||||
DBUG_RETURN(FALSE);
|
||||
|
||||
if (update_real_tables || create_or_drop_databases)
|
||||
{
|
||||
/*
|
||||
An attempt was made to modify one or more non-temporary tables.
|
||||
*/
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
|
||||
/* Assuming that only temporary tables are modified. */
|
||||
DBUG_RETURN(FALSE);
|
||||
/* Now, check thd->temporary_tables list */
|
||||
DBUG_RETURN(some_non_temp_table_to_be_updated(thd, all_tables));
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
@ -2785,7 +2776,7 @@ case SQLCOM_PREPARE:
|
||||
#ifdef WITH_PARTITION_STORAGE_ENGINE
|
||||
{
|
||||
partition_info *part_info= thd->lex->part_info;
|
||||
if (part_info && !(part_info= thd->lex->part_info->get_clone()))
|
||||
if (part_info && !(part_info= part_info->get_clone()))
|
||||
{
|
||||
res= -1;
|
||||
goto end_with_restore_list;
|
||||
@ -3176,8 +3167,8 @@ end_with_restore_list:
|
||||
/* mysql_update return 2 if we need to switch to multi-update */
|
||||
if (up_result != 2)
|
||||
break;
|
||||
/* Fall through */
|
||||
}
|
||||
/* fall through */
|
||||
case SQLCOM_UPDATE_MULTI:
|
||||
{
|
||||
DBUG_ASSERT(first_table == all_tables && first_table != 0);
|
||||
@ -3288,6 +3279,7 @@ end_with_restore_list:
|
||||
DBUG_PRINT("debug", ("Just after generate_incident()"));
|
||||
}
|
||||
#endif
|
||||
/* fall through */
|
||||
case SQLCOM_INSERT:
|
||||
{
|
||||
WSREP_SYNC_WAIT(thd, WSREP_SYNC_WAIT_BEFORE_INSERT_REPLACE);
|
||||
@ -4064,6 +4056,7 @@ end_with_restore_list:
|
||||
initialize this variable because RESET shares the same code as FLUSH
|
||||
*/
|
||||
lex->no_write_to_binlog= 1;
|
||||
/* fall through */
|
||||
case SQLCOM_FLUSH:
|
||||
{
|
||||
int write_to_binlog;
|
||||
|
Reference in New Issue
Block a user