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

Function end_send_group

sql/sql_select.cc:26181–26334  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26179*/
26180
26181enum_nested_loop_state
26182end_send_group(JOIN *join, JOIN_TAB *join_tab, bool end_of_records)
26183{
26184 int idx= -1;
26185 enum_nested_loop_state ok_code= NESTED_LOOP_OK;
26186 /*
26187 join_tab can be 0 in the case all tables are const tables and we did not
26188 need a temporary table to store the result.
26189 In this case we use the original given fields, which is stored in
26190 join->fields.
26191 */
26192 List<Item> *fields= join_tab ? (join_tab-1)->fields : join->fields;
26193 DBUG_ENTER("end_send_group");
26194
26195 if (!join->items3.is_null() && join->current_ref_ptrs != join->items3)
26196 join->set_items_ref_array(join->items3);
26197
26198 if (!join->first_record || end_of_records ||
26199 (idx=test_if_group_changed(join->group_fields)) >= 0)
26200 {
26201
26202 if (!join->group_sent &&
26203 (join->first_record ||
26204 (end_of_records && !join->group && !join->group_optimized_away)))
26205 {
26206 table_map cleared_tables= (table_map) 0;
26207 if (join->procedure)
26208 join->procedure->end_group();
26209 /* Test if there was a group change. */
26210 if (idx < (int) join->send_group_parts)
26211 {
26212 int error=0;
26213 if (join->procedure)
26214 {
26215 if (join->having && !join->having->val_bool())
26216 error= -1; // Didn't satisfy having
26217 else
26218 {
26219 if (join->do_send_rows)
26220 error=join->procedure->send_row(*fields) ? 1 : 0;
26221 join->send_records++;
26222 }
26223 if (end_of_records && join->procedure->end_of_records())
26224 error= 1; // Fatal error
26225 }
26226 else
26227 {
26228 /* Reset all sum functions on group change. */
26229 if (!join->first_record)
26230 {
26231 /* No matching rows for group function */
26232
26233 List_iterator_fast<Item> it(*fields);
26234 Item *item;
26235 join->no_rows_in_result_called= 1;
26236
26237 join->clear(&cleared_tables);
26238 while ((item= it++))

Callers

nothing calls this directly

Calls 15

test_if_group_changedFunction · 0.85
unclear_tablesFunction · 0.85
copy_fieldsFunction · 0.85
init_sum_functionsFunction · 0.85
update_sum_funcFunction · 0.85
set_items_ref_arrayMethod · 0.80
end_groupMethod · 0.80
send_rowMethod · 0.80
send_data_with_checkMethod · 0.80
rollup_send_dataMethod · 0.80
get_select_limitMethod · 0.80
is_with_tiesMethod · 0.80

Tested by

no test coverage detected