diff options
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r-- | sql/sql_delete.cc | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index b40e0b7b093..cb1a9db70cd 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -43,7 +43,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, table_list->db=thd->db; if ((thd->options & OPTION_SAFE_UPDATES) && !conds) { - send_error(&thd->net,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE); + send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE); DBUG_RETURN(1); } @@ -83,7 +83,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, !limit) { delete select; - send_ok(&thd->net,0L); + send_ok(thd,0L); DBUG_RETURN(0); // Nothing to delete } @@ -94,7 +94,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, if ((thd->options & OPTION_SAFE_UPDATES) && limit == HA_POS_ERROR) { delete select; - send_error(&thd->net,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE); + send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE); DBUG_RETURN(1); } } @@ -117,8 +117,8 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, ORDER *order, MYF(MY_FAE | MY_ZEROFILL)); if (setup_order(thd, &tables, fields, all_fields, order) || !(sortorder=make_unireg_sortorder(order, &length)) || - (table->found_records = filesort(table, sortorder, length, - (SQL_SELECT *) 0, 0L, HA_POS_ERROR, + (table->found_records = filesort(thd, table, sortorder, length, + (SQL_SELECT *) 0, HA_POS_ERROR, &examined_rows)) == HA_POS_ERROR) { @@ -188,10 +188,10 @@ cleanup: } delete select; if (error >= 0) // Fatal error - send_error(&thd->net,thd->killed ? ER_SERVER_SHUTDOWN: 0); + send_error(thd,thd->killed ? ER_SERVER_SHUTDOWN: 0); else { - send_ok(&thd->net,deleted); + send_ok(thd,deleted); DBUG_PRINT("info",("%d records deleted",deleted)); } DBUG_RETURN(0); @@ -222,9 +222,10 @@ multi_delete::multi_delete(THD *thd_arg, TABLE_LIST *dt, int -multi_delete::prepare(List<Item> &values) +multi_delete::prepare(List<Item> &values, SELECT_LEX_UNIT *u) { DBUG_ENTER("multi_delete::prepare"); + unit= u; do_delete = true; thd->proc_info="deleting from main table"; @@ -353,7 +354,7 @@ void multi_delete::send_error(uint errcode,const char *err) DBUG_ENTER("multi_delete::send_error"); /* First send error what ever it is ... */ - ::send_error(&thd->net,errcode,err); + ::send_error(thd,errcode,err); /* If nothing deleted return */ if (!deleted) @@ -455,7 +456,7 @@ bool multi_delete::send_eof() thd->proc_info="end"; if (error) { - ::send_error(&thd->net); + ::send_error(thd); return 1; } @@ -482,7 +483,7 @@ bool multi_delete::send_eof() { query_cache_invalidate3(thd, delete_tables, 1); } - ::send_ok(&thd->net,deleted); + ::send_ok(thd,deleted); return 0; } @@ -520,8 +521,9 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) table->file->info(HA_STATUS_AUTO | HA_STATUS_NO_LOCK); bzero((char*) &create_info,sizeof(create_info)); create_info.auto_increment_value= table->file->auto_increment_value; - db_type table_type=table->db_type; + create_info.table_charset=default_charset_info; + db_type table_type=table->db_type; strmov(path,table->path); *table_ptr= table->next; // Unlink table from list close_temporary(table,0); @@ -532,8 +534,8 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) table_list->real_name, 1)))) (void) rm_temporary_table(table_type, path); /* - Sasha: if we return here we will not have binloged the truncation and - we will not send_ok() to the client. + If we return here we will not have logged the truncation to the bin log + and we will not send_ok() to the client. */ goto end; } @@ -562,6 +564,8 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) } bzero((char*) &create_info,sizeof(create_info)); + create_info.table_charset=default_charset_info; + *fn_ext(path)=0; // Remove the .frm extension error= ha_create_table(path,&create_info,1) ? -1 : 0; query_cache_invalidate3(thd, table_list, 0); @@ -576,7 +580,7 @@ end: Query_log_event qinfo(thd, thd->query, thd->query_length); mysql_bin_log.write(&qinfo); } - send_ok(&thd->net); // This should return record count + send_ok(thd); // This should return record count } VOID(pthread_mutex_lock(&LOCK_open)); unlock_table_name(thd, table_list); |