| 170 | |
| 171 | |
| 172 | void |
| 173 | TEST_join(JOIN *join) |
| 174 | { |
| 175 | uint ref; |
| 176 | int i; |
| 177 | List_iterator<JOIN_TAB_RANGE> it(join->join_tab_ranges); |
| 178 | JOIN_TAB_RANGE *jt_range; |
| 179 | DBUG_ENTER("TEST_join"); |
| 180 | |
| 181 | DBUG_LOCK_FILE; |
| 182 | (void) fputs("\nInfo about JOIN\n",DBUG_FILE); |
| 183 | while ((jt_range= it++)) |
| 184 | { |
| 185 | /* |
| 186 | Assemble results of all the calls to full_name() first, |
| 187 | in order not to garble the tabular output below. |
| 188 | */ |
| 189 | String ref_key_parts[MAX_TABLES]; |
| 190 | int tables_in_range= (int)(jt_range->end - jt_range->start); |
| 191 | for (i= 0; i < tables_in_range; i++) |
| 192 | { |
| 193 | JOIN_TAB *tab= jt_range->start + i; |
| 194 | for (ref= 0; ref < tab->ref.key_parts; ref++) |
| 195 | { |
| 196 | ref_key_parts[i].append(tab->ref.items[ref]->full_name_cstring()); |
| 197 | ref_key_parts[i].append(STRING_WITH_LEN(" ")); |
| 198 | } |
| 199 | } |
| 200 | |
| 201 | for (i= 0; i < tables_in_range; i++) |
| 202 | { |
| 203 | JOIN_TAB *tab= jt_range->start + i; |
| 204 | TABLE *form=tab->table; |
| 205 | char key_map_buff[128]; |
| 206 | fprintf(DBUG_FILE,"%-16.16s type: %-7s q_keys: %s refs: %d key: %d len: %d\n", |
| 207 | form->alias.c_ptr(), |
| 208 | join_type_str[tab->type], |
| 209 | tab->keys.print(key_map_buff), |
| 210 | tab->ref.key_parts, |
| 211 | tab->ref.key, |
| 212 | tab->ref.key_length); |
| 213 | if (tab->select) |
| 214 | { |
| 215 | char buf[MAX_KEY/8+1]; |
| 216 | if (tab->use_quick == 2) |
| 217 | fprintf(DBUG_FILE, |
| 218 | " quick select checked for each record (keys: %s)\n", |
| 219 | tab->select->quick_keys.print(buf)); |
| 220 | else if (tab->select->quick) |
| 221 | { |
| 222 | fprintf(DBUG_FILE, " quick select used:\n"); |
| 223 | tab->select->quick->dbug_dump(18, FALSE); |
| 224 | } |
| 225 | else |
| 226 | (void)fputs(" select used\n",DBUG_FILE); |
| 227 | } |
| 228 | if (tab->ref.key_parts) |
| 229 | { |
no test coverage detected