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 
00027 class Item_row: public Item
00028 {
00029   Item **items;
00030   table_map used_tables_cache;
00031   uint32_t arg_count;
00032   bool const_item_cache;
00033   bool with_null;
00034 public:
00035 
00036   using Item::split_sum_func;
00037 
00038   Item_row(List<Item> &);
00039   Item_row(Item_row *item):
00040     Item(),
00041     items(item->items),
00042     used_tables_cache(item->used_tables_cache),
00043     arg_count(item->arg_count),
00044     const_item_cache(item->const_item_cache),
00045     with_null(0)
00046   {}
00047 
00048   enum Type type() const { return ROW_ITEM; };
00049   void illegal_method_call(const char *);
00050   bool is_null() { return null_value; }
00051   void make_field(SendField *)
00052   {
00053     illegal_method_call((const char*)"make_field");
00054   };
00055   double val_real()
00056   {
00057     illegal_method_call((const char*)"val");
00058     return 0;
00059   };
00060   int64_t val_int()
00061   {
00062     illegal_method_call((const char*)"val_int");
00063     return 0;
00064   };
00065   String *val_str(String *)
00066   {
00067     illegal_method_call((const char*)"val_str");
00068     return 0;
00069   };
00070   type::Decimal *val_decimal(type::Decimal *)
00071   {
00072     illegal_method_call((const char*)"val_decimal");
00073     return 0;
00074   };
00075   bool fix_fields(Session *session, Item **ref);
00076   void fix_after_pullout(Select_Lex *new_parent, Item **ref);
00077   void cleanup();
00078   void split_sum_func(Session *session, Item **ref_pointer_array, List<Item> &fields);
00079   table_map used_tables() const { return used_tables_cache; };
00080   bool const_item() const { return const_item_cache; };
00081   enum Item_result result_type() const { return ROW_RESULT; }
00082   void update_used_tables();
00083   virtual void print(String *str);
00084 
00085   bool walk(Item_processor processor, bool walk_subquery, unsigned char *arg);
00086   Item *transform(Item_transformer transformer, unsigned char *arg);
00087 
00088   uint32_t cols() { return arg_count; }
00089   Item* element_index(uint32_t i) { return items[i]; }
00090   Item** addr(uint32_t i) { return items + i; }
00091   bool check_cols(uint32_t c);
00092   bool null_inside() { return with_null; };
00093   void bring_value();
00094 };
00095 
00096 } /* namespace drizzled */
00097