24 #include <drizzled/function/get_user_var.h>
25 #include <drizzled/item/null.h>
26 #include <drizzled/sql_parse.h>
27 #include <drizzled/session.h>
28 #include <drizzled/user_var_entry.h>
67 void Item_func_get_user_var::fix_length_and_dec()
70 decimals=NOT_FIXED_DEC;
71 max_length=MAX_BLOB_WIDTH;
73 var_entry= session.getVariable(name,
false);
80 m_cached_result_type= var_entry->type;
81 unsigned_flag= var_entry->unsigned_flag;
82 max_length= var_entry->length;
84 collation.set(var_entry->collation);
85 switch(m_cached_result_type)
88 max_length= DBL_DIG + 8;
92 max_length= MAX_BIGINT_WIDTH;
96 max_length= MAX_BLOB_WIDTH;
100 max_length= DECIMAL_MAX_STR_LENGTH;
101 decimals= DECIMAL_MAX_SCALE;
111 collation.set(&my_charset_bin, DERIVATION_IMPLICIT);
113 m_cached_result_type= STRING_RESULT;
114 max_length= MAX_BLOB_WIDTH;
121 return (!var_entry || session.
getQueryId() != var_entry->update_query_id);
125 enum Item_result Item_func_get_user_var::result_type()
const
127 return m_cached_result_type;
133 str->append(STRING_WITH_LEN(
"(@"));
146 if (item->type() != FUNC_ITEM ||
147 ((
Item_func*) item)->functype() != functype())
150 return (name.size() == other->name.size() &&
151 !memcmp(name.data(), other->name.data(), name.size()));
double val_real(bool *null_value) const
virtual void print(String *str)
TODO: Rename this file - func.h is stupid.
query_id_t getQueryId() const
String * val_str(bool *null_value, String *, uint32_t decimals) const
String * val_str(String *str)
type::Decimal * val_decimal(bool *null_value, type::Decimal *result) const
type::Decimal * val_decimal(type::Decimal *)
int64_t val_int(bool *null_value) const
bool eq(const Item *item, bool binary_cmp) const