~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/field_iterator.h

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2012-06-19 10:46:49 UTC
  • mfrom: (1.1.6)
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20120619104649-e2l0ggd4oz3um0f4
Tags: upstream-7.1.36-stable
ImportĀ upstreamĀ versionĀ 7.1.36-stable

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
namespace drizzled {
29
29
 
30
 
class Table;
31
 
class TableList;
32
 
 
33
30
/*
34
31
  Iterator over the fields of a generic table reference.
35
32
*/
36
33
 
37
 
class Field_iterator: public memory::SqlAlloc
 
34
class Field_iterator : public memory::SqlAlloc
38
35
{
39
36
public:
40
 
  Field_iterator() {}                         /* Remove gcc warning */
41
37
  virtual ~Field_iterator() {}
42
38
  virtual void set(TableList *)= 0;
43
39
  virtual void next()= 0;
44
 
  virtual bool end_of_fields()= 0;              /* Return 1 at end of list */
45
 
  virtual const char *name()= 0;
 
40
  virtual bool end_of_fields() const= 0;              /* Return true at end of list */
 
41
  virtual const char *name() const= 0;
46
42
  virtual Item *create_item(Session *)= 0;
47
43
  virtual Field *field()= 0;
48
44
};
53
49
  table, or subquery.
54
50
*/
55
51
 
56
 
class Field_iterator_table: public Field_iterator
 
52
class Field_iterator_table : public Field_iterator
57
53
{
58
54
  Field **ptr;
59
55
public:
61
57
  void set(TableList *table);
62
58
  void set_table(Table *table);
63
59
  void next() { ptr++; }
64
 
  bool end_of_fields() { return *ptr == 0; }
65
 
  const char *name();
 
60
  bool end_of_fields() const { return *ptr == 0; }
 
61
  const char *name() const;
66
62
  Item *create_item(Session *session);
67
63
  Field *field() { return *ptr; }
68
64
};
80
76
  List<Natural_join_column>::iterator column_ref_it;
81
77
  Natural_join_column *cur_column_ref;
82
78
public:
83
 
  Field_iterator_natural_join() :cur_column_ref(NULL) {}
84
 
  ~Field_iterator_natural_join() {}
 
79
  Field_iterator_natural_join() : cur_column_ref(NULL) {}
85
80
  void set(TableList *table);
86
81
  void next();
87
 
  bool end_of_fields() { return !cur_column_ref; }
88
 
  const char *name() { return cur_column_ref->name(); }
 
82
  bool end_of_fields() const { return not cur_column_ref; }
 
83
  const char *name() const { return cur_column_ref->name(); }
89
84
  Item *create_item(Session *session) { return cur_column_ref->create_item(session); }
90
85
  Field *field() { return cur_column_ref->field(); }
91
86
  Natural_join_column *column_ref() { return cur_column_ref; }
119
114
  Field_iterator_table_ref() :field_it(NULL) {}
120
115
  void set(TableList *table);
121
116
  void next();
122
 
  bool end_of_fields()
 
117
  bool end_of_fields() const
123
118
  { return (table_ref == last_leaf && field_it->end_of_fields()); }
124
 
  const char *name() { return field_it->name(); }
 
119
  const char *name() const { return field_it->name(); }
125
120
  const char *table_name();
126
121
  const char *db_name();
127
122
  Item *create_item(Session *session) { return field_it->create_item(session); }