summaryrefslogtreecommitdiff
path: root/sql/item.h
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.h')
-rw-r--r--sql/item.h43
1 files changed, 26 insertions, 17 deletions
diff --git a/sql/item.h b/sql/item.h
index 516cb05c2a2..4201790e907 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -294,15 +294,15 @@ struct Name_resolution_context: Sql_alloc
bool resolve_in_select_list;
/*
- When FALSE we do not check columns right of resolving items, used to
- prevent rights check on underlying tables of view
+ Security context of this name resolution context. It's used for views
+ and is non-zero only if the view is defined with SQL SECURITY DEFINER.
*/
- bool check_privileges;
+ Security_context *security_ctx;
Name_resolution_context()
:outer_context(0), table_list(0), select_lex(0),
error_processor_data(0),
- check_privileges(TRUE)
+ security_ctx(0)
{}
void init()
@@ -526,6 +526,7 @@ public:
double val_real_from_decimal();
virtual Field *get_tmp_table_field() { return 0; }
+ /* This is also used to create fields in CREATE ... SELECT: */
virtual Field *tmp_table_field(TABLE *t_arg) { return 0; }
virtual const char *full_name() const { return name ? name : "???"; }
@@ -730,13 +731,7 @@ public:
sp_head *owner;
#endif
LEX_STRING m_name;
-
- /*
- Buffer, pointing to the string value of the item. We need it to
- protect internal buffer from changes. See comment to analogous
- member in Item_param for more details.
- */
- String str_value_ptr;
+ THD *thd;
/*
Position of this reference to SP variable in the statement (the
@@ -748,10 +743,10 @@ public:
Value of 0 means that this object doesn't corresponding to reference to
SP variable in query text.
*/
- int pos_in_query;
+ uint pos_in_query;
- Item_splocal(LEX_STRING name, uint offset, int pos_in_q=0)
- : m_offset(offset), m_name(name), pos_in_query(pos_in_q)
+ Item_splocal(LEX_STRING name, uint offset, uint pos_in_q=0)
+ : m_offset(offset), m_name(name), thd(0), pos_in_query(pos_in_q)
{
maybe_null= TRUE;
}
@@ -1069,7 +1064,7 @@ public:
bool basic_const_item() const { return 1; }
Item *new_item() { return new Item_null(name); }
bool is_null() { return 1; }
- void print(String *str) { str->append("NULL", 4); }
+ void print(String *str) { str->append(STRING_WITH_LEN("NULL")); }
Item *safe_charset_converter(CHARSET_INFO *tocs);
};
@@ -1209,6 +1204,7 @@ public:
constant, assert otherwise. This method is called only if
basic_const_item returned TRUE.
*/
+ Item *safe_charset_converter(CHARSET_INFO *tocs);
Item *new_item();
/*
Implement by-value equality evaluation if parameter value
@@ -1346,6 +1342,14 @@ public:
longlong val_int()
{
DBUG_ASSERT(fixed == 1);
+ if (value <= (double) LONGLONG_MIN)
+ {
+ return LONGLONG_MIN;
+ }
+ else if (value >= (double) (ulonglong) LONGLONG_MAX)
+ {
+ return LONGLONG_MAX;
+ }
return (longlong) (value+(value > 0 ? 0.5 : -0.5));
}
String *val_str(String*);
@@ -1608,7 +1612,11 @@ public:
void make_field(Send_field *field);
bool fix_fields(THD *, Item **);
int save_in_field(Field *field, bool no_conversions);
- void save_org_in_field(Field *field) { (*ref)->save_org_in_field(field); }
+ void save_org_in_field(Field *field)
+ {
+ (*ref)->save_org_in_field(field);
+ null_value= (*ref)->null_value;
+ }
enum Item_result result_type () const { return (*ref)->result_type(); }
enum_field_types field_type() const { return (*ref)->field_type(); }
Field *get_tmp_table_field()
@@ -1631,7 +1639,7 @@ public:
}
Item *real_item()
{
- return (ref && *ref) ? (*ref)->real_item() : this;
+ return ref ? (*ref)->real_item() : this;
}
bool walk(Item_processor processor, byte *arg)
{ return (*ref)->walk(processor, arg); }
@@ -1755,6 +1763,7 @@ public:
return ref->save_in_field(field, no_conversions);
}
Item *new_item();
+ virtual Item *real_item() { return ref; }
};