~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/parser.cc

  • Committer: Brian Aker
  • Date: 2011-01-26 02:01:07 UTC
  • mto: (2123.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 2117.
  • Revision ID: brian@tangent.org-20110126020107-6iyf2cv3d6beo8cs
Remove duplicate code around ident check.

Show diffs side-by-side

added added

removed removed

Lines of Context:
363
363
  return true;
364
364
}
365
365
 
 
366
Item *buildIdent(Session *session,
 
367
                 const LEX_STRING &schema_name,
 
368
                 const LEX_STRING &table_name,
 
369
                 const LEX_STRING &field_name)
 
370
{
 
371
  Select_Lex *sel= session->getLex()->current_select;
 
372
 
 
373
  if (sel->no_table_names_allowed)
 
374
  {
 
375
    my_error(ER_TABLENAME_NOT_ALLOWED_HERE,
 
376
             MYF(0), table_name.str, session->where);
 
377
  }
 
378
 
 
379
  Item *item= (sel->parsing_place != IN_HAVING or
 
380
               sel->get_in_sum_expr() > 0) ?
 
381
    (Item*) new Item_field(session->getLex()->current_context(), schema_name.str, table_name.str, field_name.str) :
 
382
    (Item*) new Item_ref(session->getLex()->current_context(), schema_name.str, table_name.str, field_name.str);
 
383
 
 
384
  return item;
 
385
}
 
386
 
366
387
} // namespace parser
367
388
} // namespace drizzled