Drizzled Public API Documentation

row.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 #pragma once
00021 
00022 #include <drizzled/item.h>
00023 
00024 namespace drizzled {
00025 
00026 class Item_row : public Item
00027 {
00028   Item **items;
00029   table_map used_tables_cache;
00030   uint32_t arg_count;
00031   bool const_item_cache;
00032   bool with_null;
00033 public:
00034 
00035   using Item::split_sum_func;
00036 
00037   Item_row(List<Item> &);
00038   Item_row(Item_row *item):
00039     Item(),
00040     items(item->items),
00041     used_tables_cache(item->used_tables_cache),
00042     arg_count(item->arg_count),
00043     const_item_cache(item->const_item_cache),
00044     with_null(0)
00045   {}
00046 
00047   enum Type type() const { return ROW_ITEM; };
00048   void illegal_method_call(const char*);
00049   bool is_null() { return null_value; }
00050   void make_field(SendField *)
00051   {
00052     illegal_method_call("make_field");
00053   };
00054   double val_real()
00055   {
00056     illegal_method_call("val");
00057     return 0;
00058   };
00059   int64_t val_int()
00060   {
00061     illegal_method_call("val_int");
00062     return 0;
00063   };
00064   String *val_str(String *)
00065   {
00066     illegal_method_call("val_str");
00067     return 0;
00068   };
00069   type::Decimal *val_decimal(type::Decimal *)
00070   {
00071     illegal_method_call("val_decimal");
00072     return 0;
00073   };
00074   bool fix_fields(Session *session, Item **ref);
00075   void fix_after_pullout(Select_Lex *new_parent, Item **ref);
00076   void cleanup();
00077   void split_sum_func(Session *session, Item **ref_pointer_array, List<Item> &fields);
00078   table_map used_tables() const { return used_tables_cache; };
00079   bool const_item() const { return const_item_cache; };
00080   enum Item_result result_type() const { return ROW_RESULT; }
00081   void update_used_tables();
00082   virtual void print(String *str);
00083 
00084   bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg);
00085   Item *transform(Item_transformer transformer, unsigned char *arg);
00086 
00087   uint32_t cols() { return arg_count; }
00088   Item* element_index(uint32_t i) { return items[i]; }
00089   Item** addr(uint32_t i) { return items + i; }
00090   bool check_cols(uint32_t c);
00091   bool null_inside() { return with_null; };
00092   void bring_value();
00093 };
00094 
00095 } /* namespace drizzled */
00096