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