23
23
#ifndef DRIZZLED_OPT_RANGE_H
24
24
#define DRIZZLED_OPT_RANGE_H
26
#ifdef USE_PRAGMA_INTERFACE
27
#pragma interface /* gcc class implementation */
26
#include <mysys/queues.h>
30
28
typedef struct st_key_part {
303
301
uint32_t mrr_flags; /* Flags to be used with MRR interface */
305
uint32_t mrr_buf_size; /* copy from thd->variables.read_rnd_buff_size */
303
uint32_t mrr_buf_size; /* copy from session->variables.read_rnd_buff_size */
306
304
HANDLER_BUFFER *mrr_buf_desc; /* the handler buffer */
308
306
/* Info about index we're scanning */
320
QUICK_RANGE_SELECT(THD *thd, Table *table,uint32_t index_arg,bool no_alloc,
318
QUICK_RANGE_SELECT(Session *session, Table *table,uint32_t index_arg,bool no_alloc,
321
319
MEM_ROOT *parent_alloc, bool *create_err);
322
320
~QUICK_RANGE_SELECT();
351
349
friend class TRP_ROR_INTERSECT;
353
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, Table *table,
351
QUICK_RANGE_SELECT *get_quick_select_for_ref(Session *session, Table *table,
354
352
struct st_table_ref *ref,
355
353
ha_rows records);
356
354
friend bool get_quick_keys(PARAM *param, QUICK_RANGE_SELECT *quick,
436
434
class QUICK_INDEX_MERGE_SELECT : public QUICK_SELECT_I
439
QUICK_INDEX_MERGE_SELECT(THD *thd, Table *table);
437
QUICK_INDEX_MERGE_SELECT(Session *session, Table *table);
440
438
~QUICK_INDEX_MERGE_SELECT();
490
488
class QUICK_ROR_INTERSECT_SELECT : public QUICK_SELECT_I
493
QUICK_ROR_INTERSECT_SELECT(THD *thd, Table *table,
491
QUICK_ROR_INTERSECT_SELECT(Session *session, Table *table,
494
492
bool retrieve_full_rows,
495
493
MEM_ROOT *parent_alloc);
496
494
~QUICK_ROR_INTERSECT_SELECT();
520
518
QUICK_RANGE_SELECT *cpk_quick;
522
520
MEM_ROOT alloc; /* Memory pool for this and merged quick selects data. */
523
THD *thd; /* current thread */
521
Session *session; /* current thread */
524
522
bool need_to_fetch_row; /* if true, do retrieve full table records. */
525
523
/* in top-level quick select, true if merged scans where initialized */
526
524
bool scans_inited;
543
541
class QUICK_ROR_UNION_SELECT : public QUICK_SELECT_I
546
QUICK_ROR_UNION_SELECT(THD *thd, Table *table);
544
QUICK_ROR_UNION_SELECT(Session *session, Table *table);
547
545
~QUICK_ROR_UNION_SELECT();
563
561
QUEUE queue; /* Priority queue for merge operation */
564
562
MEM_ROOT alloc; /* Memory pool for this and merged quick selects data. */
566
THD *thd; /* current thread */
564
Session *session; /* current thread */
567
565
unsigned char *cur_rowid; /* buffer used in get_next() */
568
566
unsigned char *prev_rowid; /* rowid of last row returned by get_next() */
569
567
bool have_prev_rowid; /* true if prev_rowid has valid data */
710
bool check_quick(THD *thd, bool force_quick_range, ha_rows limit)
708
bool check_quick(Session *session, bool force_quick_range, ha_rows limit)
714
return test_quick_select(thd, tmp, 0, limit, force_quick_range, false) < 0;
712
return test_quick_select(session, tmp, 0, limit, force_quick_range, false) < 0;
716
714
inline bool skip_record() { return cond ? cond->val_int() == 0 : 0; }
717
int test_quick_select(THD *thd, key_map keys, table_map prev_tables,
715
int test_quick_select(Session *session, key_map keys, table_map prev_tables,
718
716
ha_rows limit, bool force_quick_range,
719
717
bool ordered_output);
722
QUICK_RANGE_SELECT *get_quick_select_for_ref(THD *thd, Table *table,
720
QUICK_RANGE_SELECT *get_quick_select_for_ref(Session *session, Table *table,
723
721
struct st_table_ref *ref,
724
722
ha_rows records);
725
723
uint32_t get_index_for_order(Table *table, order_st *order, ha_rows limit);