Drizzled Public API Documentation

user_var_as_out_param.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/function/func.h>
00023 
00024 namespace drizzled {
00025 
00026 /*
00027   This item represents user variable used as out parameter (e.g in LOAD DATA),
00028   and it is supposed to be used only for this purprose. So it is simplified
00029   a lot. Actually you should never obtain its value.
00030 
00031   The only two reasons for this thing being an Item is possibility to store it
00032   in List<Item> and desire to place this code somewhere near other functions
00033   working with user variables.
00034 */
00035 class Item_user_var_as_out_param : public Item
00036 {
00037   str_ref name;
00038   user_var_entry *entry;
00039 public:
00040   Item_user_var_as_out_param(str_ref a) : name(a) {}
00041   /* We should return something different from FIELD_ITEM here */
00042   Type type() const { return STRING_ITEM;}
00043   double val_real();
00044   int64_t val_int();
00045   String *val_str(String*);
00046   type::Decimal *val_decimal(type::Decimal *decimal_buffer);
00047   /* fix_fields() binds variable name with its entry structure */
00048   bool fix_fields(Session*, Item **ref);
00049   virtual void print(String*);
00050   void set_null_value(const charset_info_st*);
00051   void set_value(str_ref, const charset_info_st*);
00052 };
00053 
00054 } /* namespace drizzled */