~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_base.cc

  • Committer: Brian Aker
  • Date: 2008-08-19 00:53:27 UTC
  • mto: This revision was merged to the branch mainline in revision 352.
  • Revision ID: brian@tangent.org-20080819005327-t99svmm5c1e339u3
Removed old base view code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4055
4055
static Field *
4056
4056
find_field_in_natural_join(THD *thd, TableList *table_ref, const char *name,
4057
4057
                           uint length __attribute__((unused)),
4058
 
                           Item **ref, bool register_tree_change,
 
4058
                           Item **ref __attribute__((unused)), bool register_tree_change __attribute__((unused)),
4059
4059
                           TableList **actual_table)
4060
4060
{
4061
4061
  List_iterator_fast<Natural_join_column>
4081
4081
  }
4082
4082
  if (!nj_col)
4083
4083
    return(NULL);
4084
 
 
4085
 
  if (nj_col->view_field)
4086
 
  {
4087
 
    Item *item;
4088
 
    /*
4089
 
      create_item() may, or may not create a new Item, depending on the
4090
 
      column reference. See create_view_field() for details.
4091
 
    */
4092
 
    item= nj_col->create_item(thd);
4093
 
    /*
4094
 
     *ref != NULL means that *ref contains the item that we need to
4095
 
     replace. If the item was aliased by the user, set the alias to
4096
 
     the replacing item.
4097
 
     We need to set alias on both ref itself and on ref real item.
4098
 
     */
4099
 
    if (*ref && !(*ref)->is_autogenerated_name)
4100
 
    {
4101
 
      item->set_name((*ref)->name, (*ref)->name_length,
4102
 
                     system_charset_info);
4103
 
      item->real_item()->set_name((*ref)->name, (*ref)->name_length,
4104
 
                                  system_charset_info);
4105
 
    }
4106
 
 
4107
 
    if (!item)
4108
 
      return(NULL);
4109
 
    assert(nj_col->table_field == NULL);
4110
 
    if (nj_col->table_ref->schema_table_reformed)
4111
 
    {
4112
 
      /*
4113
 
        Translation table items are always Item_fields and fixed
4114
 
        already('mysql_schema_table' function). So we can return
4115
 
        ->field. It is used only for 'show & where' commands.
4116
 
      */
4117
 
      return(((Item_field*) (nj_col->view_field->item))->field);
4118
 
    }
4119
 
    if (register_tree_change)
4120
 
      thd->change_item_tree(ref, item);
4121
 
    else
4122
 
      *ref= item;
4123
 
    found_field= (Field*) view_ref_found;
4124
 
  }
4125
 
  else
4126
4084
  {
4127
4085
    /* This is a base table. */
4128
 
    assert(nj_col->view_field == NULL);
4129
4086
    assert(nj_col->table_ref->table == nj_col->table_field->table);
4130
4087
    found_field= nj_col->table_field;
4131
4088
    update_field_dependencies(thd, found_field, nj_col->table_ref->table);