diff options
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 1dbf28b67cb..c347cd2913b 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1882,8 +1882,7 @@ void Item_func_round::fix_length_and_dec() return; } - switch (args[0]->result_type()) - { + switch (args[0]->result_type()) { case REAL_RESULT: case STRING_RESULT: hybrid_type= REAL_RESULT; @@ -1891,16 +1890,17 @@ void Item_func_round::fix_length_and_dec() max_length= float_length(decimals); break; case INT_RESULT: - if ((decimals_to_set==0) && + if (!decimals_to_set && (truncate || (args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS))) { + int length_can_increase= test(!truncate && (args[1]->val_int() < 0)); + max_length= args[0]->max_length + length_can_increase; /* Here we can keep INT_RESULT */ hybrid_type= INT_RESULT; - int length_can_increase= !truncate && (args[1]->val_int() < 0); - max_length= args[0]->max_length + length_can_increase; decimals= 0; break; } + /* fall through */ case DECIMAL_RESULT: { hybrid_type= DECIMAL_RESULT; @@ -4451,7 +4451,8 @@ err: bool Item_func_match::eq(const Item *item, bool binary_cmp) const { - if (item->type() != FUNC_ITEM || ((Item_func*)item)->functype() != FT_FUNC || + if (item->type() != FUNC_ITEM || + ((Item_func*)item)->functype() != FT_FUNC || flags != ((Item_func_match*)item)->flags) return 0; @@ -4809,7 +4810,7 @@ Item_func_sp::execute(Item **itp) ulong old_client_capabilites; int res= -1; bool save_in_sub_stmt= thd->transaction.in_sub_stmt; - my_bool nsok; + my_bool save_no_send_ok; #ifndef NO_EMBEDDED_ACCESS_CHECKS st_sp_security_context save_ctx; #endif @@ -4824,7 +4825,7 @@ Item_func_sp::execute(Item **itp) thd->client_capabilities &= ~CLIENT_MULTI_RESULTS; #ifndef EMBEDDED_LIBRARY - nsok= thd->net.no_send_ok; + save_no_send_ok= thd->net.no_send_ok; thd->net.no_send_ok= TRUE; #endif @@ -4836,7 +4837,7 @@ Item_func_sp::execute(Item **itp) if (save_ctx.changed && check_routine_access(thd, EXECUTE_ACL, m_sp->m_db.str, m_sp->m_name.str, 0, 0)) - goto error_check; + goto error_check_ctx; #endif /* Like for SPs, we don't binlog the substatements. If the statement which @@ -4859,8 +4860,8 @@ Item_func_sp::execute(Item **itp) ER_FAILED_ROUTINE_BREAK_BINLOG, ER(ER_FAILED_ROUTINE_BREAK_BINLOG)); -error_check_ctx: #ifndef NO_EMBEDDED_ACCESS_CHECKS +error_check_ctx: sp_restore_security_context(thd, m_sp, &save_ctx); #endif @@ -4868,7 +4869,7 @@ error_check_ctx: error_check: #ifndef EMBEDDED_LIBRARY - thd->net.no_send_ok= nsok; + thd->net.no_send_ok= save_no_send_ok; #endif thd->client_capabilities|= old_client_capabilites & CLIENT_MULTI_RESULTS; |