~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/parser.cc

  • Committer: Olaf van der Spek
  • Date: 2011-10-22 13:10:53 UTC
  • mto: This revision was merged to the branch mainline in revision 2447.
  • Revision ID: olafvdspek@gmail.com-20111022131053-b5ihev4dymuovcj2
Refactor

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
    expression the <subquery> is.
68
68
  */
69
69
 
70
 
  Item *result;
71
 
 
72
70
  if (expr->type() == Item::SUBSELECT_ITEM)
73
71
  {
74
72
    Item_subselect *expr2 = (Item_subselect*) expr;
76
74
    if (expr2->substype() == Item_subselect::SINGLEROW_SUBS)
77
75
    {
78
76
      Item_singlerow_subselect *expr3 = (Item_singlerow_subselect*) expr2;
79
 
      Select_Lex *subselect;
80
77
 
81
78
      /*
82
79
        Implement the mandated change, by altering the semantic tree:
86
83
        which is represented as
87
84
          Item_in_subselect(left, subselect)
88
85
      */
89
 
      subselect= expr3->invalidate_and_restore_select_lex();
90
 
      result= new (session->mem_root) Item_in_subselect(left, subselect);
91
 
 
92
 
      if (! equal)
93
 
        result = negate_expression(session, result);
94
 
 
95
 
      return(result);
 
86
      Select_Lex* subselect= expr3->invalidate_and_restore_select_lex();
 
87
      Item* result= new (session->mem_root) Item_in_subselect(left, subselect);
 
88
      return equal ? result : negate_expression(session, result);
96
89
    }
97
90
  }
98
 
 
99
 
  if (equal)
100
 
    result= new (session->mem_root) Item_func_eq(left, expr);
101
 
  else
102
 
    result= new (session->mem_root) Item_func_ne(left, expr);
103
 
 
104
 
  return(result);
 
91
  return equal
 
92
    ? (Item*) new (session->mem_root) Item_func_eq(left, expr)
 
93
    : (Item*) new (session->mem_root) Item_func_ne(left, expr);
105
94
}
106
95
 
107
96
/**