~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to sql/item_row.cc

  • Committer: Monty Taylor
  • Date: 2008-07-05 18:10:38 UTC
  • mto: This revision was merged to the branch mainline in revision 63.
  • Revision ID: monty@inaugust.com-20080705181038-0ih0nnamu5qrut0y
Fixed prototypes. Cleaned define a little bit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
   along with this program; if not, write to the Free Software
14
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
15
 
16
 
#include <drizzled/server_includes.h>
 
16
#include "mysql_priv.h"
17
17
 
18
18
/**
19
19
  Row items used for comparing rows and IN operations on rows:
39
39
  else
40
40
    items= 0;
41
41
  List_iterator<Item> li(arg);
42
 
  uint32_t i= 0;
 
42
  uint i= 0;
43
43
  Item *item;
44
44
  while ((item= li++))
45
45
  {
48
48
  }
49
49
}
50
50
 
51
 
void Item_row::illegal_method_call(const char *method __attribute__((unused)))
 
51
void Item_row::illegal_method_call(const char *method)
52
52
{
53
 
  assert(0);
 
53
  DBUG_ENTER("Item_row::illegal_method_call");
 
54
  DBUG_PRINT("error", ("!!! %s method was called for row item", method));
 
55
  DBUG_ASSERT(0);
54
56
  my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
55
 
  return;
 
57
  DBUG_VOID_RETURN;
56
58
}
57
59
 
58
 
bool Item_row::fix_fields(THD *thd, Item **ref __attribute__((unused)))
 
60
bool Item_row::fix_fields(THD *thd, Item **ref)
59
61
{
60
 
  assert(fixed == 0);
 
62
  DBUG_ASSERT(fixed == 0);
61
63
  null_value= 0;
62
64
  maybe_null= 0;
63
65
  Item **arg, **arg_end;
64
66
  for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++)
65
67
  {
66
68
    if ((*arg)->fix_fields(thd, arg))
67
 
      return true;
 
69
      return TRUE;
68
70
    // we can't assign 'item' before, because fix_fields() can change arg
69
71
    Item *item= *arg;
70
72
    used_tables_cache |= item->used_tables();
83
85
    with_sum_func= with_sum_func || item->with_sum_func;
84
86
  }
85
87
  fixed= 1;
86
 
  return false;
 
88
  return FALSE;
87
89
}
88
90
 
89
91
 
90
92
void Item_row::cleanup()
91
93
{
 
94
  DBUG_ENTER("Item_row::cleanup");
 
95
 
92
96
  Item::cleanup();
93
97
  /* Reset to the original values */
94
98
  used_tables_cache= 0;
95
99
  const_item_cache= 1;
96
100
  with_null= 0;
97
101
 
98
 
  return;
 
102
  DBUG_VOID_RETURN;
99
103
}
100
104
 
101
105
 
104
108
{
105
109
  Item **arg, **arg_end;
106
110
  for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++)
107
 
    (*arg)->split_sum_func2(thd, ref_pointer_array, fields, arg, true);
 
111
    (*arg)->split_sum_func2(thd, ref_pointer_array, fields, arg, TRUE);
108
112
}
109
113
 
110
114
 
112
116
{
113
117
  used_tables_cache= 0;
114
118
  const_item_cache= 1;
115
 
  for (uint32_t i= 0; i < arg_count; i++)
 
119
  for (uint i= 0; i < arg_count; i++)
116
120
  {
117
121
    items[i]->update_used_tables();
118
122
    used_tables_cache|= items[i]->used_tables();
120
124
  }
121
125
}
122
126
 
123
 
void Item_row::fix_after_pullout(st_select_lex *new_parent,
124
 
                                 Item **ref __attribute__((unused)))
 
127
void Item_row::fix_after_pullout(st_select_lex *new_parent, Item **ref)
125
128
{
126
129
  used_tables_cache= 0;
127
130
  const_item_cache= 1;
128
 
  for (uint32_t i= 0; i < arg_count; i++)
 
131
  for (uint i= 0; i < arg_count; i++)
129
132
  {
130
133
    items[i]->fix_after_pullout(new_parent, &items[i]);
131
134
    used_tables_cache|= items[i]->used_tables();
133
136
  }
134
137
}
135
138
 
136
 
bool Item_row::check_cols(uint32_t c)
 
139
bool Item_row::check_cols(uint c)
137
140
{
138
141
  if (c != arg_count)
139
142
  {
146
149
void Item_row::print(String *str, enum_query_type query_type)
147
150
{
148
151
  str->append('(');
149
 
  for (uint32_t i= 0; i < arg_count; i++)
 
152
  for (uint i= 0; i < arg_count; i++)
150
153
  {
151
154
    if (i)
152
155
      str->append(',');
156
159
}
157
160
 
158
161
 
159
 
bool Item_row::walk(Item_processor processor, bool walk_subquery, unsigned char *arg)
 
162
bool Item_row::walk(Item_processor processor, bool walk_subquery, uchar *arg)
160
163
{
161
 
  for (uint32_t i= 0; i < arg_count; i++)
 
164
  for (uint i= 0; i < arg_count; i++)
162
165
  {
163
166
    if (items[i]->walk(processor, walk_subquery, arg))
164
167
      return 1;
167
170
}
168
171
 
169
172
 
170
 
Item *Item_row::transform(Item_transformer transformer, unsigned char *arg)
 
173
Item *Item_row::transform(Item_transformer transformer, uchar *arg)
171
174
{
172
 
  for (uint32_t i= 0; i < arg_count; i++)
 
175
  for (uint i= 0; i < arg_count; i++)
173
176
  {
174
177
    Item *new_item= items[i]->transform(transformer, arg);
175
178
    if (!new_item)
189
192
 
190
193
void Item_row::bring_value()
191
194
{
192
 
  for (uint32_t i= 0; i < arg_count; i++)
 
195
  for (uint i= 0; i < arg_count; i++)
193
196
    items[i]->bring_value();
194
197
}