75 Field **getFields()
const
80 Field *getField(uint32_t arg)
const
85 void setFields(Field **arg)
90 void setFieldAt(Field *arg, uint32_t arg_pos)
101 Table *getNext()
const
111 void setNext(Table *arg)
118 getNext()->setPrev(getPrev());
119 getPrev()->setNext(getNext());
125 Table *getPrev()
const
135 void setPrev(Table *arg)
140 boost::dynamic_bitset<> *read_set;
141 boost::dynamic_bitset<> *write_set;
148 boost::dynamic_bitset<> tmp_set;
156 unsigned char *getInsertRecord()
const
161 unsigned char *getUpdateRecord()
167 std::vector<unsigned char> insert_values;
176 const char *getAlias()
const
186 void setAlias(
const char *arg)
195 unsigned char *null_flags;
200 uint32_t used_fields;
203 uint32_t derived_select_number;
243 bool open_placeholder;
251 bool auto_increment_field_not_null;
252 bool alias_name_used;
296 timestamp_auto_set_type timestamp_field_type;
305 key_map covering_keys;
320 key_map keys_in_use_for_query;
323 key_map keys_in_use_for_group_by;
326 key_map keys_in_use_for_order_by;
332 ha_rows quick_rows[MAX_KEY];
335 key_part_map const_key_parts[MAX_KEY];
337 uint32_t quick_key_parts[MAX_KEY];
338 uint32_t quick_n_ranges[MAX_KEY];
345 if (not mem_root.alloc_root_inited())
346 mem_root.
init(TABLE_ALLOC_BLOCK_SIZE);
355 unsigned char* alloc(
size_t arg)
358 return mem_root.
alloc(arg);
361 char* strdup(
const char* str_arg,
size_t len_arg)
364 return mem_root.
strdup(str_arg, len_arg);
372 int report_error(
int error);
379 int delete_table(
bool free_share=
false);
381 void resetTable(Session *session, TableShare *share, uint32_t db_stat_arg);
384 virtual const TableShare *getShare()
const= 0;
385 virtual TableShare *getMutableShare()= 0;
386 virtual bool hasShare()
const= 0;
387 virtual void setShare(TableShare *new_share)= 0;
389 virtual void release(
void)= 0;
391 uint32_t sizeKeys() {
return getMutableShare()->sizeKeys(); }
392 uint32_t sizeFields() {
return getMutableShare()->sizeFields(); }
393 uint32_t getRecordLength()
const {
return getShare()->getRecordLength(); }
394 uint32_t sizeBlobFields() {
return getMutableShare()->blob_fields; }
395 uint32_t *getBlobField() {
return &getMutableShare()->blob_field[0]; }
398 virtual bool hasVariableWidth()
const
400 return getShare()->hasVariableWidth();
403 virtual void setVariableWidth(
void);
405 Field_blob *getBlobFieldAt(uint32_t arg)
const
407 if (arg < getShare()->blob_fields)
408 return (Field_blob*) field[getShare()->blob_field[arg]];
412 inline uint8_t getBlobPtrSize()
const {
return getShare()->sizeBlobPtr(); }
413 inline uint32_t getNullBytes()
const {
return getShare()->null_bytes; }
414 inline uint32_t getNullFields()
const {
return getShare()->null_fields; }
415 inline unsigned char *getDefaultValues() {
return getMutableShare()->getDefaultValues(); }
416 inline const char *getSchemaName()
const {
return getShare()->getSchemaName(); }
417 inline const char *getTableName()
const {
return getShare()->getTableName(); }
419 inline bool isDatabaseLowByteFirst()
const {
return getShare()->db_low_byte_first; }
420 inline bool isNameLock()
const {
return open_placeholder; }
422 uint32_t index_flags(uint32_t idx)
const;
424 inline plugin::StorageEngine *getEngine() const
426 return getShare()->getEngine();
429 Cursor &getCursor() const
435 size_t max_row_length(
const unsigned char *data);
436 uint32_t find_shortest_key(
const key_map *usable_keys);
437 bool compare_record(Field **ptr);
438 bool records_are_comparable();
439 bool compare_records();
442 void storeRecordAsInsert();
443 void storeRecordAsDefault();
444 void restoreRecord();
445 void restoreRecordAsDefault();
450 inline uint32_t getDBStat ()
const {
return db_stat; }
468 void fill_item_list(List<Item>&)
const;
469 void clear_column_bitmaps(
void);
470 void prepare_for_position(
void);
471 void mark_columns_used_by_index_no_reset(uint32_t index, boost::dynamic_bitset<>& bitmap);
472 void mark_columns_used_by_index_no_reset(uint32_t index);
473 void mark_columns_used_by_index(uint32_t index);
474 void restore_column_maps_after_mark_index();
475 void mark_auto_increment_column(
void);
476 void mark_columns_needed_for_update(
void);
477 void mark_columns_needed_for_delete(
void);
478 void mark_columns_needed_for_insert(
void);
479 void column_bitmaps_set(boost::dynamic_bitset<>& read_set_arg,
480 boost::dynamic_bitset<>& write_set_arg);
482 void restore_column_map(
const boost::dynamic_bitset<>& old);
484 const boost::dynamic_bitset<> use_all_columns(boost::dynamic_bitset<>& map);
485 inline void use_all_columns()
487 column_bitmaps_set(getMutableShare()->all_set, getMutableShare()->all_set);
490 inline void default_column_bitmaps()
492 read_set= &def_read_set;
493 write_set= &def_write_set;
497 inline bool isReadSet(uint32_t index)
const
499 return read_set->test(index);
502 inline void setReadSet(uint32_t index)
504 read_set->set(index);
507 inline void setReadSet()
512 inline void clearReadSet(uint32_t index)
514 read_set->reset(index);
517 inline void clearReadSet()
522 inline bool isWriteSet(uint32_t index)
524 return write_set->test(index);
527 inline void setWriteSet(uint32_t index)
529 write_set->set(index);
532 inline void setWriteSet()
537 inline void clearWriteSet(uint32_t index)
539 write_set->reset(index);
542 inline void clearWriteSet()
548 bool is_name_opened()
const
550 return db_stat || open_placeholder;
556 bool needs_reopen_or_name_lock()
const;
565 void setup_table_map(TableList *table_list, uint32_t tablenr);
566 inline void mark_as_null_row()
569 status|= STATUS_NULL_ROW;
570 memset(null_flags, 255, getShare()->null_bytes);
573 void free_io_cache();
574 void filesort_free_buffers(
bool full=
false);
575 void intern_close_table();
577 void print_error(
int error, myf errflag)
const;
585 cursor->errkey = (uint32_t) -1;
586 if (error == HA_ERR_FOUND_DUPP_KEY || error == HA_ERR_FOREIGN_DUPLICATE_KEY ||
587 error == HA_ERR_FOUND_DUPP_UNIQUE ||
588 error == HA_ERR_DROP_INDEX_FK)
589 cursor->info(HA_STATUS_ERRKEY | HA_STATUS_NO_LOCK);
597 bool operator<(
const Table &right)
const
599 return getShare()->getCacheKey() < right.getShare()->getCacheKey();
602 static bool compare(
const Table *a,
const Table *b)
607 friend std::ostream& operator<<(std::ostream& output,
const Table &table)
609 if (table.getShare())
612 output << table.getShare()->getSchemaName();
614 output << table.getShare()->getTableName();
616 output << table.getShare()->getTableTypeAsString();
621 output <<
"Table:(has no share)";
628 virtual bool isPlaceHolder(
void)
const