~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_lex.cc

  • Committer: Mark Atwood
  • Date: 2011-06-22 20:04:22 UTC
  • mfrom: (2318.6.39 rf)
  • Revision ID: me@mark.atwood.name-20110622200422-609npl456o0e5p32
mergeĀ lp:~olafvdspek/drizzle/refactor13

Show diffs side-by-side

added added

removed removed

Lines of Context:
55
55
/**
56
56
  save order by and tables in own lists.
57
57
*/
58
 
static bool add_to_list(Session *session, SQL_LIST &list, Item *item, bool asc)
 
58
static void add_to_list(Session *session, SQL_LIST &list, Item *item, bool asc)
59
59
{
60
 
  Order *order;
61
 
 
62
 
  if (!(order = (Order *) session->getMemRoot()->allocate(sizeof(Order))))
63
 
    return true;
64
 
 
 
60
  Order* order = (Order *) session->mem.alloc(sizeof(Order));
65
61
  order->item_ptr= item;
66
62
  order->item= &order->item_ptr;
67
63
  order->asc = asc;
69
65
  order->used=0;
70
66
  order->counter_used= 0;
71
67
  list.link_in_list((unsigned char*) order, (unsigned char**) &order->next);
72
 
 
73
 
  return false;
74
68
}
75
69
 
76
70
/**
104
98
  ignore_space(1),
105
99
  in_comment(NO_COMMENT)
106
100
{
107
 
  m_cpp_buf= (char*) session->getMemRoot()->allocate(length + 1);
 
101
  m_cpp_buf= (char*) session->mem.alloc(length + 1);
108
102
  m_cpp_ptr= m_cpp_buf;
109
103
}
110
104
 
309
303
  LEX_STRING tmp;
310
304
  lip->yyUnget();                       // ptr points now after last token char
311
305
  tmp.length=lip->yytoklen=length;
312
 
  tmp.str= lip->m_session->strmake(lip->get_tok_start() + skip, tmp.length);
 
306
  tmp.str= lip->m_session->mem.strmake(lip->get_tok_start() + skip, tmp.length);
313
307
 
314
308
  lip->m_cpp_text_start= lip->get_cpp_tok_start() + skip;
315
309
  lip->m_cpp_text_end= lip->m_cpp_text_start + tmp.length;
332
326
  char *to;
333
327
  lip->yyUnget();                       // ptr points now after last token char
334
328
  tmp.length= lip->yytoklen=length;
335
 
  tmp.str=(char*) lip->m_session->getMemRoot()->allocate(tmp.length+1);
 
329
  tmp.str=(char*) lip->m_session->mem.alloc(tmp.length+1);
336
330
  from= lip->get_tok_start() + skip;
337
331
  to= tmp.str;
338
332
  end= to+length;
398
392
        lip->yyUnget();
399
393
 
400
394
      /* Found end. Unescape and return string */
401
 
      const char *str, *end;
402
 
      char *start;
403
 
 
404
 
      str= lip->get_tok_start();
405
 
      end= lip->get_ptr();
 
395
      const char* str= lip->get_tok_start();
 
396
      const char* end= lip->get_ptr();
406
397
      /* Extract the text from the token */
407
398
      str+= pre_skip;
408
399
      end-= post_skip;
409
400
      assert(end >= str);
410
401
 
411
 
      if (!(start= (char*) lip->m_session->getMemRoot()->allocate((uint32_t) (end-str)+1)))
412
 
        return (char*) "";              // memory::SqlAlloc has set error flag
 
402
      char* start= (char*) lip->m_session->mem.alloc((uint32_t) (end-str)+1);
413
403
 
414
404
      lip->m_cpp_text_start= lip->get_cpp_tok_start() + pre_skip;
415
405
      lip->m_cpp_text_end= lip->get_cpp_ptr() - post_skip;
1614
1604
  return (Select_Lex*) master;
1615
1605
}
1616
1606
 
1617
 
bool Select_Lex::add_order_to_list(Session *session, Item *item, bool asc)
 
1607
void Select_Lex::add_order_to_list(Session *session, Item *item, bool asc)
1618
1608
{
1619
 
  return add_to_list(session, order_list, item, asc);
 
1609
  add_to_list(session, order_list, item, asc);
1620
1610
}
1621
1611
 
1622
 
bool Select_Lex::add_item_to_list(Session *, Item *item)
 
1612
void Select_Lex::add_item_to_list(Session *, Item *item)
1623
1613
{
1624
1614
        item_list.push_back(item);
1625
 
  return false;
1626
1615
}
1627
1616
 
1628
 
bool Select_Lex::add_group_to_list(Session *session, Item *item, bool asc)
 
1617
void Select_Lex::add_group_to_list(Session *session, Item *item, bool asc)
1629
1618
{
1630
 
  return add_to_list(session, group_list, item, asc);
 
1619
  add_to_list(session, group_list, item, asc);
1631
1620
}
1632
1621
 
1633
1622
Select_Lex_Unit* Select_Lex::master_unit()
1667
1656
  return &item_list;
1668
1657
}
1669
1658
 
1670
 
 
1671
 
bool Select_Lex::setup_ref_array(Session *session, uint32_t order_group_num)
 
1659
void Select_Lex::setup_ref_array(Session *session, uint32_t order_group_num)
1672
1660
{
1673
 
  if (ref_pointer_array)
1674
 
    return false;
1675
 
 
1676
 
  return (ref_pointer_array=
1677
 
          (Item **)session->getMemRoot()->allocate(sizeof(Item*) * (n_child_sum_items +
1678
 
                                                 item_list.size() +
1679
 
                                                 select_n_having_items +
1680
 
                                                 select_n_where_fields +
1681
 
                                                 order_group_num)*5)) == 0;
 
1661
  if (not ref_pointer_array)
 
1662
    ref_pointer_array= (Item **)session->mem.alloc(sizeof(Item*) * (n_child_sum_items + item_list.size() + select_n_having_items + select_n_where_fields + order_group_num)*5);
1682
1663
}
1683
1664
 
1684
1665
void Select_Lex_Unit::print(String *str)