130
boost::dynamic_bitset<> *read_set; /* Active column sets */
131
boost::dynamic_bitset<> *write_set; /* Active column sets */
127
MyBitmap *read_set; /* Active column sets */
128
MyBitmap *write_set; /* Active column sets */
133
130
uint32_t tablenr;
134
131
uint32_t db_stat; /**< information about the cursor as in Cursor.h */
136
boost::dynamic_bitset<> def_read_set; /**< Default read set of columns */
137
boost::dynamic_bitset<> def_write_set; /**< Default write set of columns */
138
boost::dynamic_bitset<> tmp_set; /* Not sure about this... */
133
MyBitmap def_read_set; /**< Default read set of columns */
134
MyBitmap def_write_set; /**< Default write set of columns */
135
MyBitmap tmp_set; /* Not sure about this... */
140
137
Session *in_use; /**< Pointer to the current session using this object */
141
138
Session *getSession()
146
unsigned char *getInsertRecord()
151
unsigned char *getUpdateRecord()
156
143
unsigned char *record[2]; /**< Pointer to "records" */
157
std::vector<unsigned char> insert_values; /* used by INSERT ... UPDATE */
144
unsigned char *insert_values; /* used by INSERT ... UPDATE */
158
145
KeyInfo *key_info; /**< data of keys in database */
159
146
Field *next_number_field; /**< Set if next_number is activated. @TODO What the heck is the difference between this and the next member? */
160
147
Field *found_next_number_field; /**< Points to the "next-number" field (autoincrement field) */
161
148
Field_timestamp *timestamp_field; /**< Points to the auto-setting timestamp field, if any */
163
150
TableList *pos_in_table_list; /* Element referring to this table */
166
const char *getAlias() const
168
return _alias.c_str();
176
void setAlias(const char *arg)
182
std::string _alias; /**< alias or table name if no alias */
152
const char *alias; /**< alias or table name if no alias */
185
153
unsigned char *null_flags;
187
155
uint32_t lock_position; /**< Position in DRIZZLE_LOCK.table */
188
156
uint32_t lock_data_start; /**< Start pos. in DRIZZLE_LOCK.locks */
189
157
uint32_t lock_count; /**< Number of locks */
190
158
uint32_t used_fields;
191
uint32_t status; /* What's in getInsertRecord() */
159
uint32_t status; /* What's in record[0] */
192
160
/* number of select if it is derived table */
193
161
uint32_t derived_select_number;
194
162
int current_lock; /**< Type of lock on table */
375
341
* @param If true if we also want to free table_share
376
342
* @note this should all be the destructor
378
int delete_table(bool free_share= false);
344
int delete_table(bool free_share);
380
346
void resetTable(Session *session, TableShare *share, uint32_t db_stat_arg);
382
348
/* SHARE methods */
383
virtual const TableShare *getShare() const= 0; /* Get rid of this long term */
384
virtual TableShare *getMutableShare()= 0; /* Get rid of this long term */
385
virtual bool hasShare() const= 0; /* Get rid of this long term */
386
virtual void setShare(TableShare *new_share)= 0; /* Get rid of this long term */
388
virtual void release(void)= 0;
390
uint32_t sizeKeys() { return getMutableShare()->sizeKeys(); }
391
uint32_t sizeFields() { return getMutableShare()->sizeFields(); }
392
uint32_t getRecordLength() const { return getShare()->getRecordLength(); }
393
uint32_t sizeBlobFields() { return getMutableShare()->blob_fields; }
394
uint32_t *getBlobField() { return &getMutableShare()->blob_field[0]; }
397
virtual bool hasVariableWidth() const
399
return getShare()->hasVariableWidth(); // We should calculate this.
402
virtual void setVariableWidth(void);
349
inline const TableShare *getShare() const { assert(s); return s; } /* Get rid of this long term */
350
inline bool hasShare() const { return s ? true : false ; } /* Get rid of this long term */
351
inline TableShare *getMutableShare() { assert(s); return s; } /* Get rid of this long term */
352
inline void setShare(TableShare *new_share) { s= new_share; } /* Get rid of this long term */
353
inline uint32_t sizeKeys() { return s->sizeKeys(); }
354
inline uint32_t sizeFields() { return s->sizeFields(); }
355
inline uint32_t getRecordLength() const { return s->getRecordLength(); }
356
inline uint32_t sizeBlobFields() { return s->blob_fields; }
357
inline uint32_t *getBlobField() { return &s->blob_field[0]; }
404
359
Field_blob *getBlobFieldAt(uint32_t arg) const
406
if (arg < getShare()->blob_fields)
407
return (Field_blob*) field[getShare()->blob_field[arg]]; /*NOTE: Using 'Table.field' NOT SharedTable.field. */
361
if (arg < s->blob_fields)
362
return (Field_blob*) field[s->blob_field[arg]]; /*NOTE: Using 'Table.field' NOT SharedTable.field. */
411
inline uint8_t getBlobPtrSize() { return getShare()->blob_ptr_size; }
412
inline uint32_t getNullBytes() { return getShare()->null_bytes; }
413
inline uint32_t getNullFields() { return getShare()->null_fields; }
414
inline unsigned char *getDefaultValues() { return getMutableShare()->getDefaultValues(); }
415
inline const char *getSchemaName() const { return getShare()->getSchemaName(); }
416
inline const char *getTableName() const { return getShare()->getTableName(); }
366
inline uint8_t getBlobPtrSize() { return s->blob_ptr_size; }
367
inline uint32_t getNullBytes() { return s->null_bytes; }
368
inline uint32_t getNullFields() { return s->null_fields; }
369
inline unsigned char *getDefaultValues() { return s->getDefaultValues(); }
370
inline const char *getSchemaName() const { return s->getSchemaName(); }
371
inline const char *getTableName() const { return s->getTableName(); }
418
inline bool isDatabaseLowByteFirst() { return getShare()->db_low_byte_first; } /* Portable row format */
419
inline bool isNameLock() const { return open_placeholder; }
373
inline bool isDatabaseLowByteFirst() { return s->db_low_byte_first; } /* Portable row format */
374
inline bool isNameLock() const { return s->isNameLock(); }
375
inline bool isReplaceWithNameLock() { return s->replace_with_name_lock; }
376
inline bool isWaitingOnCondition() const { return s->isWaitingOnCondition(); } /* Protection against free */
421
378
uint32_t index_flags(uint32_t idx) const
423
return getShare()->storage_engine->index_flags(getShare()->getKeyInfo(idx).algorithm);
380
return s->storage_engine->index_flags(s->getKeyInfo(idx).algorithm);
426
383
inline plugin::StorageEngine *getEngine() const /* table_type for handler */
428
return getShare()->storage_engine;
385
return s->storage_engine;
431
388
Cursor &getCursor() const /* table_type for handler */
394
/* For TMP tables, should be pulled out as a class */
395
void setup_tmp_table_column_bitmaps(unsigned char *bitmaps);
396
bool create_myisam_tmp_table(KeyInfo *keyinfo,
397
MI_COLUMNDEF *start_recinfo,
398
MI_COLUMNDEF **recinfo,
400
void free_tmp_table(Session *session);
401
bool open_tmp_table();
437
402
size_t max_row_length(const unsigned char *data);
438
403
uint32_t find_shortest_key(const key_map *usable_keys);
439
404
bool compare_record(Field **ptr);
440
bool records_are_comparable();
441
bool compare_records();
405
bool compare_record();
442
406
/* TODO: the (re)storeRecord's may be able to be further condensed */
443
407
void storeRecord();
444
408
void storeRecordAsInsert();
478
441
void mark_columns_needed_for_update(void);
479
442
void mark_columns_needed_for_delete(void);
480
443
void mark_columns_needed_for_insert(void);
481
void column_bitmaps_set(boost::dynamic_bitset<>& read_set_arg,
482
boost::dynamic_bitset<>& write_set_arg);
484
void restore_column_map(const boost::dynamic_bitset<>& old);
486
const boost::dynamic_bitset<> use_all_columns(boost::dynamic_bitset<>& map);
444
inline void column_bitmaps_set(MyBitmap *read_set_arg,
445
MyBitmap *write_set_arg)
447
read_set= read_set_arg;
448
write_set= write_set_arg;
451
void restore_column_map(my_bitmap_map *old);
453
my_bitmap_map *use_all_columns(MyBitmap *bitmap);
487
454
inline void use_all_columns()
489
column_bitmaps_set(getMutableShare()->all_set, getMutableShare()->all_set);
456
column_bitmaps_set(&s->all_set, &s->all_set);
492
459
inline void default_column_bitmaps()
498
465
/* Both of the below should go away once we can move this bit to the field objects */
499
466
inline bool isReadSet(uint32_t index)
501
return read_set->test(index);
468
return read_set->isBitSet(index);
504
471
inline void setReadSet(uint32_t index)
506
read_set->set(index);
473
read_set->setBit(index);
509
476
inline void setReadSet()
514
481
inline void clearReadSet(uint32_t index)
516
read_set->reset(index);
483
read_set->clearBit(index);
519
486
inline void clearReadSet()
488
read_set->clearAll();
524
491
inline bool isWriteSet(uint32_t index)
526
return write_set->test(index);
493
return write_set->isBitSet(index);
529
496
inline void setWriteSet(uint32_t index)
531
write_set->set(index);
498
write_set->setBit(index);
534
501
inline void setWriteSet()
539
506
inline void clearWriteSet(uint32_t index)
541
write_set->reset(index);
508
write_set->clearBit(index);
544
511
inline void clearWriteSet()
513
write_set->clearAll();
549
516
/* Is table open or should be treated as such by name-locking? */
614
600
friend std::ostream& operator<<(std::ostream& output, const Table &table)
616
if (table.getShare())
619
output << table.getShare()->getSchemaName();
621
output << table.getShare()->getTableName();
623
output << table.getShare()->getTableTypeAsString();
628
output << "Table:(has no share)";
603
output << table.getShare()->getSchemaName();
605
output << table.getShare()->getTableName();
607
output << table.getShare()->getTableTypeAsString();
631
610
return output; // for multiple << operators.
614
bool is_placeholder_created;
635
virtual bool isPlaceHolder(void) const
619
return is_placeholder_created;
831
827
namespace optimizer { class SqlSelect; }
829
ha_rows filesort(Session *session,
831
st_sort_field *sortorder,
833
optimizer::SqlSelect *select,
836
ha_rows *examined_rows);
838
void filesort_free_buffers(Table *table, bool full);
833
839
void change_double_for_sort(double nr,unsigned char *to);
834
840
double my_double_round(double value, int64_t dec, bool dec_unsigned,
839
845
TYPELIB *convert_strings_to_array_type(char * *typelibs, char * *end);
840
846
TYPELIB *typelib(memory::Root *mem_root, List<String> &strings);
841
847
ulong get_form_pos(int file, unsigned char *head, TYPELIB *save_names);
848
ulong next_io_size(ulong pos);
842
849
void append_unescaped(String *res, const char *pos, uint32_t length);
844
851
int rename_file_ext(const char * from,const char * to,const char * ext);