sql_parse.cc   sql_parse.cc 
skipping to change at line 443 skipping to change at line 443
CF_SHOW_TABLE_COMMAND | CF_SHOW_TABLE_COMMAND |
CF_REEXECUTION_FRAGILE); CF_REEXECUTION_FRAGILE);
sql_command_flags[SQLCOM_CREATE_USER]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_CREATE_USER]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_RENAME_USER]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_RENAME_USER]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_DROP_USER]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_DROP_USER]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_ALTER_USER]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_ALTER_USER]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_GRANT]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_GRANT]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_REVOKE]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_REVOKE]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_REVOKE_ALL]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_REVOKE_ALL]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_REPAIR]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_OPTIMIZE]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_OPTIMIZE]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_ANALYZE]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_CREATE_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS; sql_command_flags[SQLCOM_CREATE_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS;
sql_command_flags[SQLCOM_CREATE_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS; sql_command_flags[SQLCOM_CREATE_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS;
sql_command_flags[SQLCOM_CREATE_SPFUNCTION]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS; sql_command_flags[SQLCOM_CREATE_SPFUNCTION]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS;
sql_command_flags[SQLCOM_DROP_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS; sql_command_flags[SQLCOM_DROP_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS;
sql_command_flags[SQLCOM_DROP_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS; sql_command_flags[SQLCOM_DROP_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS;
sql_command_flags[SQLCOM_ALTER_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS; sql_command_flags[SQLCOM_ALTER_PROCEDURE]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS;
sql_command_flags[SQLCOM_ALTER_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS; sql_command_flags[SQLCOM_ALTER_FUNCTION]= CF_CHANGES_DATA | CF_AUTO_CO MMIT_TRANS;
sql_command_flags[SQLCOM_INSTALL_PLUGIN]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_INSTALL_PLUGIN]= CF_CHANGES_DATA;
sql_command_flags[SQLCOM_UNINSTALL_PLUGIN]= CF_CHANGES_DATA; sql_command_flags[SQLCOM_UNINSTALL_PLUGIN]= CF_CHANGES_DATA;
skipping to change at line 472 skipping to change at line 470
*/ */
sql_command_flags[SQLCOM_CALL]= CF_REEXECUTION_FRAGILE | sql_command_flags[SQLCOM_CALL]= CF_REEXECUTION_FRAGILE |
CF_CAN_GENERATE_ROW_EVENTS | CF_CAN_GENERATE_ROW_EVENTS |
CF_OPTIMIZER_TRACE; // (1) CF_OPTIMIZER_TRACE; // (1)
sql_command_flags[SQLCOM_EXECUTE]= CF_CAN_GENERATE_ROW_EVENTS; sql_command_flags[SQLCOM_EXECUTE]= CF_CAN_GENERATE_ROW_EVENTS;
/* /*
The following admin table operations are allowed The following admin table operations are allowed
on log tables. on log tables.
*/ */
sql_command_flags[SQLCOM_REPAIR]|= CF_WRITE_LOGS_COMMAND | CF_AUTO_COM MIT_TRANS; sql_command_flags[SQLCOM_REPAIR]= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMM IT_TRANS;
sql_command_flags[SQLCOM_OPTIMIZE]|= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMM IT_TRANS; sql_command_flags[SQLCOM_OPTIMIZE]|= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMM IT_TRANS;
sql_command_flags[SQLCOM_ANALYZE]|= CF_WRITE_LOGS_COMMAND | CF_AUTO_COM MIT_TRANS; sql_command_flags[SQLCOM_ANALYZE]= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMM IT_TRANS;
sql_command_flags[SQLCOM_CHECK]= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMM IT_TRANS; sql_command_flags[SQLCOM_CHECK]= CF_WRITE_LOGS_COMMAND | CF_AUTO_COMM IT_TRANS;
sql_command_flags[SQLCOM_CREATE_USER]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_CREATE_USER]|= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_DROP_USER]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_DROP_USER]|= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_RENAME_USER]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_RENAME_USER]|= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_ALTER_USER]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_ALTER_USER]|= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_REVOKE]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_REVOKE]|= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_REVOKE_ALL]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_REVOKE_ALL]|= CF_AUTO_COMMIT_TRANS;
sql_command_flags[SQLCOM_GRANT]|= CF_AUTO_COMMIT_TRANS; sql_command_flags[SQLCOM_GRANT]|= CF_AUTO_COMMIT_TRANS;
skipping to change at line 1340 skipping to change at line 1338
{ {
/* /*
Multiple queries exits, execute them individually Multiple queries exits, execute them individually
*/ */
char *beginning_of_next_stmt= (char*) parser_state.m_lip.found_semico lon; char *beginning_of_next_stmt= (char*) parser_state.m_lip.found_semico lon;
/* Finalize server status flags after executing a statement. */ /* Finalize server status flags after executing a statement. */
thd->update_server_status(); thd->update_server_status();
thd->protocol->end_statement(); thd->protocol->end_statement();
query_cache_end_of_result(thd); query_cache_end_of_result(thd);
mysql_audit_general(thd, MYSQL_AUDIT_GENERAL_STATUS,
thd->get_stmt_da()->is_error() ?
thd->get_stmt_da()->sql_errno() : 0,
command_name[command].str);
ulong length= (ulong)(packet_end - beginning_of_next_stmt); ulong length= (ulong)(packet_end - beginning_of_next_stmt);
log_slow_statement(thd); log_slow_statement(thd);
/* Remove garbage at start of query */ /* Remove garbage at start of query */
while (length > 0 && my_isspace(thd->charset(), *beginning_of_next_st mt)) while (length > 0 && my_isspace(thd->charset(), *beginning_of_next_st mt))
{ {
beginning_of_next_stmt++; beginning_of_next_stmt++;
length--; length--;
} }
skipping to change at line 2471 skipping to change at line 2475
*/ */
if (stmt_causes_implicit_commit(thd, CF_IMPLICIT_COMMIT_BEGIN)) if (stmt_causes_implicit_commit(thd, CF_IMPLICIT_COMMIT_BEGIN))
{ {
/* /*
Note that this should never happen inside of stored functions Note that this should never happen inside of stored functions
or triggers as all such statements prohibited there. or triggers as all such statements prohibited there.
*/ */
DBUG_ASSERT(! thd->in_sub_stmt); DBUG_ASSERT(! thd->in_sub_stmt);
/* Commit or rollback the statement transaction. */ /* Commit or rollback the statement transaction. */
thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd); thd->is_error() ? trans_rollback_stmt(thd) : trans_commit_stmt(thd);
/*
Implicit commit is not allowed with an active XA transaction.
In this case we should not release metadata locks as the XA transacti
on
will not be rolled back. Therefore we simply return here.
*/
if (trans_check_state(thd))
DBUG_RETURN(-1);
/* Commit the normal transaction if one is active. */ /* Commit the normal transaction if one is active. */
if (trans_commit_implicit(thd)) if (trans_commit_implicit(thd))
goto error; goto error;
/* Release metadata locks acquired in this transaction. */ /* Release metadata locks acquired in this transaction. */
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
} }
#ifndef DBUG_OFF #ifndef DBUG_OFF
if (lex->sql_command != SQLCOM_SET_OPTION) if (lex->sql_command != SQLCOM_SET_OPTION)
DEBUG_SYNC(thd,"before_execute_sql_command"); DEBUG_SYNC(thd,"before_execute_sql_command");
skipping to change at line 3668 skipping to change at line 3681
case SQLCOM_UNLOCK_TABLES: case SQLCOM_UNLOCK_TABLES:
/* /*
It is critical for mysqldump --single-transaction --master-data that It is critical for mysqldump --single-transaction --master-data that
UNLOCK TABLES does not implicitely commit a connection which has only UNLOCK TABLES does not implicitely commit a connection which has only
done FLUSH TABLES WITH READ LOCK + BEGIN. If this assumption becomes done FLUSH TABLES WITH READ LOCK + BEGIN. If this assumption becomes
false, mysqldump will not work. false, mysqldump will not work.
*/ */
if (thd->variables.option_bits & OPTION_TABLE_LOCK) if (thd->variables.option_bits & OPTION_TABLE_LOCK)
{ {
/*
Can we commit safely? If not, return to avoid releasing
transactional metadata locks.
*/
if (trans_check_state(thd))
DBUG_RETURN(-1);
res= trans_commit_implicit(thd); res= trans_commit_implicit(thd);
thd->locked_tables_list.unlock_locked_tables(thd); thd->locked_tables_list.unlock_locked_tables(thd);
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
thd->variables.option_bits&= ~(OPTION_TABLE_LOCK); thd->variables.option_bits&= ~(OPTION_TABLE_LOCK);
} }
if (thd->global_read_lock.is_acquired()) if (thd->global_read_lock.is_acquired())
thd->global_read_lock.unlock_global_read_lock(thd); thd->global_read_lock.unlock_global_read_lock(thd);
if (res) if (res)
goto error; goto error;
my_ok(thd); my_ok(thd);
break; break;
case SQLCOM_LOCK_TABLES: case SQLCOM_LOCK_TABLES:
/*
Can we commit safely? If not, return to avoid releasing
transactional metadata locks.
*/
if (trans_check_state(thd))
DBUG_RETURN(-1);
/* We must end the transaction first, regardless of anything */ /* We must end the transaction first, regardless of anything */
res= trans_commit_implicit(thd); res= trans_commit_implicit(thd);
thd->locked_tables_list.unlock_locked_tables(thd); thd->locked_tables_list.unlock_locked_tables(thd);
/* Release transactional metadata locks. */ /* Release transactional metadata locks. */
thd->mdl_context.release_transactional_locks(); thd->mdl_context.release_transactional_locks();
if (res) if (res)
goto error; goto error;
/* /*
Here we have to pre-open temporary tables for LOCK TABLES. Here we have to pre-open temporary tables for LOCK TABLES.
skipping to change at line 5803 skipping to change at line 5828
thd->get_stmt_da()->reset_diagnostics_area(); thd->get_stmt_da()->reset_diagnostics_area();
thd->get_stmt_da()->reset_for_next_command(); thd->get_stmt_da()->reset_for_next_command();
thd->rand_used= 0; thd->rand_used= 0;
thd->m_sent_row_count= thd->m_examined_row_count= 0; thd->m_sent_row_count= thd->m_examined_row_count= 0;
thd->reset_current_stmt_binlog_format_row(); thd->reset_current_stmt_binlog_format_row();
thd->binlog_unsafe_warning_flags= 0; thd->binlog_unsafe_warning_flags= 0;
thd->m_trans_end_pos= 0; thd->m_trans_end_pos= 0;
thd->m_trans_log_file= NULL; thd->m_trans_log_file= NULL;
thd->commit_error= 0; thd->m_trans_fixed_log_file= NULL;
thd->commit_error= THD::CE_NONE;
thd->durability_property= HA_REGULAR_DURABILITY; thd->durability_property= HA_REGULAR_DURABILITY;
thd->set_trans_pos(NULL, 0); thd->set_trans_pos(NULL, 0);
DBUG_PRINT("debug", DBUG_PRINT("debug",
("is_current_stmt_binlog_format_row(): %d", ("is_current_stmt_binlog_format_row(): %d",
thd->is_current_stmt_binlog_format_row())); thd->is_current_stmt_binlog_format_row()));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
skipping to change at line 6568 skipping to change at line 6594
@param thd current thread @param thd current thread
@retval @retval
0 if success 0 if success
@retval @retval
1 otherwise 1 otherwise
*/ */
bool st_select_lex::init_nested_join(THD *thd) bool st_select_lex::init_nested_join(THD *thd)
{ {
TABLE_LIST *ptr;
NESTED_JOIN *nested_join;
DBUG_ENTER("init_nested_join"); DBUG_ENTER("init_nested_join");
if (!(ptr= (TABLE_LIST*) thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST))+ TABLE_LIST *const ptr=
sizeof(NESTED_JOIN)))) TABLE_LIST::new_nested_join(thd->mem_root, "(nested_join)",
DBUG_RETURN(1); embedding, join_list, this);
nested_join= ptr->nested_join= if (ptr == NULL)
((NESTED_JOIN*) ((uchar*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST)))); DBUG_RETURN(true);
join_list->push_front(ptr); join_list->push_front(ptr);
ptr->embedding= embedding;
ptr->join_list= join_list;
ptr->alias= (char*) "(nested_join)";
embedding= ptr; embedding= ptr;
join_list= &nested_join->join_list; join_list= &ptr->nested_join->join_list;
join_list->empty();
DBUG_RETURN(0); DBUG_RETURN(false);
} }
/** /**
End a nested join table list. End a nested join table list.
The function returns to the previous join nest level. The function returns to the previous join nest level.
If the current level contains only one member, the function If the current level contains only one member, the function
moves it one level up, eliminating the nest. moves it one level up, eliminating the nest.
@param thd current thread @param thd current thread
skipping to change at line 6645 skipping to change at line 6666
@param thd current thread @param thd current thread
@retval @retval
0 Error 0 Error
@retval @retval
\# Pointer to TABLE_LIST element created for the new nested join \# Pointer to TABLE_LIST element created for the new nested join
*/ */
TABLE_LIST *st_select_lex::nest_last_join(THD *thd) TABLE_LIST *st_select_lex::nest_last_join(THD *thd)
{ {
TABLE_LIST *ptr;
NESTED_JOIN *nested_join;
List<TABLE_LIST> *embedded_list;
DBUG_ENTER("nest_last_join"); DBUG_ENTER("nest_last_join");
if (!(ptr= (TABLE_LIST*) thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST))+ TABLE_LIST *const ptr=
sizeof(NESTED_JOIN)))) TABLE_LIST::new_nested_join(thd->mem_root, "(nest_last_join)",
DBUG_RETURN(0); embedding, join_list, this);
nested_join= ptr->nested_join= if (ptr == NULL)
((NESTED_JOIN*) ((uchar*) ptr + ALIGN_SIZE(sizeof(TABLE_LIST)))); DBUG_RETURN(NULL);
ptr->embedding= embedding; List<TABLE_LIST> *const embedded_list= &ptr->nested_join->join_list;
ptr->join_list= join_list;
ptr->alias= (char*) "(nest_last_join)";
embedded_list= &nested_join->join_list;
embedded_list->empty();
for (uint i=0; i < 2; i++) for (uint i=0; i < 2; i++)
{ {
TABLE_LIST *table= join_list->pop(); TABLE_LIST *table= join_list->pop();
table->join_list= embedded_list; table->join_list= embedded_list;
table->embedding= ptr; table->embedding= ptr;
embedded_list->push_back(table); embedded_list->push_back(table);
if (table->natural_join) if (table->natural_join)
{ {
ptr->is_natural_join= TRUE; ptr->is_natural_join= TRUE;
/* /*
If this is a JOIN ... USING, move the list of joined fields to the If this is a JOIN ... USING, move the list of joined fields to the
table reference that describes the join. table reference that describes the join.
*/ */
if (prev_join_using) if (prev_join_using)
ptr->join_using_fields= prev_join_using; ptr->join_using_fields= prev_join_using;
} }
} }
join_list->push_front(ptr); join_list->push_front(ptr);
nested_join->used_tables= nested_join->not_null_tables= (table_map) 0;
DBUG_RETURN(ptr); DBUG_RETURN(ptr);
} }
/** /**
Add a table to the current join list. Add a table to the current join list.
The function puts a table in front of the current join list The function puts a table in front of the current join list
of st_select_lex object. of st_select_lex object.
Thus, joined tables are put into this list in the reverse order Thus, joined tables are put into this list in the reverse order
(the most outer join operation follows first). (the most outer join operation follows first).
 End of changes. 17 change blocks. 
32 lines changed or deleted 47 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/