~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/ref.cc

edit

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>
 
20
#include "config.h"
21
21
 
22
 
#include <drizzled/session.h>
23
 
#include <drizzled/error.h>
24
 
#include <drizzled/show.h>
25
 
#include <drizzled/item/ref.h>
26
 
#include <drizzled/plugin/client.h>
27
 
#include <drizzled/item/sum.h>
 
22
#include "drizzled/session.h"
 
23
#include "drizzled/error.h"
 
24
#include "drizzled/show.h"
 
25
#include "drizzled/item/ref.h"
 
26
#include "drizzled/plugin/client.h"
 
27
#include "drizzled/item/sum.h"
28
28
 
29
29
namespace drizzled
30
30
{
113
113
{
114
114
  enum_parsing_place place= NO_MATTER;
115
115
  assert(fixed == 0);
116
 
  Select_Lex *current_sel= session->getLex()->current_select;
 
116
  Select_Lex *current_sel= session->lex->current_select;
117
117
 
118
118
  if (!ref || ref == not_found_item)
119
119
  {
132
132
      {
133
133
        /* The current reference cannot be resolved in this query. */
134
134
        my_error(ER_BAD_FIELD_ERROR,MYF(0),
135
 
                 full_name(), session->where());
 
135
                 this->full_name(), current_session->where);
136
136
        goto error;
137
137
      }
138
138
 
268
268
          goto error;
269
269
        session->change_item_tree(reference, fld);
270
270
        mark_as_dependent(session, last_checked_context->select_lex,
271
 
                          session->getLex()->current_select, this, fld);
 
271
                          session->lex->current_select, this, fld);
272
272
        /*
273
273
          A reference is resolved to a nest level that's outer or the same as
274
274
          the nest level of the enclosing set function : adjust the value of
275
275
          max_arg_level for the function if it's needed.
276
276
        */
277
 
        if (session->getLex()->in_sum_func &&
278
 
            session->getLex()->in_sum_func->nest_level >=
 
277
        if (session->lex->in_sum_func &&
 
278
            session->lex->in_sum_func->nest_level >=
279
279
            last_checked_context->select_lex->nest_level)
280
 
          set_if_bigger(session->getLex()->in_sum_func->max_arg_level,
 
280
          set_if_bigger(session->lex->in_sum_func->max_arg_level,
281
281
                        last_checked_context->select_lex->nest_level);
282
282
        return false;
283
283
      }
285
285
      {
286
286
        /* The item was not a table field and not a reference */
287
287
        my_error(ER_BAD_FIELD_ERROR, MYF(0),
288
 
                 full_name(), session->where());
 
288
                 this->full_name(), current_session->where);
289
289
        goto error;
290
290
      }
291
291
      /* Should be checked in resolve_ref_in_select_and_group(). */
297
297
        the nest level of the enclosing set function : adjust the value of
298
298
        max_arg_level for the function if it's needed.
299
299
      */
300
 
      if (session->getLex()->in_sum_func &&
301
 
          session->getLex()->in_sum_func->nest_level >=
 
300
      if (session->lex->in_sum_func &&
 
301
          session->lex->in_sum_func->nest_level >=
302
302
          last_checked_context->select_lex->nest_level)
303
 
        set_if_bigger(session->getLex()->in_sum_func->max_arg_level,
 
303
        set_if_bigger(session->lex->in_sum_func->max_arg_level,
304
304
                      last_checked_context->select_lex->nest_level);
305
305
    }
306
306
  }
457
457
        type::Decimal decimal_value;
458
458
        type::Decimal *val= result_field->val_decimal(&decimal_value);
459
459
        if (val)
460
 
          return not val->isZero();
 
460
          return not val->is_zero();
461
461
        return 0;
462
462
      }
463
463
 
517
517
}
518
518
 
519
519
 
520
 
bool Item_ref::get_date(type::Time &ltime,uint32_t fuzzydate)
 
520
bool Item_ref::get_date(type::Time *ltime,uint32_t fuzzydate)
521
521
{
522
522
  return (null_value=(*ref)->get_date_result(ltime,fuzzydate));
523
523
}