~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/item/ref.cc

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

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
 
 
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
 
 
29
 
namespace drizzled
30
 
{
 
20
#include <config.h>
 
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>
 
28
#include <drizzled/item/subselect.h>
 
29
#include <drizzled/sql_lex.h>
 
30
 
 
31
namespace drizzled {
31
32
 
32
33
Item_ref::Item_ref(Name_resolution_context *context_arg,
33
34
                   Item **item, const char *table_name_arg,
113
114
{
114
115
  enum_parsing_place place= NO_MATTER;
115
116
  assert(fixed == 0);
116
 
  Select_Lex *current_sel= session->lex->current_select;
 
117
  Select_Lex *current_sel= session->lex().current_select;
117
118
 
118
119
  if (!ref || ref == not_found_item)
119
120
  {
266
267
        Item_field* fld;
267
268
        if (!(fld= new Item_field(from_field)))
268
269
          goto error;
269
 
        session->change_item_tree(reference, fld);
 
270
        *reference= fld;
270
271
        mark_as_dependent(session, last_checked_context->select_lex,
271
 
                          session->lex->current_select, this, fld);
 
272
                          session->lex().current_select, this, fld);
272
273
        /*
273
274
          A reference is resolved to a nest level that's outer or the same as
274
275
          the nest level of the enclosing set function : adjust the value of
275
276
          max_arg_level for the function if it's needed.
276
277
        */
277
 
        if (session->lex->in_sum_func &&
278
 
            session->lex->in_sum_func->nest_level >=
 
278
        if (session->lex().in_sum_func &&
 
279
            session->lex().in_sum_func->nest_level >=
279
280
            last_checked_context->select_lex->nest_level)
280
 
          set_if_bigger(session->lex->in_sum_func->max_arg_level,
 
281
          set_if_bigger(session->lex().in_sum_func->max_arg_level,
281
282
                        last_checked_context->select_lex->nest_level);
282
283
        return false;
283
284
      }
297
298
        the nest level of the enclosing set function : adjust the value of
298
299
        max_arg_level for the function if it's needed.
299
300
      */
300
 
      if (session->lex->in_sum_func &&
301
 
          session->lex->in_sum_func->nest_level >=
 
301
      if (session->lex().in_sum_func &&
 
302
          session->lex().in_sum_func->nest_level >=
302
303
          last_checked_context->select_lex->nest_level)
303
 
        set_if_bigger(session->lex->in_sum_func->max_arg_level,
 
304
        set_if_bigger(session->lex().in_sum_func->max_arg_level,
304
305
                      last_checked_context->select_lex->nest_level);
305
306
    }
306
307
  }
368
369
}
369
370
 
370
371
 
371
 
void Item_ref::print(String *str, enum_query_type query_type)
 
372
void Item_ref::print(String *str)
372
373
{
373
374
  if (ref)
374
375
  {
378
379
      str->append_identifier(name, (uint32_t) strlen(name));
379
380
    }
380
381
    else
381
 
      (*ref)->print(str, query_type);
 
382
      (*ref)->print(str);
382
383
  }
383
384
  else
384
 
    Item_ident::print(str, query_type);
 
385
    Item_ident::print(str);
385
386
}
386
387
 
387
388