00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
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
00031 bool Item_user_var_as_out_param::fix_fields(Session *session, Item **ref)
00032 {
00033 assert(fixed == 0);
00034 if (Item::fix_fields(session, ref) ||
00035 !(entry= session->getVariable(name, true)))
00036 return true;
00037 entry->type= STRING_RESULT;
00038
00039
00040
00041
00042
00043 entry->collation.set(default_charset_info);
00044 entry->update_query_id= session->getQueryId();
00045 return false;
00046 }
00047
00048 void Item_user_var_as_out_param::set_null_value(const CHARSET_INFO * const cs)
00049 {
00050 entry->update_hash(true, 0, 0, STRING_RESULT, cs,
00051 DERIVATION_IMPLICIT, 0 );
00052 }
00053
00054
00055 void Item_user_var_as_out_param::set_value(const char *str, uint32_t length,
00056 const CHARSET_INFO * const cs)
00057 {
00058 entry->update_hash(false, (void*)str, length, STRING_RESULT, cs,
00059 DERIVATION_IMPLICIT, 0 );
00060 }
00061
00062 double Item_user_var_as_out_param::val_real()
00063 {
00064 assert(0);
00065 return 0.0;
00066 }
00067
00068
00069 int64_t Item_user_var_as_out_param::val_int()
00070 {
00071 assert(0);
00072 return 0;
00073 }
00074
00075
00076 String* Item_user_var_as_out_param::val_str(String *)
00077 {
00078 assert(0);
00079 return 0;
00080 }
00081
00082 type::Decimal* Item_user_var_as_out_param::val_decimal(type::Decimal *)
00083 {
00084 assert(0);
00085 return 0;
00086 }
00087
00088
00089 void Item_user_var_as_out_param::print(String *str)
00090 {
00091 str->append('@');
00092 str->append(name.str,name.length);
00093 }
00094
00095 }