| 3280 | */ |
| 3281 | |
| 3282 | bool Sql_cmd_update::execute_inner(THD *thd) |
| 3283 | { |
| 3284 | bool res= 0; |
| 3285 | Running_stmt_guard guard(thd, active_dml_stmt::UPDATING_STMT); |
| 3286 | |
| 3287 | if (!multitable) |
| 3288 | { |
| 3289 | if (lex->has_returning()) |
| 3290 | { |
| 3291 | /* This is UPDATE ... RETURNING. It will return output to the client */ |
| 3292 | if (thd->lex->analyze_stmt) |
| 3293 | { |
| 3294 | if (!(returning_result= new (thd->mem_root) select_send_analyze(thd))) |
| 3295 | { |
| 3296 | return true; |
| 3297 | } |
| 3298 | save_protocol= thd->protocol; |
| 3299 | thd->protocol= new Protocol_discard(thd); |
| 3300 | } |
| 3301 | else |
| 3302 | { |
| 3303 | if (!(returning_result= new |
| 3304 | (thd->mem_root) select_send(thd))) |
| 3305 | { |
| 3306 | return true; |
| 3307 | } |
| 3308 | } |
| 3309 | if (thd->lex->has_returning()) |
| 3310 | (void) returning_result->prepare(thd->lex->returning()->returning_list, NULL); |
| 3311 | } |
| 3312 | } |
| 3313 | |
| 3314 | thd->get_stmt_da()->reset_current_row_for_warning(1); |
| 3315 | if (!multitable) |
| 3316 | res= update_single_table(thd); |
| 3317 | else |
| 3318 | { |
| 3319 | thd->abort_on_warning= !thd->lex->ignore && thd->is_strict_mode(); |
| 3320 | res= Sql_cmd_dml::execute_inner(thd); |
| 3321 | } |
| 3322 | |
| 3323 | res|= thd->is_error(); |
| 3324 | |
| 3325 | if (save_protocol) |
| 3326 | { |
| 3327 | delete thd->protocol; |
| 3328 | thd->protocol= save_protocol; |
| 3329 | save_protocol= nullptr; |
| 3330 | } |
| 3331 | if (unlikely(res)) |
| 3332 | { |
| 3333 | if (multitable) |
| 3334 | result->abort_result_set(); |
| 3335 | } |
| 3336 | else |
| 3337 | { |
| 3338 | if (thd->lex->describe || thd->lex->analyze_stmt) |
| 3339 | { |
nothing calls this directly
no test coverage detected