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

Function end_send

sql/sql_select.cc:26021–26163  ·  view source on GitHub ↗

ARGSUSED */

Source from the content-addressed store, hash-verified

26019
26020/* ARGSUSED */
26021static enum_nested_loop_state
26022end_send(JOIN *join, JOIN_TAB *join_tab, bool end_of_records)
26023{
26024 DBUG_ENTER("end_send");
26025 /*
26026 When all tables are const this function is called with jointab == NULL.
26027 This function shouldn't be called for the first join_tab as it needs
26028 to get fields from previous tab.
26029 */
26030 DBUG_ASSERT(join_tab == NULL || join_tab != join->join_tab);
26031 //TODO pass fields via argument
26032 List<Item> *fields= join_tab ? (join_tab-1)->fields : join->fields;
26033
26034 if (end_of_records)
26035 {
26036 if (join->procedure && join->procedure->end_of_records())
26037 DBUG_RETURN(NESTED_LOOP_ERROR);
26038 DBUG_RETURN(NESTED_LOOP_OK);
26039 }
26040
26041 if (join->table_count &&
26042 join->join_tab->is_using_loose_index_scan())
26043 {
26044 /* Copy non-aggregated fields when loose index scan is used. */
26045 copy_fields(&join->tmp_table_param);
26046 }
26047 if (join->having && join->having->val_bool() == 0)
26048 {
26049 /*
26050 If we have HAVING clause and it is not satisfied, we don't send
26051 the row to the client, but rownum should be incremented.
26052 */
26053 join->accepted_rows++;
26054 DBUG_RETURN(NESTED_LOOP_OK); // Didn't match having
26055 }
26056 if (join->procedure)
26057 {
26058 if (join->procedure->send_row(join->procedure_fields_list))
26059 DBUG_RETURN(NESTED_LOOP_ERROR);
26060 DBUG_RETURN(NESTED_LOOP_OK);
26061 }
26062
26063 if (join->send_records >= join->unit->lim.get_select_limit() &&
26064 join->unit->lim.is_with_ties())
26065 {
26066 /*
26067 Stop sending rows if the order fields corresponding to WITH TIES
26068 have changed.
26069 */
26070 int idx= test_if_item_cache_changed(join->order_fields);
26071 if (idx >= 0)
26072 join->do_send_rows= false;
26073 }
26074
26075 if (join->do_send_rows)
26076 {
26077 int error;
26078 /* result < 0 if row was not accepted and should not be counted */

Callers

nothing calls this directly

Calls 12

copy_fieldsFunction · 0.85
test_if_group_changedFunction · 0.85
send_rowMethod · 0.80
get_select_limitMethod · 0.80
is_with_tiesMethod · 0.80
send_data_with_checkMethod · 0.80
ha_table_flagsMethod · 0.80
end_of_recordsMethod · 0.45
val_boolMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected