diff options
author | unknown <ingo@mysql.com> | 2004-12-23 21:45:10 +0100 |
---|---|---|
committer | unknown <ingo@mysql.com> | 2004-12-23 21:45:10 +0100 |
commit | 8d11c01c595261c9c742356c0152c2152b847db9 (patch) | |
tree | 2278239c23c9cfa8abc2cfb833b598df01227ee8 /sql/opt_range.h | |
parent | dd6981f4d01072cbc5fa898bd6c42b54ffbb0fcf (diff) | |
download | mariadb-git-8d11c01c595261c9c742356c0152c2152b847db9.tar.gz |
WL#2126 - Multi_read_range.
Added the required structures and functions for
handing over multiple key ranges to the table handler.
include/my_base.h:
WL#2126 - Multi_read_range.
Moved key range flags from sql/opt_range.h to here.
Added the multi-range structure.
sql/handler.cc:
WL#2126 - Multi_read_range.
Added the new table handler methods.
sql/handler.h:
WL#2126 - Multi_read_range.
Added a new table flag.
Added a declaration for the handler buffer.
Added new elements to class handler.
Added new function declarations.
sql/mysqld.cc:
WL#2126 - Multi_read_range.
Added an option to set new system variable 'multi_range_count'.
sql/opt_range.cc:
WL#2126 - Multi_read_range.
Added initialization for the new class members.
Added initialization for the extended get_next().
Added de-initialization for the allocated buffers.
Added a buffer allocation method.
Added an inner loop to collect multiple ranges.
Adapted range collection loops to the new initialization.
sql/opt_range.h:
WL#2126 - Multi_read_range.
Moved key range flags from here to include/my_base.h.
Added new elements to class QUICK_RANGE_SELECT.
Added a copy constructor.
sql/records.cc:
WL#2126 - Multi_read_range.
Added a call of the allocation method.
sql/set_var.cc:
WL#2126 - Multi_read_range.
Added the new system variable 'multi_range_count'.
sql/sql_class.h:
WL#2126 - Multi_read_range.
Added the new system variable 'multi_range_count'.
Diffstat (limited to 'sql/opt_range.h')
-rw-r--r-- | sql/opt_range.h | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/sql/opt_range.h b/sql/opt_range.h index 74d388128c8..71981dfb5c7 100644 --- a/sql/opt_range.h +++ b/sql/opt_range.h @@ -24,16 +24,6 @@ #pragma interface /* gcc class implementation */ #endif -#define NO_MIN_RANGE 1 -#define NO_MAX_RANGE 2 -#define NEAR_MIN 4 -#define NEAR_MAX 8 -#define UNIQUE_RANGE 16 -#define EQ_RANGE 32 -#define NULL_RANGE 64 -#define GEOM_FLAG 128 - - typedef struct st_key_part { uint16 key,part, store_length, length; uint8 null_bit; @@ -135,9 +125,24 @@ public: */ virtual int reset(void) = 0; + /* + Initialize get_next() for row retrieval. + SYNOPSIS + get_next_init() + + get_next_init() must be called before the first get_next(). + If get_next_init() call fails get_next() must not be called. + + RETURN + 0 OK + other Error code + */ + virtual int get_next_init() { return false; } + virtual int get_next() = 0; /* get next record to retrieve */ + /* Range end should be called when we have looped over the whole index */ virtual void range_end() {} - virtual int get_next() = 0; /* get next record to retrieve */ + virtual bool reverse_sorted() = 0; virtual bool unique_key_range() { return false; } @@ -236,6 +241,14 @@ protected: closed no later then this quick select is deleted. */ bool free_file; + bool in_range; + uint multi_range_count; /* copy from thd->variables.multi_range_count */ + uint multi_range_length; /* the allocated length for the array */ + uint multi_range_bufsiz; /* copy from thd->variables.read_rnd_buff_size */ + KEY_MULTI_RANGE *multi_range; /* the multi-range array (allocated and + freed by QUICK_RANGE_SELECT) */ + HANDLER_BUFFER *multi_range_buff; /* the handler buffer (allocated and + freed by QUICK_RANGE_SELECT) */ protected: friend class TRP_ROR_INTERSECT; @@ -270,18 +283,19 @@ public: MEM_ROOT *parent_alloc=NULL); ~QUICK_RANGE_SELECT(); + int init(); int reset(void) { next=0; range= NULL; - cur_range= NULL; + cur_range= (QUICK_RANGE**) ranges.buffer; /* Note: in opt_range.cc there are places where it is assumed that this function always succeeds */ return 0; } - int init(); + int get_next_init(void); int get_next(); void range_end(); int get_next_prefix(uint prefix_length, byte *cur_prefix); @@ -296,6 +310,13 @@ public: #ifndef DBUG_OFF void dbug_dump(int indent, bool verbose); #endif + QUICK_RANGE_SELECT(const QUICK_RANGE_SELECT& org) : QUICK_SELECT_I() + { + bcopy(&org, this, sizeof(*this)); + multi_range_length= 0; + multi_range= NULL; + multi_range_buff= NULL; + } }; |