Drizzled Public API Documentation

user_var_as_out_param.cc
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 #include <config.h>
00021 
00022 #include <cassert>
00023 
00024 #include <drizzled/function/user_var_as_out_param.h>
00025 #include <drizzled/user_var_entry.h>
00026 #include <drizzled/session.h>
00027 
00028 namespace drizzled {
00029 
00030 bool Item_user_var_as_out_param::fix_fields(Session *session, Item **ref)
00031 {
00032   assert(fixed == 0);
00033   if (Item::fix_fields(session, ref) ||
00034       !(entry= session->getVariable(name, true)))
00035     return true;
00036   entry->type= STRING_RESULT;
00037   /*
00038     Let us set the same collation which is used for loading
00039     of fields in LOAD DATA INFILE.
00040     (Since Item_user_var_as_out_param is used only there).
00041   */
00042   entry->collation.set(default_charset_info);
00043   entry->update_query_id= session->getQueryId();
00044   return false;
00045 }
00046 
00047 void Item_user_var_as_out_param::set_null_value(const charset_info_st* cs)
00048 {
00049   entry->update_hash(true, data_ref(), STRING_RESULT, cs, DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
00050 }
00051 
00052 
00053 void Item_user_var_as_out_param::set_value(str_ref str, const charset_info_st* cs)
00054 {
00055   entry->update_hash(false, str, STRING_RESULT, cs, DERIVATION_IMPLICIT, 0 /* unsigned_arg */);
00056 }
00057 
00058 double Item_user_var_as_out_param::val_real()
00059 {
00060   assert(0);
00061   return 0.0;
00062 }
00063 
00064 
00065 int64_t Item_user_var_as_out_param::val_int()
00066 {
00067   assert(0);
00068   return 0;
00069 }
00070 
00071 
00072 String* Item_user_var_as_out_param::val_str(String *)
00073 {
00074   assert(0);
00075   return 0;
00076 }
00077 
00078 type::Decimal* Item_user_var_as_out_param::val_decimal(type::Decimal *)
00079 {
00080   assert(0);
00081   return 0;
00082 }
00083 
00084 void Item_user_var_as_out_param::print(String *str)
00085 {
00086   str->append('@');
00087   str->append(name);
00088 }
00089 
00090 } /* namespace drizzled */