summaryrefslogtreecommitdiff
path: root/sql/table.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/table.h')
-rw-r--r--sql/table.h44
1 files changed, 34 insertions, 10 deletions
diff --git a/sql/table.h b/sql/table.h
index 57be97ffbda..4b8a5a78e1f 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -19,6 +19,7 @@
class Item; /* Needed by ORDER */
class GRANT_TABLE;
+class st_select_lex_unit;
/* Order clause list element */
@@ -43,6 +44,17 @@ typedef struct st_grant_info
enum tmp_table_type {NO_TMP_TABLE=0, TMP_TABLE=1, TRANSACTIONAL_TMP_TABLE=2};
+typedef struct st_filesort_info
+{
+ IO_CACHE *io_cache; /* If sorted through filebyte */
+ byte *addon_buf; /* Pointer to a buffer if sorted with fields */
+ uint addon_length; /* Length of the buffer */
+ struct st_sort_addon_field *addon_field; /* Pointer to the fields info */
+ void (*unpack)(struct st_sort_addon_field *, byte *); /* To unpack back */
+ byte *record_pointers; /* If sorted in memory */
+ ha_rows found_records; /* How many records in sort */
+} FILESORT_INFO;
+
/* Table cache entry struct */
class Field_timestamp;
@@ -53,7 +65,9 @@ struct st_table {
Field **field; /* Pointer to fields */
Field_blob **blob_field; /* Pointer to blob fields */
HASH name_hash; /* hash of field names */
- byte *record[3]; /* Pointer to records */
+ byte *record[2]; /* Pointer to records */
+ byte *default_values; /* record with default values for INSERT */
+ byte *insert_values; /* used by INSERT ... UPDATE */
uint fields; /* field count */
uint reclength; /* Recordlength */
uint rec_buff_length;
@@ -102,11 +116,14 @@ struct st_table {
my_bool crashed;
my_bool is_view;
my_bool no_keyread;
+ my_bool clear_query_id; /* To reset query_id for tables and cols */
+ my_bool auto_increment_field_not_null;
Field *next_number_field, /* Set if next_number is activated */
*found_next_number_field, /* Set on open */
*rowid_field;
Field_timestamp *timestamp_field;
my_string comment; /* Comment about table */
+ CHARSET_INFO *table_charset; /* Default charset of string fields */
REGINFO reginfo; /* field connections */
MEM_ROOT mem_root;
GRANT_INFO grant;
@@ -118,9 +135,7 @@ struct st_table {
table_map map; /* ID bit of table (1,2,4,8,16...) */
ulong version,flush_version;
uchar *null_flags;
- IO_CACHE *io_cache; /* If sorted trough file*/
- byte *record_pointers; /* If sorted in memory */
- ha_rows found_records; /* How many records in sort */
+ FILESORT_INFO sort;
ORDER *group;
ha_rows quick_rows[MAX_KEY];
uint quick_key_parts[MAX_KEY];
@@ -132,7 +147,8 @@ struct st_table {
uint temp_pool_slot; /* Used by intern temp tables */
struct st_table_list *pos_in_table_list;
};
-
+ /* number of select if it is derived table */
+ uint derived_select_number;
THD *in_use; /* Which thread uses this */
struct st_table *next,*prev;
};
@@ -148,9 +164,18 @@ typedef struct st_table_list
Item *on_expr; /* Used with outer join */
struct st_table_list *natural_join; /* natural join on this table*/
/* ... join ... USE INDEX ... IGNORE INDEX */
- List<String> *use_index,*ignore_index;
- TABLE *table;
- GRANT_INFO grant;
+ List<String> *use_index, *ignore_index;
+ /*
+ Usually hold reference on opened table, but may hold reference
+ to node of complete list of tables used in UNION & subselect.
+ */
+ union
+ {
+ TABLE *table; /* opened table */
+ st_table_list *table_list; /* pointer to node of list of all tables */
+ };
+ class st_select_lex_unit *derived; /* SELECT_LEX_UNIT of derived table */
+ GRANT_INFO grant;
thr_lock_type lock_type;
uint outer_join; /* Which join type */
uint shared; /* Used in union or in multi-upd */
@@ -158,9 +183,9 @@ typedef struct st_table_list
bool straight; /* optimize with prev table */
bool updating; /* for replicate-do/ignore table */
bool force_index; /* Prefer index over table scan */
+ bool ignore_leaves; /* Preload only non-leaf nodes */
} TABLE_LIST;
-
typedef struct st_changed_table_list
{
struct st_changed_table_list *next;
@@ -168,7 +193,6 @@ typedef struct st_changed_table_list
uint32 key_length;
} CHANGED_TABLE_LIST;
-
typedef struct st_open_table_list
{
struct st_open_table_list *next;