~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/select_dumpvar.cc

  • Committer: Mark Atwood
  • Date: 2011-11-11 18:23:18 UTC
  • mfrom: (2456.1.5 rf)
  • Revision ID: me@mark.atwood.name-20111111182318-skgcp9ce65fd2goa
mergeĀ lp:~olafvdspek/drizzle/refactor11

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
 
29
29
bool select_dumpvar::send_data(List<Item> &items)
30
30
{
31
 
  std::vector<var *>::const_iterator iter= var_list.begin();
32
 
 
33
 
  List<Item>::iterator it(items.begin());
34
 
  Item *item= NULL;
35
 
  var *current_var;
36
 
 
37
31
  if (unit->offset_limit_cnt)
38
32
  {                                             // using limit offset,count
39
33
    unit->offset_limit_cnt--;
44
38
    my_message(ER_TOO_MANY_ROWS, ER(ER_TOO_MANY_ROWS), MYF(0));
45
39
    return 1;
46
40
  }
47
 
  while ((iter != var_list.end()) && (item= it++))
 
41
  List<Item>::iterator it(items.begin());
 
42
  BOOST_FOREACH(var* current_var, var_list)
48
43
  {
49
 
    current_var= *iter;
50
 
    if (current_var->local == 0)
51
 
    {
52
 
      Item_func_set_user_var *suv= new Item_func_set_user_var(current_var->s, item);
53
 
      suv->fix_fields(session, 0);
54
 
      suv->check(0);
55
 
      suv->update();
56
 
    }
57
 
    ++iter;
 
44
    Item* item= it++;
 
45
    if (not item)
 
46
      break;
 
47
    if (current_var->local)
 
48
      continue;
 
49
    Item_func_set_user_var *suv= new Item_func_set_user_var(current_var->s, item);
 
50
    suv->fix_fields(session, 0);
 
51
    suv->check(0);
 
52
    suv->update();
58
53
  }
59
 
  return(session->is_error());
 
54
  return session->is_error();
60
55
}
61
56
 
62
57
bool select_dumpvar::send_eof()
63
58
{
64
 
  if (! row_count)
65
 
    push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,
66
 
                 ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA));
 
59
  if (not row_count)
 
60
    push_warning(session, DRIZZLE_ERROR::WARN_LEVEL_WARN, ER_SP_FETCH_NO_DATA, ER(ER_SP_FETCH_NO_DATA));
67
61
  /*
68
62
    In order to remember the value of affected rows for ROW_COUNT()
69
63
    function, SELECT INTO has to have an own SQLCOM.
76
70
int select_dumpvar::prepare(List<Item> &list, Select_Lex_Unit *u)
77
71
{
78
72
  unit= u;
79
 
 
80
 
  if (var_list.size() != list.size())
81
 
  {
82
 
    my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT,
83
 
               ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
84
 
    return 1;
85
 
  }
86
 
  return 0;
 
73
  if (var_list.size() == list.size())
 
74
    return 0;
 
75
  my_message(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT, ER(ER_WRONG_NUMBER_OF_COLUMNS_IN_SELECT), MYF(0));
 
76
  return 1;
87
77
}
88
78
 
89
79
} // namespace drizzled