~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field_iterator.cc

Merged in latest plugin-slot-reorg.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
 
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
 
3
 *
 
4
 *  Copyright (C) 2008 Sun Microsystems
 
5
 *
 
6
 *  This program is free software; you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation; version 2 of the License.
 
9
 *
 
10
 *  This program is distributed in the hope that it will be useful,
 
11
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 *  GNU General Public License for more details.
 
14
 *
 
15
 *  You should have received a copy of the GNU General Public License
 
16
 *  along with this program; if not, write to the Free Software
 
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
18
 */
 
19
 
1
20
#include <drizzled/server_includes.h>
2
21
#include <drizzled/field_iterator.h>
 
22
#include <drizzled/table_list.h>
 
23
#include <drizzled/session.h>
 
24
#include <drizzled/table.h>
3
25
 
4
26
const char *Field_iterator_table::name()
5
27
{
7
29
}
8
30
 
9
31
 
10
 
 
11
 
void Field_iterator_table::set(TableList *table) 
12
 
13
 
  ptr= table->table->field; 
14
 
}
15
 
 
16
 
 
17
 
void Field_iterator_table::set_table(Table *table) 
18
 
19
 
  ptr= table->field; 
20
 
}
21
 
 
22
 
 
23
 
Item *Field_iterator_table::create_item(THD *thd)
24
 
{
25
 
  SELECT_LEX *select= thd->lex->current_select;
26
 
 
27
 
  Item_field *item= new Item_field(thd, &select->context, *ptr);
28
 
 
29
 
#ifdef DEAD_CODE
30
 
 
31
 
  if (item && thd->variables.sql_mode & MODE_ONLY_FULL_GROUP_BY &&
32
 
      !thd->lex->in_sum_func && select->cur_pos_in_select_list != UNDEF_POS)
33
 
  {
34
 
    select->non_agg_fields.push_back(item);
35
 
    item->marker= select->cur_pos_in_select_list;
36
 
  }
37
 
#endif
 
32
void Field_iterator_table::set(TableList *table)
 
33
{
 
34
  ptr= table->table->field;
 
35
}
 
36
 
 
37
 
 
38
void Field_iterator_table::set_table(Table *table)
 
39
{
 
40
  ptr= table->field;
 
41
}
 
42
 
 
43
 
 
44
Item *Field_iterator_table::create_item(Session *session)
 
45
{
 
46
  Select_Lex *select= session->lex->current_select;
 
47
 
 
48
  Item_field *item= new Item_field(session, &select->context, *ptr);
38
49
 
39
50
  return item;
40
51
}
68
79
  */
69
80
  if (table_ref->is_join_columns_complete)
70
81
  {
71
 
    /* Necesary, but insufficient conditions. */
72
 
    assert(table_ref->is_natural_join ||
73
 
                table_ref->nested_join ||
74
 
                ((table_ref->join_columns && /* This is a merge view. */ (table_ref->field_translation && table_ref->join_columns->elements == (ulong)(table_ref->field_translation_end - table_ref->field_translation))) ||
75
 
                 /* This is stored table or a tmptable view. */
76
 
                 (!table_ref->field_translation && table_ref->join_columns->elements == table_ref->table->s->fields)));
77
82
    field_it= &natural_join_it;
78
83
  }
79
84
  /* This is a base table or stored view. */
132
137
    return natural_join_it.column_ref()->db_name();
133
138
 
134
139
  /*
135
 
    Test that TableList::db is the same as st_table_share::db to
 
140
    Test that TableList::db is the same as TableShare::db to
136
141
    ensure consistency. An exception are I_S schema tables, which
137
142
    are inconsistent in this respect.
138
143
  */