#include <opt_range.h>
Inheritance diagram for QUICK_ROR_UNION_SELECT:


Public Member Functions | |
| QUICK_ROR_UNION_SELECT (THD *thd, TABLE *table) | |
| ~QUICK_ROR_UNION_SELECT () | |
| int | init () |
| int | reset (void) |
| int | get_next () |
| bool | reverse_sorted () |
| bool | unique_key_range () |
| int | get_type () |
| void | add_keys_and_lengths (String *key_names, String *used_lengths) |
| void | add_info_string (String *str) |
| bool | check_if_keys_used (List< Item > *fields) |
| void | dbug_dump (int indent, bool verbose) |
| bool | push_quick_back (QUICK_SELECT_I *quick_sel_range) |
Public Attributes | |
| List< QUICK_SELECT_I > | quick_selects |
| QUEUE | queue |
| MEM_ROOT | alloc |
| THD * | thd |
| byte * | cur_rowid |
| byte * | prev_rowid |
| bool | have_prev_rowid |
| uint | rowid_length |
Static Private Member Functions | |
| static int | queue_cmp (void *arg, byte *val1, byte *val2) |
Private Attributes | |
| bool | scans_inited |
Definition at line 527 of file opt_range.h.
| QUICK_ROR_UNION_SELECT::QUICK_ROR_UNION_SELECT | ( | THD * | thd, | |
| TABLE * | table | |||
| ) |
Definition at line 1320 of file opt_range.cc.
References alloc, st_table::file, QUICK_SELECT_I::head, QUICK_SELECT_I::index, init_sql_alloc(), MAX_KEY, st_table::record, handler::ref_length, rowid_length, and thd.
01322 : thd(thd_param), scans_inited(FALSE) 01323 { 01324 index= MAX_KEY; 01325 head= table; 01326 rowid_length= table->file->ref_length; 01327 record= head->record[0]; 01328 init_sql_alloc(&alloc, thd->variables.range_alloc_block_size, 0); 01329 thd_param->mem_root= &alloc; 01330 }
Here is the call graph for this function:

| QUICK_ROR_UNION_SELECT::~QUICK_ROR_UNION_SELECT | ( | ) |
Definition at line 1443 of file opt_range.cc.
References alloc, DBUG_ENTER, DBUG_VOID_RETURN, List< T >::delete_elements(), delete_queue(), st_table::file, free_root(), handler::ha_rnd_end(), QUICK_SELECT_I::head, handler::inited, MYF, handler::NONE, queue, and quick_selects.
01444 { 01445 DBUG_ENTER("QUICK_ROR_UNION_SELECT::~QUICK_ROR_UNION_SELECT"); 01446 delete_queue(&queue); 01447 quick_selects.delete_elements(); 01448 if (head->file->inited != handler::NONE) 01449 head->file->ha_rnd_end(); 01450 free_root(&alloc,MYF(0)); 01451 DBUG_VOID_RETURN; 01452 }
Here is the call graph for this function:

| void QUICK_ROR_UNION_SELECT::add_info_string | ( | String * | str | ) | [virtual] |
Reimplemented from QUICK_SELECT_I.
Definition at line 8483 of file opt_range.cc.
References String::append(), FALSE, quick, quick_selects, STRING_WITH_LEN, and TRUE.
08484 { 08485 bool first= TRUE; 08486 QUICK_SELECT_I *quick; 08487 List_iterator_fast<QUICK_SELECT_I> it(quick_selects); 08488 str->append(STRING_WITH_LEN("union(")); 08489 while ((quick= it++)) 08490 { 08491 if (!first) 08492 str->append(','); 08493 else 08494 first= FALSE; 08495 quick->add_info_string(str); 08496 } 08497 str->append(')'); 08498 }
Here is the call graph for this function:

| void QUICK_ROR_UNION_SELECT::add_keys_and_lengths | ( | String * | key_names, | |
| String * | used_lengths | |||
| ) | [virtual] |
Implements QUICK_SELECT_I.
Definition at line 8581 of file opt_range.cc.
References String::append(), FALSE, quick, quick_selects, and TRUE.
08583 { 08584 bool first= TRUE; 08585 QUICK_SELECT_I *quick; 08586 List_iterator_fast<QUICK_SELECT_I> it(quick_selects); 08587 while ((quick= it++)) 08588 { 08589 if (first) 08590 first= FALSE; 08591 else 08592 { 08593 used_lengths->append(','); 08594 key_names->append(','); 08595 } 08596 quick->add_keys_and_lengths(key_names, used_lengths); 08597 } 08598 }
Here is the call graph for this function:

Reimplemented from QUICK_SELECT_I.
Definition at line 7450 of file opt_range.cc.
References quick, and quick_selects.
07451 { 07452 QUICK_SELECT_I *quick; 07453 List_iterator_fast<QUICK_SELECT_I> it(quick_selects); 07454 while ((quick= it++)) 07455 { 07456 if (quick->check_if_keys_used(fields)) 07457 return 1; 07458 } 07459 return 0; 07460 }
| void QUICK_ROR_UNION_SELECT::dbug_dump | ( | int | indent, | |
| bool | verbose | |||
| ) | [virtual] |
Implements QUICK_SELECT_I.
Definition at line 10847 of file opt_range.cc.
References DBUG_FILE, quick, and quick_selects.
10848 { 10849 List_iterator_fast<QUICK_SELECT_I> it(quick_selects); 10850 QUICK_SELECT_I *quick; 10851 fprintf(DBUG_FILE, "%*squick ROR-union select\n", indent, ""); 10852 fprintf(DBUG_FILE, "%*smerged scans {\n", indent, ""); 10853 while ((quick= it++)) 10854 quick->dbug_dump(indent+2, verbose); 10855 fprintf(DBUG_FILE, "%*s}\n", indent, ""); 10856 }
| int QUICK_ROR_UNION_SELECT::get_next | ( | ) | [virtual] |
Implements QUICK_SELECT_I.
Definition at line 7810 of file opt_range.cc.
References handler::cmp_ref(), cur_rowid, DBUG_ENTER, DBUG_RETURN, st_queue::elements, error, FALSE, st_table::file, HA_ERR_END_OF_FILE, HA_ERR_RECORD_DELETED, have_prev_rowid, QUICK_SELECT_I::head, memcpy, prev_rowid, queue, queue_remove(), queue_replaced, queue_top, quick, handler::rnd_pos(), rowid_length, and TRUE.
07811 { 07812 int error, dup_row; 07813 QUICK_SELECT_I *quick; 07814 byte *tmp; 07815 DBUG_ENTER("QUICK_ROR_UNION_SELECT::get_next"); 07816 07817 do 07818 { 07819 do 07820 { 07821 if (!queue.elements) 07822 DBUG_RETURN(HA_ERR_END_OF_FILE); 07823 /* Ok, we have a queue with >= 1 scans */ 07824 07825 quick= (QUICK_SELECT_I*)queue_top(&queue); 07826 memcpy(cur_rowid, quick->last_rowid, rowid_length); 07827 07828 /* put into queue rowid from the same stream as top element */ 07829 if ((error= quick->get_next())) 07830 { 07831 if (error != HA_ERR_END_OF_FILE) 07832 DBUG_RETURN(error); 07833 queue_remove(&queue, 0); 07834 } 07835 else 07836 { 07837 quick->save_last_pos(); 07838 queue_replaced(&queue); 07839 } 07840 07841 if (!have_prev_rowid) 07842 { 07843 /* No rows have been returned yet */ 07844 dup_row= FALSE; 07845 have_prev_rowid= TRUE; 07846 } 07847 else 07848 dup_row= !head->file->cmp_ref(cur_rowid, prev_rowid); 07849 } while (dup_row); 07850 07851 tmp= cur_rowid; 07852 cur_rowid= prev_rowid; 07853 prev_rowid= tmp; 07854 07855 error= head->file->rnd_pos(quick->record, prev_rowid); 07856 } while (error == HA_ERR_RECORD_DELETED); 07857 DBUG_RETURN(error); 07858 }
Here is the call graph for this function:

| int QUICK_ROR_UNION_SELECT::get_type | ( | ) | [inline, virtual] |
Implements QUICK_SELECT_I.
Definition at line 538 of file opt_range.h.
References QUICK_SELECT_I::QS_TYPE_ROR_UNION.
00538 { return QS_TYPE_ROR_UNION; }
| int QUICK_ROR_UNION_SELECT::init | ( | ) | [virtual] |
Implements QUICK_SELECT_I.
Definition at line 1343 of file opt_range.cc.
References alloc, alloc_root(), bzero, cur_rowid, DBUG_ENTER, DBUG_RETURN, base_list::elements, FALSE, st_table::file, QUICK_SELECT_I::head, init_queue(), prev_rowid, queue, queue_cmp(), quick_selects, and handler::ref_length.
01344 { 01345 DBUG_ENTER("QUICK_ROR_UNION_SELECT::init"); 01346 if (init_queue(&queue, quick_selects.elements, 0, 01347 FALSE , QUICK_ROR_UNION_SELECT::queue_cmp, 01348 (void*) this)) 01349 { 01350 bzero(&queue, sizeof(QUEUE)); 01351 DBUG_RETURN(1); 01352 } 01353 01354 if (!(cur_rowid= (byte*)alloc_root(&alloc, 2*head->file->ref_length))) 01355 DBUG_RETURN(1); 01356 prev_rowid= cur_rowid + head->file->ref_length; 01357 DBUG_RETURN(0); 01358 }
Here is the call graph for this function:

| bool QUICK_ROR_UNION_SELECT::push_quick_back | ( | QUICK_SELECT_I * | quick_sel_range | ) |
Definition at line 1438 of file opt_range.cc.
References List< T >::push_back(), and quick_selects.
Referenced by TRP_ROR_UNION::make_quick().
01439 { 01440 return quick_selects.push_back(quick_sel_range); 01441 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1372 of file opt_range.cc.
References QUICK_SELECT_I::last_rowid.
Referenced by init().
01373 { 01374 QUICK_ROR_UNION_SELECT *self= (QUICK_ROR_UNION_SELECT*)arg; 01375 return self->head->file->cmp_ref(((QUICK_SELECT_I*)val1)->last_rowid, 01376 ((QUICK_SELECT_I*)val2)->last_rowid); 01377 }
Here is the caller graph for this function:

| int QUICK_ROR_UNION_SELECT::reset | ( | void | ) | [virtual] |
Implements QUICK_SELECT_I.
Definition at line 1390 of file opt_range.cc.
References DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, error, FALSE, st_table::file, HA_ERR_END_OF_FILE, handler::ha_rnd_init(), have_prev_rowid, QUICK_SELECT_I::head, queue, queue_insert(), queue_remove_all, quick, quick_selects, scans_inited, and TRUE.
01391 { 01392 QUICK_SELECT_I* quick; 01393 int error; 01394 DBUG_ENTER("QUICK_ROR_UNION_SELECT::reset"); 01395 have_prev_rowid= FALSE; 01396 if (!scans_inited) 01397 { 01398 QUICK_SELECT_I *quick; 01399 List_iterator_fast<QUICK_SELECT_I> it(quick_selects); 01400 while ((quick= it++)) 01401 { 01402 if (quick->init_ror_merged_scan(FALSE)) 01403 DBUG_RETURN(1); 01404 } 01405 scans_inited= TRUE; 01406 } 01407 queue_remove_all(&queue); 01408 /* 01409 Initialize scans for merged quick selects and put all merged quick 01410 selects into the queue. 01411 */ 01412 List_iterator_fast<QUICK_SELECT_I> it(quick_selects); 01413 while ((quick= it++)) 01414 { 01415 if (quick->reset()) 01416 DBUG_RETURN(1); 01417 if ((error= quick->get_next())) 01418 { 01419 if (error == HA_ERR_END_OF_FILE) 01420 continue; 01421 DBUG_RETURN(error); 01422 } 01423 quick->save_last_pos(); 01424 queue_insert(&queue, (byte*)quick); 01425 } 01426 01427 if (head->file->ha_rnd_init(1)) 01428 { 01429 DBUG_PRINT("error", ("ROR index_merge rnd_init call failed")); 01430 DBUG_RETURN(1); 01431 } 01432 01433 DBUG_RETURN(0); 01434 }
Here is the call graph for this function:

| bool QUICK_ROR_UNION_SELECT::reverse_sorted | ( | ) | [inline, virtual] |
| bool QUICK_ROR_UNION_SELECT::unique_key_range | ( | ) | [inline, virtual] |
Definition at line 551 of file opt_range.h.
Referenced by init(), TRP_ROR_UNION::make_quick(), QUICK_ROR_UNION_SELECT(), and ~QUICK_ROR_UNION_SELECT().
Definition at line 550 of file opt_range.h.
Referenced by get_next(), init(), reset(), and ~QUICK_ROR_UNION_SELECT().
Definition at line 548 of file opt_range.h.
Referenced by add_info_string(), add_keys_and_lengths(), check_if_keys_used(), dbug_dump(), init(), push_quick_back(), reset(), and ~QUICK_ROR_UNION_SELECT().
bool QUICK_ROR_UNION_SELECT::scans_inited [private] |
1.4.7

