~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table/instance.cc

  • Committer: Andrew Hutchings
  • Date: 2011-01-10 16:11:45 UTC
  • mto: (2069.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2070.
  • Revision ID: andrew@linuxjedi.co.uk-20110110161145-isdc0ncbo2hx2n5c
Fix pandora error message

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
19
19
 */
20
20
 
21
 
#include <config.h>
 
21
#include "config.h"
22
22
 
23
23
#include <sys/types.h>
24
24
#include <sys/stat.h>
25
25
#include <fcntl.h>
26
26
 
27
 
#include <drizzled/session.h>
28
 
#include <plugin/myisam/myisam.h>
29
 
#include <drizzled/plugin/transactional_storage_engine.h>
 
27
#include "drizzled/session.h"
 
28
#include "plugin/myisam/myisam.h"
 
29
#include "drizzled/plugin/transactional_storage_engine.h"
30
30
 
31
 
#include <drizzled/table.h>
 
31
#include "drizzled/table.h"
32
32
 
33
33
namespace drizzled
34
34
{
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
{
59
59
  in_use= session;           /* field_arg->reset() may access in_use */
60
60
 
61
61
  /* Create all fields and calculate the total length of record */
62
 
  List<CreateField>::iterator it(field_list.begin());
 
62
  List_iterator_fast<CreateField> it(field_list);
63
63
  message::Table::Field null_field;
64
64
  while ((cdef= it++))
65
65
  {
98
98
  null_pack_length= (null_count + 7)/8;
99
99
  getMutableShare()->setRecordLength(record_length + null_pack_length);
100
100
  getMutableShare()->rec_buff_length= ALIGN_SIZE(getMutableShare()->getRecordLength() + 1);
101
 
  record[0]= (unsigned char*)session->getMemRoot()->allocate(getMutableShare()->rec_buff_length);
 
101
  record[0]= (unsigned char*)session->alloc(getMutableShare()->rec_buff_length);
102
102
  if (not getInsertRecord())
103
103
  {
104
104
    throw "Memory allocation failure";
138
138
  }
139
139
}
140
140
 
141
 
bool Singular::open_tmp_table()
 
141
bool Instance::open_tmp_table()
142
142
{
143
143
  int error;
144
144
  
145
 
  identifier::Table identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getPath());
 
145
  TableIdentifier identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getPath());
146
146
  if ((error=cursor->ha_open(identifier,
147
147
                             O_RDWR,
148
148
                             HA_OPEN_TMP_TABLE | HA_OPEN_INTERNAL_TABLE)))
185
185
     true  - Error
186
186
*/
187
187
 
188
 
bool Singular::create_myisam_tmp_table(KeyInfo *keyinfo,
 
188
bool Instance::create_myisam_tmp_table(KeyInfo *keyinfo,
189
189
                                                 MI_COLUMNDEF *start_recinfo,
190
190
                                                 MI_COLUMNDEF **recinfo,
191
191
                                                 uint64_t options)
294
294
    a tmp_set bitmap to be used by things like filesort.
295
295
*/
296
296
 
297
 
void Singular::setup_tmp_table_column_bitmaps()
 
297
void Instance::setup_tmp_table_column_bitmaps()
298
298
{
299
299
  uint32_t field_count= getShare()->sizeFields();
300
300
 
308
308
  default_column_bitmaps();
309
309
}
310
310
 
311
 
Singular::~Singular()
 
311
Instance::~Instance()
312
312
{
313
313
  const char *save_proc_info;
314
314
 
325
325
      cursor->closeMarkForDelete(getShare()->getTableName());
326
326
    }
327
327
 
328
 
    identifier::Table identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getTableName());
329
 
    drizzled::error_t ignored;
 
328
    TableIdentifier identifier(getShare()->getSchemaName(), getShare()->getTableName(), getShare()->getTableName());
330
329
    plugin::StorageEngine::dropTable(*in_use,
331
330
                                     *getShare()->getEngine(),
332
 
                                     identifier,
333
 
                                     ignored);
 
331
                                     identifier);
334
332
 
335
333
    delete cursor;
336
334
  }