~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.h

  • Committer: Brian Aker
  • Date: 2010-10-15 00:59:36 UTC
  • mfrom: (1849 staging)
  • mto: This revision was merged to the branch mainline in revision 1853.
  • Revision ID: brian@tangent.org-20101015005936-znhvkz8khs4fhlyv
Merge with trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
 */
62
62
class Table 
63
63
{
64
 
public:
65
 
  TableShare *s; /**< Pointer to the shared metadata about the table */
 
64
  TableShare *_share; /**< Pointer to the shared metadata about the table */
66
65
 
67
 
private:
68
66
  Field **field; /**< Pointer to fields collection */
69
67
public:
70
68
 
355
353
    return mem_root.strmake_root(str_arg, len_arg);
356
354
  }
357
355
 
358
 
  filesort_info_st sort;
 
356
  filesort_info sort;
359
357
 
360
358
  Table();
361
359
  virtual ~Table() { };
372
370
  void resetTable(Session *session, TableShare *share, uint32_t db_stat_arg);
373
371
 
374
372
  /* SHARE methods */
375
 
  inline const TableShare *getShare() const { assert(s); return s; } /* Get rid of this long term */
376
 
  inline bool hasShare() const { return s ? true : false ; } /* Get rid of this long term */
377
 
  inline TableShare *getMutableShare() { assert(s); return s; } /* Get rid of this long term */
378
 
  inline void setShare(TableShare *new_share) { s= new_share; } /* Get rid of this long term */
379
 
  inline uint32_t sizeKeys() { return s->sizeKeys(); }
380
 
  inline uint32_t sizeFields() { return s->sizeFields(); }
381
 
  inline uint32_t getRecordLength() const { return s->getRecordLength(); }
382
 
  inline uint32_t sizeBlobFields() { return s->blob_fields; }
383
 
  inline uint32_t *getBlobField() { return &s->blob_field[0]; }
 
373
  virtual const TableShare *getShare() const { assert(_share); return _share; } /* Get rid of this long term */
 
374
  virtual TableShare *getMutableShare() { assert(_share); return _share; } /* Get rid of this long term */
 
375
  inline bool hasShare() const { return _share ? true : false ; } /* Get rid of this long term */
 
376
  inline void setShare(TableShare *new_share) { _share= new_share; } /* Get rid of this long term */
 
377
  inline uint32_t sizeKeys() { return _share->sizeKeys(); }
 
378
  inline uint32_t sizeFields() { return _share->sizeFields(); }
 
379
  inline uint32_t getRecordLength() const { return _share->getRecordLength(); }
 
380
  inline uint32_t sizeBlobFields() { return _share->blob_fields; }
 
381
  inline uint32_t *getBlobField() { return &_share->blob_field[0]; }
 
382
 
 
383
public:
 
384
  virtual bool hasVariableWidth() const
 
385
  {
 
386
    return getShare()->hasVariableWidth(); // We should calculate this.
 
387
  }
 
388
 
 
389
  virtual void setVariableWidth(void);
384
390
 
385
391
  Field_blob *getBlobFieldAt(uint32_t arg) const
386
392
  {
387
 
    if (arg < s->blob_fields)
388
 
      return (Field_blob*) field[s->blob_field[arg]]; /*NOTE: Using 'Table.field' NOT SharedTable.field. */
 
393
    if (arg < getShare()->blob_fields)
 
394
      return (Field_blob*) field[getShare()->blob_field[arg]]; /*NOTE: Using 'Table.field' NOT SharedTable.field. */
389
395
 
390
396
    return NULL;
391
397
  }
392
 
  inline uint8_t getBlobPtrSize() { return s->blob_ptr_size; }
393
 
  inline uint32_t getNullBytes() { return s->null_bytes; }
394
 
  inline uint32_t getNullFields() { return s->null_fields; }
395
 
  inline unsigned char *getDefaultValues() { return  s->getDefaultValues(); }
396
 
  inline const char *getSchemaName()  const { return s->getSchemaName(); }
397
 
  inline const char *getTableName()  const { return s->getTableName(); }
 
398
  inline uint8_t getBlobPtrSize() { return getShare()->blob_ptr_size; }
 
399
  inline uint32_t getNullBytes() { return getShare()->null_bytes; }
 
400
  inline uint32_t getNullFields() { return getShare()->null_fields; }
 
401
  inline unsigned char *getDefaultValues() { return  getMutableShare()->getDefaultValues(); }
 
402
  inline const char *getSchemaName()  const { return getShare()->getSchemaName(); }
 
403
  inline const char *getTableName()  const { return getShare()->getTableName(); }
398
404
 
399
 
  inline bool isDatabaseLowByteFirst() { return s->db_low_byte_first; } /* Portable row format */
400
 
  inline bool isNameLock() const { return s->isNameLock(); }
401
 
  inline bool isReplaceWithNameLock() { return s->replace_with_name_lock; }
 
405
  inline bool isDatabaseLowByteFirst() { return getShare()->db_low_byte_first; } /* Portable row format */
 
406
  inline bool isNameLock() const { return getShare()->isNameLock(); }
 
407
  inline bool isReplaceWithNameLock() { return getShare()->replace_with_name_lock; }
402
408
 
403
409
  uint32_t index_flags(uint32_t idx) const
404
410
  {
405
 
    return s->storage_engine->index_flags(s->getKeyInfo(idx).algorithm);
 
411
    return getShare()->storage_engine->index_flags(getShare()->getKeyInfo(idx).algorithm);
406
412
  }
407
413
 
408
414
  inline plugin::StorageEngine *getEngine() const   /* table_type for handler */
409
415
  {
410
 
    return s->storage_engine;
 
416
    return getShare()->storage_engine;
411
417
  }
412
418
 
413
419
  Cursor &getCursor() const /* table_type for handler */
474
480
  const boost::dynamic_bitset<> use_all_columns(boost::dynamic_bitset<>& map);
475
481
  inline void use_all_columns()
476
482
  {
477
 
    column_bitmaps_set(s->all_set, s->all_set);
 
483
    column_bitmaps_set(getMutableShare()->all_set, getMutableShare()->all_set);
478
484
  }
479
485
 
480
486
  inline void default_column_bitmaps()
544
550
  */
545
551
  inline bool needs_reopen_or_name_lock()
546
552
  { 
547
 
    return s->getVersion() != refresh_version;
 
553
    return getShare()->getVersion() != refresh_version;
548
554
  }
549
555
 
550
556
  /**
559
565
  {
560
566
    null_row= 1;
561
567
    status|= STATUS_NULL_ROW;
562
 
    memset(null_flags, 255, s->null_bytes);
 
568
    memset(null_flags, 255, getShare()->null_bytes);
563
569
  }
564
570
 
565
571
  void free_io_cache();
568
574
 
569
575
  void print_error(int error, myf errflag)
570
576
  {
571
 
    s->storage_engine->print_error(error, errflag, *this);
 
577
    getShare()->storage_engine->print_error(error, errflag, *this);
572
578
  }
573
579
 
574
580
  /**
823
829
class select_union;
824
830
class Tmp_Table_Param;
825
831
 
826
 
struct open_table_list_st
827
 
{
828
 
  std::string   db;
829
 
  std::string   table;
830
 
  uint32_t in_use;
831
 
  uint32_t locked;
832
 
 
833
 
  open_table_list_st() :
834
 
    in_use(0),
835
 
    locked(0)
836
 
  { }
837
 
 
838
 
};
839
 
 
840
832
void free_blobs(Table *table);
841
833
int set_zone(int nr,int min_zone,int max_zone);
842
834
uint32_t convert_period_to_month(uint32_t period);