~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/table.cc

Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
#include <drizzled/item/float.h>
55
55
#include <drizzled/item/null.h>
56
56
#include <drizzled/temporal.h>
57
 
 
58
57
#include <drizzled/refresh_version.h>
59
 
 
60
58
#include <drizzled/table/singular.h>
61
 
 
62
59
#include <drizzled/table_proto.h>
63
60
#include <drizzled/typelib.h>
 
61
#include <drizzled/sql_lex.h>
64
62
 
65
63
using namespace std;
66
64
 
67
 
namespace drizzled
68
 
{
 
65
namespace drizzled {
69
66
 
70
67
extern plugin::StorageEngine *heap_engine;
71
68
extern plugin::StorageEngine *myisam_engine;
214
211
  TYPELIB *result= (TYPELIB*) mem_root->alloc_root(sizeof(TYPELIB));
215
212
  if (!result)
216
213
    return 0;
217
 
  result->count= strings.elements;
 
214
  result->count= strings.size();
218
215
  result->name= "";
219
216
  uint32_t nbytes= (sizeof(char*) + sizeof(uint32_t)) * (result->count + 1);
220
217
  
640
637
void Table::setVariableWidth(void)
641
638
{
642
639
  assert(in_use);
643
 
  if (in_use && in_use->getLex()->sql_command == SQLCOM_CREATE_TABLE)
 
640
  if (in_use && in_use->lex().sql_command == SQLCOM_CREATE_TABLE)
644
641
  {
645
642
    getMutableShare()->setVariableWidth();
646
643
    return;
932
929
            string_total_length+= new_field->pack_length();
933
930
          }
934
931
          session->mem_root= mem_root_save;
935
 
          session->change_item_tree(argp, new Item_field(new_field));
 
932
          *argp= new Item_field(new_field);
936
933
          session->mem_root= table->getMemRoot();
937
934
          if (!(new_field->flags & NOT_NULL_FLAG))
938
935
          {
1018
1015
  /* If result table is small; use a heap */
1019
1016
  /* future: storage engine selection can be made dynamic? */
1020
1017
  if (blob_count || using_unique_constraint || 
1021
 
      (session->getLex()->select_lex.options & SELECT_BIG_RESULT) ||
1022
 
      (session->getLex()->current_select->olap == ROLLUP_TYPE) ||
 
1018
      (session->lex().select_lex.options & SELECT_BIG_RESULT) ||
 
1019
      (session->lex().current_select->olap == ROLLUP_TYPE) ||
1023
1020
      (select_options & (OPTION_BIG_TABLES | SELECT_SMALL_RESULT)) == OPTION_BIG_TABLES)
1024
1021
  {
1025
1022
    table->getMutableShare()->storage_engine= myisam_engine;
1690
1687
    are fixed in Item_field constructor.
1691
1688
  */
1692
1689
  for (Field **ptr= field; *ptr; ptr++)
1693
 
  {
1694
 
    Item_field *item= new Item_field(*ptr);
1695
 
    if (!item || item_list->push_back(item))
1696
 
      return true;
1697
 
  }
1698
 
  return false;
 
1690
    item_list->push_back(new Item_field(*ptr));
 
1691
  return false; // todo: return void
1699
1692
}
1700
1693
 
1701
1694