~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/instance.cc

  • Committer: Monty Taylor
  • Date: 2010-12-26 01:32:11 UTC
  • mto: This revision was merged to the branch mainline in revision 2038.
  • Revision ID: mordred@inaugust.com-20101226013211-c1tx52h7evovmijg
fixed dict and eval.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
namespace table
37
37
{
38
38
 
39
 
Singular::Singular(Session *session, List<CreateField> &field_list) :
 
39
Instance::Instance(Session *session, List<CreateField> &field_list) :
40
40
  _share(message::Table::INTERNAL),
41
41
  _has_variable_width(false)
42
42
{
52
52
  setFields(getMutableShare()->getFields(true));
53
53
  field_arg= getMutableShare()->getFields(true);
54
54
  getMutableShare()->blob_field.resize(field_count+1);
55
 
  getMutableShare()->setFieldSize(field_count);
 
55
  getMutableShare()->fields= field_count;
56
56
  getMutableShare()->blob_ptr_size= portable_sizeof_char_ptr;
57
57
  setup_tmp_table_column_bitmaps();
58
58
 
60
60
 
61
61
  /* Create all fields and calculate the total length of record */
62
62
  List_iterator_fast<CreateField> it(field_list);
63
 
  message::Table::Field null_field;
64
63
  while ((cdef= it++))
65
64
  {
66
 
    *field_arg= getMutableShare()->make_field(null_field,
67
 
                                              NULL,
 
65
    *field_arg= getMutableShare()->make_field(NULL,
68
66
                                              cdef->length,
69
67
                                              (cdef->flags & NOT_NULL_FLAG) ? false : true,
70
68
                                              (unsigned char *) ((cdef->flags & NOT_NULL_FLAG) ? 0 : ""),
98
96
  null_pack_length= (null_count + 7)/8;
99
97
  getMutableShare()->setRecordLength(record_length + null_pack_length);
100
98
  getMutableShare()->rec_buff_length= ALIGN_SIZE(getMutableShare()->getRecordLength() + 1);
101
 
  record[0]= (unsigned char*)session->getMemRoot()->allocate(getMutableShare()->rec_buff_length);
 
99
  record[0]= (unsigned char*)session->alloc(getMutableShare()->rec_buff_length);
102
100
  if (not getInsertRecord())
103
101
  {
104
102
    throw "Memory allocation failure";
138
136
  }
139
137
}
140
138
 
141
 
bool Singular::open_tmp_table()
 
139
bool Instance::open_tmp_table()
142
140
{
143
141
  int error;
144
142
  
145
 
  identifier::Table identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getPath());
 
143
  TableIdentifier identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getPath());
146
144
  if ((error=cursor->ha_open(identifier,
147
145
                             O_RDWR,
148
146
                             HA_OPEN_TMP_TABLE | HA_OPEN_INTERNAL_TABLE)))
185
183
     true  - Error
186
184
*/
187
185
 
188
 
bool Singular::create_myisam_tmp_table(KeyInfo *keyinfo,
 
186
bool Instance::create_myisam_tmp_table(KeyInfo *keyinfo,
189
187
                                                 MI_COLUMNDEF *start_recinfo,
190
188
                                                 MI_COLUMNDEF **recinfo,
191
189
                                                 uint64_t options)
294
292
    a tmp_set bitmap to be used by things like filesort.
295
293
*/
296
294
 
297
 
void Singular::setup_tmp_table_column_bitmaps()
 
295
void Instance::setup_tmp_table_column_bitmaps()
298
296
{
299
297
  uint32_t field_count= getShare()->sizeFields();
300
298
 
308
306
  default_column_bitmaps();
309
307
}
310
308
 
311
 
Singular::~Singular()
 
309
Instance::~Instance()
312
310
{
313
311
  const char *save_proc_info;
314
312
 
325
323
      cursor->closeMarkForDelete(getShare()->getTableName());
326
324
    }
327
325
 
328
 
    identifier::Table identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getTableName());
329
 
    drizzled::error_t ignored;
330
 
    plugin::StorageEngine::dropTable(*in_use,
331
 
                                     *getShare()->getEngine(),
332
 
                                     identifier,
333
 
                                     ignored);
 
326
    TableIdentifier identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getTableName());
 
327
    getShare()->getEngine()->doDropTable(*in_use, identifier);
334
328
 
335
329
    delete cursor;
336
330
  }