~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field_iterator.cc

  • Committer: Brian Aker
  • Date: 2008-10-06 06:47:29 UTC
  • Revision ID: brian@tangent.org-20081006064729-2i9mhjkzyvow9xsm
RemoveĀ uint.

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
 
 
20
1
#include <drizzled/server_includes.h>
21
2
#include <drizzled/field_iterator.h>
22
 
#include <drizzled/table_list.h>
23
 
#include <drizzled/session.h>
24
 
#include <drizzled/table.h>
25
3
 
26
4
const char *Field_iterator_table::name()
27
5
{
29
7
}
30
8
 
31
9
 
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);
 
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
49
38
 
50
39
  return item;
51
40
}
79
68
  */
80
69
  if (table_ref->is_join_columns_complete)
81
70
  {
 
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)));
82
77
    field_it= &natural_join_it;
83
78
  }
84
79
  /* This is a base table or stored view. */
137
132
    return natural_join_it.column_ref()->db_name();
138
133
 
139
134
  /*
140
 
    Test that TableList::db is the same as TABLE_SHARE::db to
 
135
    Test that TableList::db is the same as st_table_share::db to
141
136
    ensure consistency. An exception are I_S schema tables, which
142
137
    are inconsistent in this respect.
143
138
  */