~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Lee Bieber
  • Date: 2011-01-28 02:32:26 UTC
  • mfrom: (2114.4.10 alter-table)
  • mto: This revision was merged to the branch mainline in revision 2124.
  • Revision ID: kalebral@gmail.com-20110128023226-11i88kemmdygtz0d
Merge Brian - more parser rework

Show diffs side-by-side

added added

removed removed

Lines of Context:
1943
1943
    {
1944
1944
      if (nj_col)
1945
1945
      {
1946
 
        my_error(ER_NON_UNIQ_ERROR, MYF(0), name, session->where);
 
1946
        my_error(ER_NON_UNIQ_ERROR, MYF(0), name, session->where());
1947
1947
        return NULL;
1948
1948
      }
1949
1949
      nj_col= curr_nj_col;
2340
2340
      */
2341
2341
      item->cached_table= found ?  0 : actual_table;
2342
2342
 
2343
 
      assert(session->where);
 
2343
      assert(session->where());
2344
2344
      /*
2345
2345
        If we found a fully qualified field we return it directly as it can't
2346
2346
        have duplicates.
2353
2353
        if (report_error == REPORT_ALL_ERRORS ||
2354
2354
            report_error == IGNORE_EXCEPT_NON_UNIQUE)
2355
2355
          my_error(ER_NON_UNIQ_ERROR, MYF(0),
2356
 
                   table_name ? item->full_name() : name, session->where);
 
2356
                   table_name ? item->full_name() : name, session->where());
2357
2357
        return (Field*) 0;
2358
2358
      }
2359
2359
      found= cur_field;
2386
2386
      strcat(buff, table_name);
2387
2387
      table_name=buff;
2388
2388
    }
2389
 
    my_error(ER_UNKNOWN_TABLE, MYF(0), table_name, session->where);
 
2389
    my_error(ER_UNKNOWN_TABLE, MYF(0), table_name, session->where());
2390
2390
  }
2391
2391
  else
2392
2392
  {
2393
2393
    if (report_error == REPORT_ALL_ERRORS ||
2394
2394
        report_error == REPORT_EXCEPT_NON_UNIQUE)
2395
 
      my_error(ER_BAD_FIELD_ERROR, MYF(0), item->full_name(), session->where);
 
2395
      my_error(ER_BAD_FIELD_ERROR, MYF(0), item->full_name(), session->where());
2396
2396
    else
2397
2397
      found= not_found_field;
2398
2398
  }
2519
2519
            */
2520
2520
            if (report_error != IGNORE_ERRORS)
2521
2521
              my_error(ER_NON_UNIQ_ERROR, MYF(0),
2522
 
                       find->full_name(), session->where);
 
2522
                       find->full_name(), session->where());
2523
2523
            return (Item**) 0;
2524
2524
          }
2525
2525
          found_unaliased= li.ref();
2550
2550
              continue;                           // Same field twice
2551
2551
            if (report_error != IGNORE_ERRORS)
2552
2552
              my_error(ER_NON_UNIQ_ERROR, MYF(0),
2553
 
                       find->full_name(), session->where);
 
2553
                       find->full_name(), session->where());
2554
2554
            return (Item**) 0;
2555
2555
          }
2556
2556
          found= li.ref();
2602
2602
    {
2603
2603
      if (report_error != IGNORE_ERRORS)
2604
2604
        my_error(ER_NON_UNIQ_ERROR, MYF(0),
2605
 
                 find->full_name(), session->where);
 
2605
                 find->full_name(), session->where());
2606
2606
      return (Item **) 0;
2607
2607
    }
2608
2608
    if (found_unaliased)
2618
2618
  {
2619
2619
    if (report_error == REPORT_ALL_ERRORS)
2620
2620
      my_error(ER_BAD_FIELD_ERROR, MYF(0),
2621
 
               find->full_name(), session->where);
 
2621
               find->full_name(), session->where());
2622
2622
    return (Item **) 0;
2623
2623
  }
2624
2624
  else
2789
2789
        if (cur_nj_col_2->is_common ||
2790
2790
            (found && (!using_fields || is_using_column_1)))
2791
2791
        {
2792
 
          my_error(ER_NON_UNIQ_ERROR, MYF(0), field_name_1, session->where);
 
2792
          my_error(ER_NON_UNIQ_ERROR, MYF(0), field_name_1, session->where());
2793
2793
          return(result);
2794
2794
        }
2795
2795
        nj_col_2= cur_nj_col_2;
2994
2994
        if (!(common_field= it++))
2995
2995
        {
2996
2996
          my_error(ER_BAD_FIELD_ERROR, MYF(0), using_field_name_ptr,
2997
 
                   session->where);
 
2997
                   session->where());
2998
2998
          return(result);
2999
2999
        }
3000
3000
        if (!my_strcasecmp(system_charset_info,
3217
3217
                                         List<TableList> *from_clause,
3218
3218
                                         Name_resolution_context *context)
3219
3219
{
3220
 
  session->where= "from clause";
 
3220
  session->setWhere("from clause");
3221
3221
  if (from_clause->elements == 0)
3222
3222
    return false; /* We come here in the case of UNIONs. */
3223
3223
 
3338
3338
  session->mark_used_columns= mark_used_columns;
3339
3339
  if (allow_sum_func)
3340
3340
    session->lex->allow_sum_func|= 1 << session->lex->current_select->nest_level;
3341
 
  session->where= Session::DEFAULT_WHERE;
 
3341
  session->setWhere(Session::DEFAULT_WHERE);
3342
3342
  save_is_item_list_lookup= session->lex->current_select->is_item_list_lookup;
3343
3343
  session->lex->current_select->is_item_list_lookup= 0;
3344
3344
 
3350
3350
    There is other way to solve problem: fill array with pointers to list,
3351
3351
    but it will be slower.
3352
3352
 
3353
 
TODO: remove it when (if) we made one list for allfields and
3354
 
ref_pointer_array
 
3353
    TODO-> remove it when (if) we made one list for allfields and ref_pointer_array
3355
3354
  */
3356
3355
  if (ref_pointer_array)
 
3356
  {
3357
3357
    memset(ref_pointer_array, 0, sizeof(Item *) * fields.elements);
 
3358
  }
3358
3359
 
3359
3360
  Item **ref= ref_pointer_array;
3360
3361
  session->lex->current_select->cur_pos_in_select_list= 0;
3729
3730
  session->session_marker= (void*)1;
3730
3731
  if (*conds)
3731
3732
  {
3732
 
    session->where="where clause";
 
3733
    session->setWhere("where clause");
3733
3734
    if ((!(*conds)->fixed && (*conds)->fix_fields(session, conds)) ||
3734
3735
        (*conds)->check_cols(1))
3735
3736
      goto err_no_arena;
3751
3752
      {
3752
3753
        /* Make a join an a expression */
3753
3754
        session->session_marker= (void*)embedded;
3754
 
        session->where="on clause";
 
3755
        session->setWhere("on clause");
3755
3756
        if ((!embedded->on_expr->fixed && embedded->on_expr->fix_fields(session, &embedded->on_expr)) ||
3756
3757
            embedded->on_expr->check_cols(1))
3757
3758
          goto err_no_arena;