summaryrefslogtreecommitdiff
path: root/sql/handler.h
diff options
context:
space:
mode:
authorunknown <ingo@mysql.com>2004-12-23 21:45:10 +0100
committerunknown <ingo@mysql.com>2004-12-23 21:45:10 +0100
commit8d11c01c595261c9c742356c0152c2152b847db9 (patch)
tree2278239c23c9cfa8abc2cfb833b598df01227ee8 /sql/handler.h
parentdd6981f4d01072cbc5fa898bd6c42b54ffbb0fcf (diff)
downloadmariadb-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/handler.h')
-rw-r--r--sql/handler.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/sql/handler.h b/sql/handler.h
index f0faeff9234..62638ee456b 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -76,6 +76,7 @@
#define HA_FILE_BASED (1 << 26)
#define HA_NO_VARCHAR (1 << 27)
#define HA_CAN_BIT_FIELD (1 << 28) /* supports bit fields */
+#define HA_NEED_READ_RANGE_BUFFER (1 << 29) /* for read_multi_range */
/* bits in index_flags(index_number) for what you can do with index */
@@ -276,6 +277,21 @@ typedef struct st_ha_check_opt
} HA_CHECK_OPT;
+/*
+ This is a buffer area that the handler can use to store rows.
+ 'end_of_used_area' should be kept updated after calls to
+ read-functions so that other parts of the code can use the
+ remaining area (until next read calls is issued).
+*/
+
+typedef struct st_handler_buffer
+{
+ const byte *buffer; /* Buffer one can start using */
+ const byte *buffer_end; /* End of buffer */
+ byte *end_of_used_area; /* End of area that was used by handler */
+} HANDLER_BUFFER;
+
+
class handler :public Sql_alloc
{
protected:
@@ -310,6 +326,12 @@ public:
time_t check_time;
time_t update_time;
+ /* The following are for read_multi_range */
+ bool multi_range_sorted;
+ KEY_MULTI_RANGE *multi_range_curr;
+ KEY_MULTI_RANGE *multi_range_end;
+ HANDLER_BUFFER *multi_range_buffer;
+
/* The following are for read_range() */
key_range save_end_range, *end_range;
KEY_PART_INFO *range_key_part;
@@ -421,6 +443,10 @@ public:
virtual int index_next_same(byte *buf, const byte *key, uint keylen);
virtual int index_read_last(byte * buf, const byte * key, uint key_len)
{ return (my_errno=HA_ERR_WRONG_COMMAND); }
+ virtual int read_multi_range_first(KEY_MULTI_RANGE **found_range_p,
+ KEY_MULTI_RANGE *ranges, uint range_count,
+ bool sorted, HANDLER_BUFFER *buffer);
+ virtual int read_multi_range_next(KEY_MULTI_RANGE **found_range_p);
virtual int read_range_first(const key_range *start_key,
const key_range *end_key,
bool eq_range, bool sorted);