summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc28
1 files changed, 23 insertions, 5 deletions
diff --git a/sql/item.cc b/sql/item.cc
index c10eb877179..764c7a3f530 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -56,8 +56,8 @@ const char *item_empty_name="";
const char *item_used_name= "\0";
static int save_field_in_field(Field *, bool *, Field *, bool);
-const Item_bool_static Item_false("FALSE", 0);
-const Item_bool_static Item_true("TRUE", 1);
+Item_bool_static *Item_false;
+Item_bool_static *Item_true;
/**
Compare two Items for List<Item>::add_unique()
@@ -446,7 +446,7 @@ Item::Item(THD *thd):
Item::Item():
name(null_clex_str), orig_name(0), is_expensive_cache(-1)
{
- DBUG_ASSERT(my_progname == NULL); // before main()
+ DBUG_ASSERT(!mysqld_server_started); // Created early
base_flags= item_base_t::FIXED;
with_flags= item_with_t::NONE;
null_value= 0;
@@ -4512,6 +4512,22 @@ bool Item_param::is_evaluable_expression() const
}
+bool Item_param::check_assignability_to(const Field *to, bool ignore) const
+{
+ switch (state) {
+ case SHORT_DATA_VALUE:
+ case LONG_DATA_VALUE:
+ case NULL_VALUE:
+ return to->check_assignability_from(type_handler(), ignore);
+ case NO_VALUE:
+ case IGNORE_VALUE:
+ case DEFAULT_VALUE:
+ break;
+ }
+ return false;
+}
+
+
bool Item_param::can_return_value() const
{
// There's no "default". See comments in Item_param::save_in_field().
@@ -9902,9 +9918,11 @@ void Item_trigger_field::set_required_privilege(bool rw)
bool Item_trigger_field::set_value(THD *thd, sp_rcontext * /*ctx*/, Item **it)
{
- Item *item= thd->sp_prepare_func_item(it);
+ if (fix_fields_if_needed(thd, NULL))
+ return true;
- if (!item || fix_fields_if_needed(thd, NULL))
+ Item *item= thd->sp_fix_func_item_for_assignment(field, it);
+ if (!item)
return true;
if (field->vers_sys_field())
return false;