~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/select_dumpvar.h

  • Committer: Monty Taylor
  • Date: 2009-03-05 02:07:55 UTC
  • mfrom: (897.2.2 small-cleanups)
  • mto: This revision was merged to the branch mainline in revision 912.
  • Revision ID: mordred@inaugust.com-20090305020755-uck8bue2ueytgkaj
Merged from Jay.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <drizzled/error.h>
25
25
 
 
26
#include <vector>
26
27
 
27
28
class select_dumpvar :public select_result_interceptor {
28
29
  ha_rows row_count;
29
30
public:
30
 
  List<my_var> var_list;
31
 
  select_dumpvar()  { var_list.empty(); row_count= 0;}
 
31
  std::vector<my_var *> var_list;
 
32
  select_dumpvar()  { var_list.clear(); row_count= 0;}
32
33
  ~select_dumpvar() {}
33
34
 
34
35
  int prepare(List<Item> &list, Select_Lex_Unit *u)
35
36
  {
36
37
    unit= u;
37
38
 
38
 
    if (var_list.elements != list.elements)
 
39
    if (var_list.size() != list.elements)
39
40
    {
40
41
      my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
41
42
                 ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
52
53
 
53
54
  bool send_data(List<Item> &items)
54
55
  {
55
 
    List_iterator_fast<my_var> var_li(var_list);
 
56
    
 
57
    std::vector<my_var *>::const_iterator iter= var_list.begin();
 
58
 
56
59
    List_iterator<Item> it(items);
57
60
    Item *item;
58
 
    my_var *mv;
 
61
    my_var *current_var;
59
62
 
60
63
    if (unit->offset_limit_cnt)
61
64
    {                                           // using limit offset,count
67
70
      my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
68
71
      return(1);
69
72
    }
70
 
    while ((mv= var_li++) && (item= it++))
 
73
    while ((iter != var_list.end()) && (item= it++))
71
74
    {
72
 
      if (mv->local == 0)
 
75
      current_var= *iter;
 
76
      if (current_var->local == 0)
73
77
      {
74
 
        Item_func_set_user_var *suv= new Item_func_set_user_var(mv->s, item);
 
78
        Item_func_set_user_var *suv= new Item_func_set_user_var(current_var->s, item);
75
79
        suv->fix_fields(session, 0);
76
80
        suv->check(0);
77
81
        suv->update();
78
82
      }
 
83
      ++iter;
79
84
    }
80
85
    return(session->is_error());
81
86
  }