~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/field.cc

Updated an include guard thanks to a nice catch during code review from Jay. Thanks Jay!

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
20
 
#include "config.h"
21
 
 
 
20
#include <drizzled/server_includes.h>
 
21
#include CSTDINT_H
22
22
#include <drizzled/session.h>
23
23
#include <drizzled/table.h>
24
24
#include <drizzled/error.h>
25
 
#include <drizzled/join.h>
26
25
#include <drizzled/sql_base.h>
27
26
#include <drizzled/sql_select.h>
28
27
#include <drizzled/item/cmpfunc.h>
30
29
#include <drizzled/item/outer_ref.h>
31
30
#include <drizzled/plugin/client.h>
32
31
 
33
 
namespace drizzled
34
 
{
 
32
using namespace drizzled;
35
33
 
36
34
/**
37
35
  Store the pointer to this item field into a list if not already there.
136
134
  Item_field (this is important in prepared statements).
137
135
*/
138
136
 
139
 
Item_field::Item_field(Session *,
140
 
                       Name_resolution_context *context_arg,
141
 
                       Field *f) :
142
 
  Item_ident(context_arg,
143
 
             f->table->s->getSchemaName(),
144
 
             *f->table_name,
145
 
             f->field_name),
146
 
   item_equal(0),
147
 
   no_const_subst(0),
148
 
   have_privileges(0),
149
 
   any_privileges(0)
 
137
Item_field::Item_field(Session *, Name_resolution_context *context_arg,
 
138
                       Field *f)
 
139
  :Item_ident(context_arg, f->table->s->db.str, *f->table_name, f->field_name),
 
140
   item_equal(0), no_const_subst(0),
 
141
   have_privileges(0), any_privileges(0)
150
142
{
151
143
  set_field(f);
152
144
}
154
146
 
155
147
Item_field::Item_field(Name_resolution_context *context_arg,
156
148
                       const char *db_arg,const char *table_name_arg,
157
 
                       const char *field_name_arg) :
158
 
  Item_ident(context_arg, db_arg,table_name_arg,field_name_arg),
159
 
   field(0),
160
 
   result_field(0),
161
 
   item_equal(0),
162
 
   no_const_subst(0),
163
 
   have_privileges(0),
164
 
   any_privileges(0)
 
149
                       const char *field_name_arg)
 
150
  :Item_ident(context_arg, db_arg,table_name_arg,field_name_arg),
 
151
   field(0), result_field(0), item_equal(0), no_const_subst(0),
 
152
   have_privileges(0), any_privileges(0)
165
153
{
166
154
  Select_Lex *select= current_session->lex->current_select;
167
155
  collation.set(DERIVATION_IMPLICIT);
168
 
 
169
156
  if (select && select->parsing_place != IN_HAVING)
170
157
      select->select_n_where_fields++;
171
158
}
174
161
  Constructor need to process subselect with temporary tables (see Item)
175
162
*/
176
163
 
177
 
Item_field::Item_field(Session *session, Item_field *item) :
178
 
  Item_ident(session, item),
179
 
  field(item->field),
180
 
  result_field(item->result_field),
181
 
  item_equal(item->item_equal),
182
 
  no_const_subst(item->no_const_subst),
183
 
  have_privileges(item->have_privileges),
184
 
  any_privileges(item->any_privileges)
 
164
Item_field::Item_field(Session *session, Item_field *item)
 
165
  :Item_ident(session, item),
 
166
   field(item->field),
 
167
   result_field(item->result_field),
 
168
   item_equal(item->item_equal),
 
169
   no_const_subst(item->no_const_subst),
 
170
   have_privileges(item->have_privileges),
 
171
   any_privileges(item->any_privileges)
185
172
{
186
173
  collation.set(DERIVATION_IMPLICIT);
187
174
}
194
181
  max_length= field_par->max_display_length();
195
182
  table_name= *field_par->table_name;
196
183
  field_name= field_par->field_name;
197
 
  db_name= field_par->table->s->getSchemaName();
 
184
  db_name= field_par->table->s->db.str;
198
185
  alias_name_used= field_par->table->alias_name_used;
199
186
  unsigned_flag=test(field_par->flags & UNSIGNED_FLAG);
200
187
  collation.set(field_par->charset(), field_par->derivation());
201
188
  fixed= 1;
 
189
  if (field->table->s->tmp_table == SYSTEM_TMP_TABLE)
 
190
    any_privileges= 0;
202
191
}
203
192
 
204
193
 
365
354
           (!my_strcasecmp(table_alias_charset, item_field->table_name,
366
355
                           table_name) &&
367
356
            (!item_field->db_name || !db_name ||
368
 
             (item_field->db_name && !strcasecmp(item_field->db_name,
 
357
             (item_field->db_name && !strcmp(item_field->db_name,
369
358
                                             db_name))))));
370
359
}
371
360
 
1267
1256
  }
1268
1257
  Item_ident::print(str, query_type);
1269
1258
}
1270
 
 
1271
 
 
1272
 
} /* namespace drizzled */