~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item_row.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:
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
16
#include <drizzled/server_includes.h>
 
17
#include <drizzled/error.h>
17
18
 
18
19
/**
19
20
  Row items used for comparing rows and IN operations on rows:
39
40
  else
40
41
    items= 0;
41
42
  List_iterator<Item> li(arg);
42
 
  uint i= 0;
 
43
  uint32_t i= 0;
43
44
  Item *item;
44
45
  while ((item= li++))
45
46
  {
46
47
    items[i]= item;
47
 
    i++;    
 
48
    i++;
48
49
  }
49
50
}
50
51
 
51
 
void Item_row::illegal_method_call(const char *method __attribute__((unused)))
 
52
void Item_row::illegal_method_call(const char *)
52
53
{
53
54
  assert(0);
54
55
  my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
55
56
  return;
56
57
}
57
58
 
58
 
bool Item_row::fix_fields(THD *thd, Item **ref __attribute__((unused)))
 
59
bool Item_row::fix_fields(Session *session, Item **)
59
60
{
60
61
  assert(fixed == 0);
61
62
  null_value= 0;
63
64
  Item **arg, **arg_end;
64
65
  for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++)
65
66
  {
66
 
    if ((*arg)->fix_fields(thd, arg))
 
67
    if ((*arg)->fix_fields(session, arg))
67
68
      return true;
68
69
    // we can't assign 'item' before, because fix_fields() can change arg
69
70
    Item *item= *arg;
99
100
}
100
101
 
101
102
 
102
 
void Item_row::split_sum_func(THD *thd, Item **ref_pointer_array,
 
103
void Item_row::split_sum_func(Session *session, Item **ref_pointer_array,
103
104
                              List<Item> &fields)
104
105
{
105
106
  Item **arg, **arg_end;
106
107
  for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++)
107
 
    (*arg)->split_sum_func2(thd, ref_pointer_array, fields, arg, true);
 
108
    (*arg)->split_sum_func2(session, ref_pointer_array, fields, arg, true);
108
109
}
109
110
 
110
111
 
112
113
{
113
114
  used_tables_cache= 0;
114
115
  const_item_cache= 1;
115
 
  for (uint i= 0; i < arg_count; i++)
 
116
  for (uint32_t i= 0; i < arg_count; i++)
116
117
  {
117
118
    items[i]->update_used_tables();
118
119
    used_tables_cache|= items[i]->used_tables();
120
121
  }
121
122
}
122
123
 
123
 
void Item_row::fix_after_pullout(st_select_lex *new_parent,
124
 
                                 Item **ref __attribute__((unused)))
 
124
void Item_row::fix_after_pullout(st_select_lex *new_parent, Item **)
125
125
{
126
126
  used_tables_cache= 0;
127
127
  const_item_cache= 1;
128
 
  for (uint i= 0; i < arg_count; i++)
 
128
  for (uint32_t i= 0; i < arg_count; i++)
129
129
  {
130
130
    items[i]->fix_after_pullout(new_parent, &items[i]);
131
131
    used_tables_cache|= items[i]->used_tables();
133
133
  }
134
134
}
135
135
 
136
 
bool Item_row::check_cols(uint c)
 
136
bool Item_row::check_cols(uint32_t c)
137
137
{
138
138
  if (c != arg_count)
139
139
  {
146
146
void Item_row::print(String *str, enum_query_type query_type)
147
147
{
148
148
  str->append('(');
149
 
  for (uint i= 0; i < arg_count; i++)
 
149
  for (uint32_t i= 0; i < arg_count; i++)
150
150
  {
151
151
    if (i)
152
152
      str->append(',');
156
156
}
157
157
 
158
158
 
159
 
bool Item_row::walk(Item_processor processor, bool walk_subquery, uchar *arg)
 
159
bool Item_row::walk(Item_processor processor, bool walk_subquery, unsigned char *arg)
160
160
{
161
 
  for (uint i= 0; i < arg_count; i++)
 
161
  for (uint32_t i= 0; i < arg_count; i++)
162
162
  {
163
163
    if (items[i]->walk(processor, walk_subquery, arg))
164
164
      return 1;
167
167
}
168
168
 
169
169
 
170
 
Item *Item_row::transform(Item_transformer transformer, uchar *arg)
 
170
Item *Item_row::transform(Item_transformer transformer, unsigned char *arg)
171
171
{
172
 
  for (uint i= 0; i < arg_count; i++)
 
172
  for (uint32_t i= 0; i < arg_count; i++)
173
173
  {
174
174
    Item *new_item= items[i]->transform(transformer, arg);
175
175
    if (!new_item)
176
176
      return 0;
177
177
 
178
178
    /*
179
 
      THD::change_item_tree() should be called only if the tree was
 
179
      Session::change_item_tree() should be called only if the tree was
180
180
      really transformed, i.e. when a new item has been created.
181
181
      Otherwise we'll be allocating a lot of unnecessary memory for
182
182
      change records at each execution.
183
183
    */
184
184
    if (items[i] != new_item)
185
 
      current_thd->change_item_tree(&items[i], new_item);
 
185
      current_session->change_item_tree(&items[i], new_item);
186
186
  }
187
187
  return (this->*transformer)(arg);
188
188
}
189
189
 
190
190
void Item_row::bring_value()
191
191
{
192
 
  for (uint i= 0; i < arg_count; i++)
 
192
  for (uint32_t i= 0; i < arg_count; i++)
193
193
    items[i]->bring_value();
194
194
}