mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge MySQL 5.1.46 into MariaDB.
Still two test failures to be solved: main.myisam and main.subselect.
This commit is contained in:
@ -50,6 +50,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
SELECT_LEX *select_lex= &thd->lex->select_lex;
|
||||
THD::killed_state killed_status= THD::NOT_KILLED;
|
||||
DBUG_ENTER("mysql_delete");
|
||||
bool save_binlog_row_based;
|
||||
|
||||
THD::enum_binlog_query_type query_type=
|
||||
thd->lex->sql_command == SQLCOM_TRUNCATE ?
|
||||
@ -147,12 +148,14 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
query_type= THD::STMT_QUERY_TYPE;
|
||||
error= -1; // ok
|
||||
deleted= maybe_deleted;
|
||||
save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
goto cleanup;
|
||||
}
|
||||
if (error != HA_ERR_WRONG_COMMAND)
|
||||
{
|
||||
table->file->print_error(error,MYF(0));
|
||||
error=0;
|
||||
save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
goto cleanup;
|
||||
}
|
||||
/* Handler didn't support fast delete; Delete rows one by one */
|
||||
@ -293,6 +296,11 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
|
||||
table->mark_columns_needed_for_delete();
|
||||
|
||||
save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
if (thd->lex->sql_command == SQLCOM_TRUNCATE &&
|
||||
thd->current_stmt_binlog_row_based)
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
|
||||
while (!(error=info.read_record(&info)) && !thd->killed &&
|
||||
! thd->is_error())
|
||||
{
|
||||
@ -393,7 +401,10 @@ cleanup:
|
||||
/* See similar binlogging code in sql_update.cc, for comments */
|
||||
if ((error < 0) || thd->transaction.stmt.modified_non_trans_table)
|
||||
{
|
||||
if (mysql_bin_log.is_open())
|
||||
if (mysql_bin_log.is_open() &&
|
||||
!(thd->lex->sql_command == SQLCOM_TRUNCATE &&
|
||||
thd->current_stmt_binlog_row_based &&
|
||||
find_temporary_table(thd, table_list)))
|
||||
{
|
||||
bool const is_trans=
|
||||
thd->lex->sql_command == SQLCOM_TRUNCATE ?
|
||||
@ -427,6 +438,7 @@ cleanup:
|
||||
if (thd->transaction.stmt.modified_non_trans_table)
|
||||
thd->transaction.all.modified_non_trans_table= TRUE;
|
||||
}
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
DBUG_ASSERT(transactional_table || !deleted || thd->transaction.stmt.modified_non_trans_table);
|
||||
free_underlaid_joins(thd, select_lex);
|
||||
if (error < 0 ||
|
||||
@ -1062,15 +1074,13 @@ bool multi_delete::send_eof()
|
||||
|
||||
static bool mysql_truncate_by_delete(THD *thd, TABLE_LIST *table_list)
|
||||
{
|
||||
bool error, save_binlog_row_based= thd->current_stmt_binlog_row_based;
|
||||
bool error;
|
||||
DBUG_ENTER("mysql_truncate_by_delete");
|
||||
table_list->lock_type= TL_WRITE;
|
||||
mysql_init_select(thd->lex);
|
||||
thd->clear_current_stmt_binlog_row_based();
|
||||
error= mysql_delete(thd, table_list, NULL, NULL, HA_POS_ERROR, LL(0), TRUE);
|
||||
ha_autocommit_or_rollback(thd, error);
|
||||
end_trans(thd, error ? ROLLBACK : COMMIT);
|
||||
thd->current_stmt_binlog_row_based= save_binlog_row_based;
|
||||
DBUG_RETURN(error);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user