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

Method tmp_table_index_lookup_init

sql/sql_select.cc:17126–17173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17124*/
17125
17126bool TABLE_REF::tmp_table_index_lookup_init(THD *thd,
17127 KEY *tmp_key,
17128 Item_iterator &it,
17129 bool value,
17130 uint skip)
17131{
17132 uint tmp_key_parts= tmp_key->user_defined_key_parts;
17133 uint i;
17134 DBUG_ENTER("TABLE_REF::tmp_table_index_lookup_init");
17135
17136 key= 0; /* The only temp table index. */
17137 key_length= tmp_key->key_length;
17138 if (!(key_buff= thd->calloc<uchar>(ALIGN_SIZE(tmp_key->key_length) * 2)) ||
17139 !(key_copy= thd->alloc<store_key*>(tmp_key_parts + 1)) ||
17140 !(items= thd->alloc<Item*>(tmp_key_parts)))
17141 DBUG_RETURN(TRUE);
17142
17143 key_buff2= key_buff + ALIGN_SIZE(tmp_key->key_length);
17144
17145 KEY_PART_INFO *cur_key_part= tmp_key->key_part;
17146 store_key **ref_key= key_copy;
17147 uchar *cur_ref_buff= key_buff;
17148
17149 it.open();
17150 for (i= 0; i < skip; i++) it.next();
17151 for (i= 0; i < tmp_key_parts; i++, cur_key_part++, ref_key++)
17152 {
17153 Item *item= it.next();
17154 DBUG_ASSERT(item);
17155 items[i]= item;
17156 int null_count= MY_TEST(cur_key_part->field->real_maybe_null());
17157 *ref_key= new store_key_item(thd, cur_key_part->field,
17158 /* TIMOUR:
17159 the NULL byte is taken into account in
17160 cur_key_part->store_length, so instead of
17161 cur_ref_buff + MY_TEST(maybe_null), we could
17162 use that information instead.
17163 */
17164 cur_ref_buff + null_count,
17165 null_count ? cur_ref_buff : 0,
17166 cur_key_part->length, items[i], value);
17167 cur_ref_buff+= cur_key_part->store_length;
17168 }
17169 *ref_key= NULL; /* End marker. */
17170 key_err= 1;
17171 key_parts= tmp_key_parts;
17172 DBUG_RETURN(FALSE);
17173}
17174
17175
17176/*

Callers 2

make_unique_engineMethod · 0.80
initMethod · 0.80

Calls 3

real_maybe_nullMethod · 0.80
openMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected