cosmetic fixes
This commit is contained in:
parent
b7b5f6f1ab
commit
d1fdb17bfb
@ -678,7 +678,7 @@ int ha_partition::create(const char *name, TABLE *table_arg,
|
|||||||
DBUG_ASSERT(*fn_rext((char*)name) == '\0');
|
DBUG_ASSERT(*fn_rext((char*)name) == '\0');
|
||||||
|
|
||||||
/* Not allowed to create temporary partitioned tables */
|
/* Not allowed to create temporary partitioned tables */
|
||||||
if (create_info && create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
if (create_info && create_info->tmp_table())
|
||||||
{
|
{
|
||||||
my_error(ER_PARTITION_NO_TEMPORARY, MYF(0));
|
my_error(ER_PARTITION_NO_TEMPORARY, MYF(0));
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
@ -3015,7 +3015,7 @@ Query_log_event::Query_log_event(THD* thd_arg, const char* query_arg,
|
|||||||
case SQLCOM_CREATE_TABLE:
|
case SQLCOM_CREATE_TABLE:
|
||||||
trx_cache= (lex->select_lex.item_list.elements &&
|
trx_cache= (lex->select_lex.item_list.elements &&
|
||||||
thd->is_current_stmt_binlog_format_row());
|
thd->is_current_stmt_binlog_format_row());
|
||||||
use_cache= ((lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) &&
|
use_cache= (lex->create_info.tmp_table() &&
|
||||||
thd->in_multi_stmt_transaction_mode()) || trx_cache;
|
thd->in_multi_stmt_transaction_mode()) || trx_cache;
|
||||||
break;
|
break;
|
||||||
case SQLCOM_SET_OPTION:
|
case SQLCOM_SET_OPTION:
|
||||||
|
@ -260,7 +260,7 @@ sp_get_flags_for_command(LEX *lex)
|
|||||||
flags= sp_head::CONTAINS_DYNAMIC_SQL;
|
flags= sp_head::CONTAINS_DYNAMIC_SQL;
|
||||||
break;
|
break;
|
||||||
case SQLCOM_CREATE_TABLE:
|
case SQLCOM_CREATE_TABLE:
|
||||||
if (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)
|
if (lex->create_info.tmp_table())
|
||||||
flags= 0;
|
flags= 0;
|
||||||
else
|
else
|
||||||
flags= sp_head::HAS_COMMIT_OR_ROLLBACK;
|
flags= sp_head::HAS_COMMIT_OR_ROLLBACK;
|
||||||
@ -4056,7 +4056,7 @@ sp_head::merge_table_list(THD *thd, TABLE_LIST *table, LEX *lex_for_tmp_check)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
if (lex_for_tmp_check->sql_command == SQLCOM_CREATE_TABLE &&
|
if (lex_for_tmp_check->sql_command == SQLCOM_CREATE_TABLE &&
|
||||||
lex_for_tmp_check->query_tables == table &&
|
lex_for_tmp_check->query_tables == table &&
|
||||||
lex_for_tmp_check->create_info.options & HA_LEX_CREATE_TMP_TABLE)
|
lex_for_tmp_check->create_info.tmp_table())
|
||||||
{
|
{
|
||||||
tab->temp= TRUE;
|
tab->temp= TRUE;
|
||||||
tab->qname.length= temp_table_key_length;
|
tab->qname.length= temp_table_key_length;
|
||||||
|
@ -5056,7 +5056,7 @@ int THD::decide_logging_format(TABLE_LIST *tables)
|
|||||||
|
|
||||||
if (lex->sql_command != SQLCOM_CREATE_TABLE ||
|
if (lex->sql_command != SQLCOM_CREATE_TABLE ||
|
||||||
(lex->sql_command == SQLCOM_CREATE_TABLE &&
|
(lex->sql_command == SQLCOM_CREATE_TABLE &&
|
||||||
(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)))
|
lex->create_info.tmp_table()))
|
||||||
{
|
{
|
||||||
my_bool trans= table->table->file->has_transactions();
|
my_bool trans= table->table->file->has_transactions();
|
||||||
|
|
||||||
|
@ -3895,7 +3895,7 @@ static TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
|
|||||||
{
|
{
|
||||||
DEBUG_SYNC(thd,"create_table_select_before_open");
|
DEBUG_SYNC(thd,"create_table_select_before_open");
|
||||||
|
|
||||||
if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE))
|
if (!create_info->tmp_table())
|
||||||
{
|
{
|
||||||
Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
|
Open_table_context ot_ctx(thd, MYSQL_OPEN_REOPEN);
|
||||||
/*
|
/*
|
||||||
@ -4040,7 +4040,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
row-based replication for the statement. If we are creating a
|
row-based replication for the statement. If we are creating a
|
||||||
temporary table, we need to start a statement transaction.
|
temporary table, we need to start a statement transaction.
|
||||||
*/
|
*/
|
||||||
if ((thd->lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) == 0 &&
|
if (!thd->lex->create_info.tmp_table() &&
|
||||||
thd->is_current_stmt_binlog_format_row() &&
|
thd->is_current_stmt_binlog_format_row() &&
|
||||||
mysql_bin_log.is_open())
|
mysql_bin_log.is_open())
|
||||||
{
|
{
|
||||||
@ -4061,7 +4061,7 @@ select_create::prepare(List<Item> &values, SELECT_LEX_UNIT *u)
|
|||||||
{
|
{
|
||||||
DBUG_ASSERT(m_plock == NULL);
|
DBUG_ASSERT(m_plock == NULL);
|
||||||
|
|
||||||
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
if (create_info->tmp_table())
|
||||||
m_plock= &m_lock;
|
m_plock= &m_lock;
|
||||||
else
|
else
|
||||||
m_plock= &thd->extra_lock;
|
m_plock= &thd->extra_lock;
|
||||||
|
@ -211,7 +211,7 @@ static bool stmt_causes_implicit_commit(THD *thd, uint mask)
|
|||||||
case SQLCOM_ALTER_TABLE:
|
case SQLCOM_ALTER_TABLE:
|
||||||
case SQLCOM_CREATE_TABLE:
|
case SQLCOM_CREATE_TABLE:
|
||||||
/* If CREATE TABLE of non-temporary table, do implicit commit */
|
/* If CREATE TABLE of non-temporary table, do implicit commit */
|
||||||
skip= (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE);
|
skip= lex->create_info.tmp_table();
|
||||||
break;
|
break;
|
||||||
case SQLCOM_SET_OPTION:
|
case SQLCOM_SET_OPTION:
|
||||||
skip= lex->autocommit ? FALSE : TRUE;
|
skip= lex->autocommit ? FALSE : TRUE;
|
||||||
@ -1029,7 +1029,7 @@ static my_bool deny_updates_if_read_only_option(THD *thd,
|
|||||||
|
|
||||||
const my_bool create_temp_tables=
|
const my_bool create_temp_tables=
|
||||||
(lex->sql_command == SQLCOM_CREATE_TABLE) &&
|
(lex->sql_command == SQLCOM_CREATE_TABLE) &&
|
||||||
(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE);
|
lex->create_info.tmp_table();
|
||||||
|
|
||||||
const my_bool drop_temp_tables=
|
const my_bool drop_temp_tables=
|
||||||
(lex->sql_command == SQLCOM_DROP_TABLE) &&
|
(lex->sql_command == SQLCOM_DROP_TABLE) &&
|
||||||
@ -2927,7 +2927,7 @@ case SQLCOM_PREPARE:
|
|||||||
lex->unlink_first_table(&link_to_local);
|
lex->unlink_first_table(&link_to_local);
|
||||||
|
|
||||||
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
|
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
|
||||||
if (create_info.options & HA_LEX_CREATE_TMP_TABLE)
|
if (create_info.tmp_table())
|
||||||
thd->variables.option_bits|= OPTION_KEEP_LOG;
|
thd->variables.option_bits|= OPTION_KEEP_LOG;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2956,7 +2956,7 @@ case SQLCOM_PREPARE:
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
|
/* So that CREATE TEMPORARY TABLE gets to binlog at commit/rollback */
|
||||||
if (create_info.options & HA_LEX_CREATE_TMP_TABLE)
|
if (create_info.tmp_table())
|
||||||
thd->variables.option_bits|= OPTION_KEEP_LOG;
|
thd->variables.option_bits|= OPTION_KEEP_LOG;
|
||||||
/* regular create */
|
/* regular create */
|
||||||
if (create_info.options & HA_LEX_CREATE_TABLE_LIKE)
|
if (create_info.options & HA_LEX_CREATE_TABLE_LIKE)
|
||||||
@ -7771,7 +7771,7 @@ void create_table_set_open_action_and_adjust_tables(LEX *lex)
|
|||||||
{
|
{
|
||||||
TABLE_LIST *create_table= lex->query_tables;
|
TABLE_LIST *create_table= lex->query_tables;
|
||||||
|
|
||||||
if (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE)
|
if (lex->create_info.tmp_table())
|
||||||
create_table->open_type= OT_TEMPORARY_ONLY;
|
create_table->open_type= OT_TEMPORARY_ONLY;
|
||||||
else
|
else
|
||||||
create_table->open_type= OT_BASE_ONLY;
|
create_table->open_type= OT_BASE_ONLY;
|
||||||
@ -7817,8 +7817,7 @@ bool create_table_precheck(THD *thd, TABLE_LIST *tables,
|
|||||||
CREATE TABLE ... SELECT, also require INSERT.
|
CREATE TABLE ... SELECT, also require INSERT.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
want_priv= (lex->create_info.options & HA_LEX_CREATE_TMP_TABLE) ?
|
want_priv= lex->create_info.tmp_table() ? CREATE_TMP_ACL :
|
||||||
CREATE_TMP_ACL :
|
|
||||||
(CREATE_ACL | (select_lex->item_list.elements ? INSERT_ACL : 0));
|
(CREATE_ACL | (select_lex->item_list.elements ? INSERT_ACL : 0));
|
||||||
|
|
||||||
if (check_access(thd, want_priv, create_table->db,
|
if (check_access(thd, want_priv, create_table->db,
|
||||||
|
@ -1773,7 +1773,7 @@ static bool mysql_test_create_table(Prepared_statement *stmt)
|
|||||||
if (select_lex->item_list.elements)
|
if (select_lex->item_list.elements)
|
||||||
{
|
{
|
||||||
/* Base table and temporary table are not in the same name space. */
|
/* Base table and temporary table are not in the same name space. */
|
||||||
if (!(lex->create_info.options & HA_LEX_CREATE_TMP_TABLE))
|
if (!lex->create_info.tmp_table())
|
||||||
create_table->open_type= OT_BASE_ONLY;
|
create_table->open_type= OT_BASE_ONLY;
|
||||||
|
|
||||||
if (open_normal_and_derived_tables(stmt->thd, lex->query_tables,
|
if (open_normal_and_derived_tables(stmt->thd, lex->query_tables,
|
||||||
|
@ -7834,9 +7834,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
|
|
||||||
handle_if_exists_options(thd, table, alter_info);
|
handle_if_exists_options(thd, table, alter_info);
|
||||||
|
|
||||||
/* Look if we have to do anything at all. */
|
/*
|
||||||
/* Normally ALTER can become NOOP only after handling */
|
Look if we have to do anything at all.
|
||||||
/* the IF (NOT) EXISTS options. */
|
Normally ALTER can become NOOP only after handling
|
||||||
|
the IF (NOT) EXISTS options.
|
||||||
|
*/
|
||||||
if (alter_info->flags == 0)
|
if (alter_info->flags == 0)
|
||||||
{
|
{
|
||||||
my_snprintf(alter_ctx.tmp_name, sizeof(alter_ctx.tmp_name),
|
my_snprintf(alter_ctx.tmp_name, sizeof(alter_ctx.tmp_name),
|
||||||
@ -8238,26 +8240,23 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
if (lock_tables(thd, table_list, alter_ctx.tables_opened, 0))
|
if (lock_tables(thd, table_list, alter_ctx.tables_opened, 0))
|
||||||
goto err_new_table_cleanup;
|
goto err_new_table_cleanup;
|
||||||
|
|
||||||
|
if (ha_create_table(thd, alter_ctx.get_tmp_path(),
|
||||||
|
alter_ctx.new_db, alter_ctx.tmp_name,
|
||||||
|
create_info, &frm))
|
||||||
|
goto err_new_table_cleanup;
|
||||||
|
|
||||||
|
/* Mark that we have created table in storage engine. */
|
||||||
|
no_ha_table= false;
|
||||||
|
|
||||||
|
if (create_info->tmp_table())
|
||||||
{
|
{
|
||||||
if (ha_create_table(thd, alter_ctx.get_tmp_path(),
|
if (!open_table_uncached(thd, new_db_type,
|
||||||
alter_ctx.new_db, alter_ctx.tmp_name,
|
alter_ctx.get_tmp_path(),
|
||||||
create_info, &frm))
|
alter_ctx.new_db, alter_ctx.tmp_name,
|
||||||
|
true, true))
|
||||||
goto err_new_table_cleanup;
|
goto err_new_table_cleanup;
|
||||||
|
|
||||||
/* Mark that we have created table in storage engine. */
|
|
||||||
no_ha_table= false;
|
|
||||||
|
|
||||||
if (create_info->tmp_table())
|
|
||||||
{
|
|
||||||
if (!open_table_uncached(thd, new_db_type,
|
|
||||||
alter_ctx.get_tmp_path(),
|
|
||||||
alter_ctx.new_db, alter_ctx.tmp_name,
|
|
||||||
true, true))
|
|
||||||
goto err_new_table_cleanup;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Open the table since we need to copy the data. */
|
/* Open the table since we need to copy the data. */
|
||||||
if (table->s->tmp_table != NO_TMP_TABLE)
|
if (table->s->tmp_table != NO_TMP_TABLE)
|
||||||
{
|
{
|
||||||
|
@ -2029,7 +2029,7 @@ static bool sql_unusable_for_discovery(THD *thd, const char *sql)
|
|||||||
if (lex->select_lex.item_list.elements)
|
if (lex->select_lex.item_list.elements)
|
||||||
return 1;
|
return 1;
|
||||||
// ... temporary
|
// ... temporary
|
||||||
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
if (create_info->tmp_table())
|
||||||
return 1;
|
return 1;
|
||||||
// ... if exists
|
// ... if exists
|
||||||
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
|
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
|
||||||
|
@ -3051,7 +3051,7 @@ int ha_maria::create(const char *name, register TABLE *table_arg,
|
|||||||
create_info.transactional= (row_type == BLOCK_RECORD &&
|
create_info.transactional= (row_type == BLOCK_RECORD &&
|
||||||
ha_create_info->transactional != HA_CHOICE_NO);
|
ha_create_info->transactional != HA_CHOICE_NO);
|
||||||
|
|
||||||
if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
if (ha_create_info->tmp_table())
|
||||||
{
|
{
|
||||||
create_flags|= HA_CREATE_TMP_TABLE;
|
create_flags|= HA_CREATE_TMP_TABLE;
|
||||||
create_info.transactional= 0;
|
create_info.transactional= 0;
|
||||||
|
@ -2000,7 +2000,7 @@ int ha_myisam::create(const char *name, register TABLE *table_arg,
|
|||||||
create_info.index_file_name= ha_create_info->index_file_name;
|
create_info.index_file_name= ha_create_info->index_file_name;
|
||||||
create_info.language= share->table_charset->number;
|
create_info.language= share->table_charset->number;
|
||||||
|
|
||||||
if (ha_create_info->options & HA_LEX_CREATE_TMP_TABLE)
|
if (ha_create_info->tmp_table())
|
||||||
create_flags|= HA_CREATE_TMP_TABLE;
|
create_flags|= HA_CREATE_TMP_TABLE;
|
||||||
if (ha_create_info->options & HA_CREATE_KEEP_FILES)
|
if (ha_create_info->options & HA_CREATE_KEEP_FILES)
|
||||||
create_flags|= HA_CREATE_KEEP_FILES;
|
create_flags|= HA_CREATE_KEEP_FILES;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user