MCPcopy Create free account
hub / github.com/MariaDB/server / execute_inner

Method execute_inner

sql/sql_update.cc:3282–3360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3280*/
3281
3282bool 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 {

Callers

nothing calls this directly

Calls 12

has_returningMethod · 0.80
returningMethod · 0.80
get_stmt_daMethod · 0.80
is_strict_modeMethod · 0.80
send_explainMethod · 0.80
num_foundMethod · 0.80
num_updatedMethod · 0.80
get_sent_row_countMethod · 0.80
prepareMethod · 0.45
is_errorMethod · 0.45
abort_result_setMethod · 0.45

Tested by

no test coverage detected