1
#ifdef USE_PRAGMA_INTERFACE
2
#pragma interface /* gcc class implementation */
6
#ifndef DRIZZLED_FIELD_ITERATOR_H
7
#define DRIZZLED_FIELD_ITERATOR_H
13
Iterator over the fields of a generic table reference.
16
class Field_iterator: public Sql_alloc
19
Field_iterator() {} /* Remove gcc warning */
20
virtual ~Field_iterator() {}
21
virtual void set(TableList *)= 0;
22
virtual void next()= 0;
23
virtual bool end_of_fields()= 0; /* Return 1 at end of list */
24
virtual const char *name()= 0;
25
virtual Item *create_item(THD *)= 0;
26
virtual Field *field()= 0;
31
Iterator over the fields of a base table, view with temporary
35
class Field_iterator_table: public Field_iterator
39
Field_iterator_table() :ptr(0) {}
40
void set(TableList *table);
41
void set_table(Table *table);
42
void next() { ptr++; }
43
bool end_of_fields() { return *ptr == 0; }
45
Item *create_item(THD *thd);
46
Field *field() { return *ptr; }
50
/* Iterator over the fields of a merge view. */
53
Field_iterator interface to the list of materialized fields of a
57
class Field_iterator_natural_join: public Field_iterator
59
List_iterator_fast<Natural_join_column> column_ref_it;
60
Natural_join_column *cur_column_ref;
62
Field_iterator_natural_join() :cur_column_ref(NULL) {}
63
~Field_iterator_natural_join() {}
64
void set(TableList *table);
66
bool end_of_fields() { return !cur_column_ref; }
67
const char *name() { return cur_column_ref->name(); }
68
Item *create_item(THD *thd) { return cur_column_ref->create_item(thd); }
69
Field *field() { return cur_column_ref->field(); }
70
Natural_join_column *column_ref() { return cur_column_ref; }
75
Generic iterator over the fields of an arbitrary table reference.
78
This class unifies the various ways of iterating over the columns
79
of a table reference depending on the type of SQL entity it
80
represents. If such an entity represents a nested table reference,
81
this iterator encapsulates the iteration over the columns of the
82
members of the table reference.
85
The implementation assumes that all underlying NATURAL/USING table
86
references already contain their result columns and are linked into
87
the list TableList::next_name_resolution_table.
90
class Field_iterator_table_ref: public Field_iterator
92
TableList *table_ref, *first_leaf, *last_leaf;
93
Field_iterator_table table_field_it;
94
Field_iterator_natural_join natural_join_it;
95
Field_iterator *field_it;
96
void set_field_iterator();
98
Field_iterator_table_ref() :field_it(NULL) {}
99
void set(TableList *table);
102
{ return (table_ref == last_leaf && field_it->end_of_fields()); }
103
const char *name() { return field_it->name(); }
104
const char *table_name();
105
const char *db_name();
106
Item *create_item(THD *thd) { return field_it->create_item(thd); }
107
Field *field() { return field_it->field(); }
108
Natural_join_column *get_or_create_column_ref(TableList *parent_table_ref);
109
Natural_join_column *get_natural_column_ref();
113
#endif /* DRIZZLED_FIELD_ITERATOR_H */