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

Function set_limit_for_unit

sql/sql_select.cc:34497–34522  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34495*/
34496
34497static bool set_limit_for_unit(THD *thd, SELECT_LEX_UNIT *unit, ha_rows lim)
34498{
34499 SELECT_LEX *gpar= unit->global_parameters();
34500 if (gpar->limit_params.select_limit != 0 &&
34501 // limit can not be an expression but can be parameter
34502 (!gpar->limit_params.select_limit->basic_const_item() ||
34503 ((ha_rows)gpar->limit_params.select_limit->val_int()) < lim))
34504 return false;
34505
34506 Query_arena *arena, backup;
34507 arena= thd->activate_stmt_arena_if_needed(&backup);
34508
34509 gpar->limit_params.select_limit=
34510 new (thd->mem_root) Item_int(thd, lim, MAX_BIGINT_WIDTH);
34511 if (gpar->limit_params.select_limit == 0)
34512 return true; // EOM
34513
34514 unit->set_limit(gpar);
34515
34516 gpar->limit_params.explicit_limit= true; // to show in EXPLAIN
34517
34518 if (arena)
34519 thd->restore_active_arena(arena, &backup);
34520
34521 return false;
34522}
34523
34524
34525/**

Callers 1

Calls 6

global_parametersMethod · 0.80
restore_active_arenaMethod · 0.80
basic_const_itemMethod · 0.45
val_intMethod · 0.45
set_limitMethod · 0.45

Tested by

no test coverage detected