~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table_share.h

  • Committer: Brian Aker
  • Date: 2009-08-17 15:34:55 UTC
  • mto: (1117.1.9 merge)
  • mto: This revision was merged to the branch mainline in revision 1118.
  • Revision ID: brian@gaz-20090817153455-emrlqx6cbxo9knfm
Fix for Stewart's patch (includes hack to solve MAX rows problem).

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
 
66
66
  unsigned char *default_values;                /* row with default values */
67
 
  LEX_STRING comment;                   /* Comment about table */
68
67
  const CHARSET_INFO *table_charset; /* Default charset of string fields */
69
68
 
70
69
  MY_BITMAP all_set;
85
84
  LEX_STRING normalized_path;           /* unpack_filename(path) */
86
85
  LEX_STRING connect_string;
87
86
 
88
 
  uint32_t   avg_row_length;            /* create information */
89
87
  uint32_t   block_size;                   /* create information */
90
88
  uint32_t   version;
91
89
  uint32_t   timestamp_offset;          /* Set to offset+1 of record */
93
91
  uint32_t   stored_rec_length;         /* Stored record length*/
94
92
  enum row_type row_type;               /* How rows are stored */
95
93
 
96
 
  ha_rows min_rows;             /* create information */
97
 
  ha_rows max_rows;             /* create information */
 
94
private:
 
95
  uint64_t max_rows_hack; // We can't use proto in a "tmp" table because of a lack of release mechanisms
 
96
  drizzled::message::Table *table_proto;
 
97
public:
 
98
 
 
99
  inline bool hasOptions()
 
100
  {
 
101
    return (table_proto) ? table_proto->has_options() : false;
 
102
  }
 
103
 
 
104
  /* This is only used in one location currently */
 
105
  inline void setTableProto(drizzled::message::Table *arg)
 
106
  {
 
107
    assert(table_proto == NULL);
 
108
    table_proto= arg;
 
109
  }
 
110
 
 
111
  inline bool hasComment()
 
112
  {
 
113
    return (table_proto) ?  table_proto->options().has_comment() : false; 
 
114
  }
 
115
 
 
116
  inline const char *getComment()
 
117
  {
 
118
    return (table_proto) ?  table_proto->options().comment().c_str() : NULL; 
 
119
  }
 
120
 
 
121
  inline uint32_t getCommentLength()
 
122
  {
 
123
    return (table_proto) ? table_proto->options().comment().length() : 0; 
 
124
  }
 
125
 
 
126
 
 
127
  inline uint32_t getAverageRowLength()
 
128
  {
 
129
    return (table_proto) ? table_proto->options().avg_row_length() : 0;
 
130
  }
 
131
 
 
132
  inline bool hasAverageRowLength()
 
133
  {
 
134
    return (table_proto) ? table_proto->options().has_avg_row_length() : false;
 
135
  }
 
136
 
 
137
  inline bool hasMaxRows()
 
138
  {
 
139
    return (table_proto) ? table_proto->options().has_max_rows() : false;
 
140
  }
 
141
 
 
142
  inline uint64_t getMaxRows()
 
143
  {
 
144
    return (table_proto) ? table_proto->options().max_rows() : max_rows_hack;
 
145
  }
 
146
 
 
147
  inline void setMaxRows(uint64_t arg)
 
148
  {
 
149
    if (table_proto)
 
150
    {
 
151
      drizzled::message::Table::TableOptions *table_options;
 
152
 
 
153
      table_options= table_proto->mutable_options();
 
154
      table_options->set_max_rows(arg);
 
155
    }
 
156
    else
 
157
    {
 
158
      max_rows_hack= arg;
 
159
    }
 
160
  }
 
161
 
 
162
  inline bool hasMinRows()
 
163
  {
 
164
    return (table_proto) ? table_proto->options().has_min_rows() : false;
 
165
  }
 
166
 
 
167
  inline uint64_t getMinRows()
 
168
  {
 
169
    return (table_proto) ? table_proto->options().min_rows() : 0;
 
170
  }
98
171
 
99
172
  StorageEngine *storage_engine;                        /* storage engine plugin */
100
173
  inline StorageEngine *db_type() const /* table_type for handler */
292
365
 
293
366
    storage_engine= NULL;
294
367
 
 
368
    delete table_proto;
 
369
    table_proto= NULL;
 
370
 
295
371
    /* We must copy mem_root from share because share is allocated through it */
296
372
    memcpy(&new_mem_root, &mem_root, sizeof(new_mem_root));
297
373
    free_root(&new_mem_root, MYF(0));                 // Free's share