~mdcallag/+junk/5.1-map

« back to all changes in this revision

Viewing changes to sql/table.h

  • Committer: msvensson at pilot
  • Date: 2007-04-24 09:11:45 UTC
  • mfrom: (2469.1.106)
  • Revision ID: sp1r-msvensson@pilot.blaudden-20070424091145-10463
Merge pilot.blaudden:/home/msvensson/mysql/my51-m-mysql_upgrade
into  pilot.blaudden:/home/msvensson/mysql/mysql-5.1-maint

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
enum tmp_table_type
60
60
{
61
 
  NO_TMP_TABLE, TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
 
61
  NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
62
62
  INTERNAL_TMP_TABLE, SYSTEM_TMP_TABLE
63
63
};
64
64
 
197
197
  uint rowid_field_offset;              /* Field_nr +1 to rowid field */
198
198
  /* Index of auto-updated TIMESTAMP field in field array */
199
199
  uint primary_key;
200
 
  uint next_number_index;
201
 
  uint next_number_key_offset;
 
200
  uint next_number_index;               /* autoincrement key number */
 
201
  uint next_number_key_offset;          /* autoinc keypart offset in a key */
 
202
  uint next_number_keypart;             /* autoinc keypart number in a key */
202
203
  uint error, open_errno, errarg;       /* error from open_table_def() */
203
204
  uint column_bitmap_size;
204
205
  uchar frm_version;
235
236
  bool log_table;
236
237
#ifdef WITH_PARTITION_STORAGE_ENGINE
237
238
  bool auto_partitioned;
238
 
  const uchar *partition_info;
 
239
  const char *partition_info;
239
240
  uint  partition_info_len;
240
 
  const uchar *part_state;
 
241
  const char *part_state;
241
242
  uint part_state_len;
242
243
  handlerton *default_part_db_type;
243
244
#endif
299
300
 
300
301
 
301
302
/* Information for one open table */
 
303
enum index_hint_type
 
304
{
 
305
  INDEX_HINT_IGNORE,
 
306
  INDEX_HINT_USE,
 
307
  INDEX_HINT_FORCE
 
308
};
302
309
 
303
310
struct st_table {
304
311
  st_table() {}                               /* Remove gcc warning */
318
325
  byte *write_row_record;               /* Used as optimisation in
319
326
                                           THD::write_row */
320
327
  byte *insert_values;                  /* used by INSERT ... UPDATE */
321
 
  key_map quick_keys, used_keys;
322
 
 
 
328
  /* 
 
329
    Map of keys that can be used to retrieve all data from this table 
 
330
    needed by the query without reading the row.
 
331
  */
 
332
  key_map covering_keys;
 
333
  key_map quick_keys, merge_keys;
323
334
  /*
324
335
    A set of keys that can be used in the query that references this
325
336
    table.
332
343
    The set is implemented as a bitmap.
333
344
  */
334
345
  key_map keys_in_use_for_query;
335
 
  key_map merge_keys;
 
346
  /* Map of keys that can be used to calculate GROUP BY without sorting */
 
347
  key_map keys_in_use_for_group_by;
 
348
  /* Map of keys that can be used to calculate ORDER BY without sorting */
 
349
  key_map keys_in_use_for_order_by;
336
350
  KEY  *key_info;                       /* data of keys in database */
337
351
 
338
352
  Field *next_number_field;             /* Set if next_number is activated */
425
439
  my_bool no_cache;
426
440
  /* To signal that we should reset query_id for tables and cols */
427
441
  my_bool clear_query_id;
 
442
  /*
 
443
    To indicate that a non-null value of the auto_increment field
 
444
    was provided by the user or retrieved from the current record.
 
445
    Used only in the MODE_NO_AUTO_VALUE_ON_ZERO mode.
 
446
  */
428
447
  my_bool auto_increment_field_not_null;
429
448
  my_bool insert_or_update;             /* Can be used by the handler */
430
449
  my_bool alias_name_used;              /* true if table_name is alias */
666
685
         (TABLE_LIST::join_using_fields != NULL)
667
686
*/
668
687
 
 
688
class index_hint;
669
689
typedef struct st_table_list
670
690
{
671
691
  st_table_list() {}                          /* Remove gcc warning */
 
692
 
 
693
  /**
 
694
    Prepare TABLE_LIST that consists of one table instance to use in
 
695
    simple_open_and_lock_tables
 
696
  */
 
697
  inline void init_one_table(const char *db_name_arg,
 
698
                             const char *table_name_arg,
 
699
                             enum thr_lock_type lock_type_arg)
 
700
  {
 
701
    bzero((char*) this, sizeof(*this));
 
702
    db= (char*) db_name_arg;
 
703
    table_name= alias= (char*) table_name_arg;
 
704
    lock_type= lock_type_arg;
 
705
  }
 
706
 
672
707
  /*
673
708
    List of tables local to a subquery (used by SQL_LIST). Considers
674
709
    views as leaves (unlike 'next_leaf' below). Created at parse time
722
757
  */
723
758
  struct st_table_list *next_name_resolution_table;
724
759
  /* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
725
 
  List<String> *use_index, *ignore_index;
 
760
  List<index_hint> *index_hints;
726
761
  TABLE        *table;                          /* opened table */
727
762
  uint          table_id; /* table id (from binlog) for opened table */
728
763
  /*
896
931
  void reinit_before_use(THD *thd);
897
932
  Item_subselect *containing_subselect();
898
933
 
 
934
  /* 
 
935
    Compiles the tagged hints list and fills up st_table::keys_in_use_for_query,
 
936
    st_table::keys_in_use_for_group_by, st_table::keys_in_use_for_order_by,
 
937
    st_table::force_index and st_table::covering_keys.
 
938
  */
 
939
  bool process_index_hints(TABLE *table);
 
940
 
899
941
private:
900
942
  bool prep_check_option(THD *thd, uint8 check_opt_type);
901
943
  bool prep_where(THD *thd, Item **conds, bool no_where_clause);
1070
1112
 
1071
1113
my_bool
1072
1114
table_check_intact(TABLE *table, const uint table_f_count,
1073
 
                   const TABLE_FIELD_W_TYPE *table_def,
1074
 
                   time_t *last_create_time, int error_num);
 
1115
                   const TABLE_FIELD_W_TYPE *table_def);
1075
1116
 
1076
1117
static inline my_bitmap_map *tmp_use_all_columns(TABLE *table,
1077
1118
                                                 MY_BITMAP *bitmap)