Drizzled Public API Documentation

row.h
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, Inc.
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 #pragma once
21 
22 #include <drizzled/item.h>
23 
24 namespace drizzled {
25 
26 class Item_row : public Item
27 {
28  Item **items;
29  table_map used_tables_cache;
30  uint32_t arg_count;
31  bool const_item_cache;
32  bool with_null;
33 public:
34 
35  using Item::split_sum_func;
36 
38  Item_row(Item_row *item):
39  Item(),
40  items(item->items),
41  used_tables_cache(item->used_tables_cache),
42  arg_count(item->arg_count),
43  const_item_cache(item->const_item_cache),
44  with_null(0)
45  {}
46 
47  enum Type type() const { return ROW_ITEM; };
48  void illegal_method_call(const char*);
49  bool is_null() { return null_value; }
50  void make_field(SendField *)
51  {
52  illegal_method_call("make_field");
53  };
54  double val_real()
55  {
56  illegal_method_call("val");
57  return 0;
58  };
59  int64_t val_int()
60  {
61  illegal_method_call("val_int");
62  return 0;
63  };
65  {
66  illegal_method_call("val_str");
67  return 0;
68  };
70  {
71  illegal_method_call("val_decimal");
72  return 0;
73  };
74  bool fix_fields(Session *session, Item **ref);
75  void fix_after_pullout(Select_Lex *new_parent, Item **ref);
76  void cleanup();
77  void split_sum_func(Session *session, Item **ref_pointer_array, List<Item> &fields);
78  table_map used_tables() const { return used_tables_cache; };
79  bool const_item() const { return const_item_cache; };
80  enum Item_result result_type() const { return ROW_RESULT; }
81  void update_used_tables();
82  virtual void print(String *str);
83 
84  bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg);
85  Item *transform(Item_transformer transformer, unsigned char *arg);
86 
87  uint32_t cols() { return arg_count; }
88  Item* element_index(uint32_t i) { return items[i]; }
89  Item** addr(uint32_t i) { return items + i; }
90  bool check_cols(uint32_t c);
91  bool null_inside() { return with_null; };
92  void bring_value();
93 };
94 
95 } /* namespace drizzled */
96 
Item_row(List< Item > &)
Definition: row.cc:37
TODO: Rename this file - func.h is stupid.
int64_t val_int()
Definition: row.h:59
bool null_value
Definition: item.h:122
Item * transform(Item_transformer transformer, unsigned char *arg)
Definition: row.cc:172
virtual void print(String *str)
Definition: row.cc:148
table_map used_tables() const
Definition: row.h:78
void fix_after_pullout(Select_Lex *new_parent, Item **ref)
Definition: row.cc:126
type::Decimal * val_decimal(type::Decimal *)
Definition: row.h:69
double val_real()
Definition: row.h:54
bool is_null()
Definition: row.h:49
bool const_item() const
Definition: row.h:79
String * val_str(String *)
Definition: row.h:64