~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/field_iterator.h

  • Committer: Lee
  • Date: 2008-10-07 17:11:23 UTC
  • mto: (489.1.1 codestyle)
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: lbieber@lbieber-desktop-20081007171123-s6ex14jq8jfuql8e
breakĀ outĀ Field_longstr

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
3
 *
4
 
 *  Copyright (C) 2008 Sun Microsystems, Inc.
 
4
 *  Copyright (C) 2008 Sun Microsystems
5
5
 *
6
6
 *  This program is free software; you can redistribute it and/or modify
7
7
 *  it under the terms of the GNU General Public License as published by
17
17
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18
18
 */
19
19
 
 
20
#ifdef USE_PRAGMA_INTERFACE
 
21
#pragma interface                       /* gcc class implementation */
 
22
#endif
 
23
 
20
24
 
21
25
#ifndef DRIZZLED_FIELD_ITERATOR_H
22
26
#define DRIZZLED_FIELD_ITERATOR_H
23
27
 
24
 
#include <drizzled/memory/sql_alloc.h>
25
 
#include <drizzled/sql_list.h>
26
 
#include <drizzled/natural_join_column.h>
27
 
 
28
 
namespace drizzled
29
 
{
30
 
 
31
28
class Table;
32
29
class TableList;
33
30
 
35
32
  Iterator over the fields of a generic table reference.
36
33
*/
37
34
 
38
 
class Field_iterator: public memory::SqlAlloc
 
35
class Field_iterator: public Sql_alloc
39
36
{
40
37
public:
41
38
  Field_iterator() {}                         /* Remove gcc warning */
44
41
  virtual void next()= 0;
45
42
  virtual bool end_of_fields()= 0;              /* Return 1 at end of list */
46
43
  virtual const char *name()= 0;
47
 
  virtual Item *create_item(Session *)= 0;
 
44
  virtual Item *create_item(THD *)= 0;
48
45
  virtual Field *field()= 0;
49
46
};
50
47
 
51
48
 
52
 
/*
 
49
/* 
53
50
  Iterator over the fields of a base table, view with temporary
54
51
  table, or subquery.
55
52
*/
64
61
  void next() { ptr++; }
65
62
  bool end_of_fields() { return *ptr == 0; }
66
63
  const char *name();
67
 
  Item *create_item(Session *session);
 
64
  Item *create_item(THD *thd);
68
65
  Field *field() { return *ptr; }
69
66
};
70
67
 
78
75
 
79
76
class Field_iterator_natural_join: public Field_iterator
80
77
{
81
 
  List<Natural_join_column>::iterator column_ref_it;
 
78
  List_iterator_fast<Natural_join_column> column_ref_it;
82
79
  Natural_join_column *cur_column_ref;
83
80
public:
84
81
  Field_iterator_natural_join() :cur_column_ref(NULL) {}
87
84
  void next();
88
85
  bool end_of_fields() { return !cur_column_ref; }
89
86
  const char *name() { return cur_column_ref->name(); }
90
 
  Item *create_item(Session *session) { return cur_column_ref->create_item(session); }
 
87
  Item *create_item(THD *thd) { return cur_column_ref->create_item(thd); }
91
88
  Field *field() { return cur_column_ref->field(); }
92
89
  Natural_join_column *column_ref() { return cur_column_ref; }
93
90
};
125
122
  const char *name() { return field_it->name(); }
126
123
  const char *table_name();
127
124
  const char *db_name();
128
 
  Item *create_item(Session *session) { return field_it->create_item(session); }
 
125
  Item *create_item(THD *thd) { return field_it->create_item(thd); }
129
126
  Field *field() { return field_it->field(); }
130
127
  Natural_join_column *get_or_create_column_ref(TableList *parent_table_ref);
131
128
  Natural_join_column *get_natural_column_ref();
132
129
};
133
130
 
134
 
} /* namespace drizzled */
135
131
 
136
132
#endif /* DRIZZLED_FIELD_ITERATOR_H */