~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_olap.cc

  • Committer: Brian Aker
  • Date: 2008-11-04 15:39:09 UTC
  • mfrom: (575.1.2 devel)
  • Revision ID: brian@tangent.org-20081104153909-c72hn65udxs1ccal
Merge of Monty's work

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
static int make_new_olap_select(LEX *lex, SELECT_LEX *select_lex, List<Item> new_fields)
40
40
{
41
 
  THD   *thd=current_thd;
 
41
  Session       *session=current_session;
42
42
  Item *item, *new_item;
43
43
  Item_null *constant= new Item_null("ALL");
44
44
 
45
 
  SELECT_LEX *new_select = (SELECT_LEX *) thd->memdup((char*) select_lex, sizeof(*select_lex));
 
45
  SELECT_LEX *new_select = (SELECT_LEX *) session->memdup((char*) select_lex, sizeof(*select_lex));
46
46
  if (!new_select)
47
47
    return 1;
48
48
  lex->last_selects->next=new_select;
49
49
  new_select->linkage=OLAP_TYPE;
50
50
  new_select->olap=NON_EXISTING_ONE;
51
51
  new_select->group_list.elements=0;
52
 
  new_select->group_list.first=(uchar *)0;
53
 
  new_select->group_list.next=(uchar **)&new_select->group_list.first;
 
52
  new_select->group_list.first=(unsigned char *)0;
 
53
  new_select->group_list.next=(unsigned char **)&new_select->group_list.first;
54
54
  List<Item> privlist;
55
55
  
56
56
  List_iterator<Item> list_it(select_lex->item_list);
85
85
      if (item->type() == Item::FIELD_ITEM)
86
86
        privlist.push_back(constant);
87
87
      else
88
 
        privlist.push_back((Item*)thd->memdup((char *)item,item->size_of()));
 
88
        privlist.push_back((Item*)session->memdup((char *)item,item->size_of()));
89
89
    }
90
90
  }
91
91
  new_select->item_list=privlist;
147
147
  List<Item>    all_fields(select_lex->item_list);
148
148
 
149
149
 
150
 
  if (setup_tables(lex->thd, &select_lex->context, &select_lex->top_join_list,
 
150
  if (setup_tables(lex->session, &select_lex->context, &select_lex->top_join_list,
151
151
                   (TableList *)select_lex->table_list.first
152
152
                   &select_lex->leaf_tables, false) ||
153
 
      setup_fields(lex->thd, 0, select_lex->item_list, MARK_COLUMNS_READ,
 
153
      setup_fields(lex->session, 0, select_lex->item_list, MARK_COLUMNS_READ,
154
154
                   &all_fields,1) ||
155
 
      setup_fields(lex->thd, 0, item_list_copy, MARK_COLUMNS_READ,
 
155
      setup_fields(lex->session, 0, item_list_copy, MARK_COLUMNS_READ,
156
156
                   &all_fields, 1))
157
157
    return -1;
158
158