| 3048 | |
| 3049 | |
| 3050 | static bool do_execute_sp(THD *thd, sp_head *sp) |
| 3051 | { |
| 3052 | /* bits that should be cleared in thd->server_status */ |
| 3053 | uint bits_to_be_cleared= 0; |
| 3054 | ulonglong affected_rows; |
| 3055 | if (sp->m_flags & sp_head::MULTI_RESULTS) |
| 3056 | { |
| 3057 | if (!(thd->client_capabilities & CLIENT_MULTI_RESULTS)) |
| 3058 | { |
| 3059 | /* The client does not support multiple result sets being sent back */ |
| 3060 | my_error(ER_SP_BADSELECT, MYF(0), ErrConvDQName(sp).ptr()); |
| 3061 | return 1; |
| 3062 | } |
| 3063 | } |
| 3064 | /* |
| 3065 | If SERVER_MORE_RESULTS_EXISTS is not set, |
| 3066 | then remember that it should be cleared |
| 3067 | */ |
| 3068 | bits_to_be_cleared= (~thd->server_status & |
| 3069 | SERVER_MORE_RESULTS_EXISTS); |
| 3070 | thd->server_status|= SERVER_MORE_RESULTS_EXISTS; |
| 3071 | ha_rows select_limit= thd->variables.select_limit; |
| 3072 | thd->variables.select_limit= HA_POS_ERROR; |
| 3073 | |
| 3074 | thd->lex->in_sum_func= 0; // For Item_field::fix_fields() |
| 3075 | |
| 3076 | /* |
| 3077 | We never write CALL statements into binlog: |
| 3078 | - If the mode is non-prelocked, each statement will be logged |
| 3079 | separately. |
| 3080 | - If the mode is prelocked, the invoking statement will care |
| 3081 | about writing into binlog. |
| 3082 | So just execute the statement. |
| 3083 | */ |
| 3084 | int res= sp->execute_procedure(thd, &thd->lex->value_list); |
| 3085 | |
| 3086 | thd->variables.select_limit= select_limit; |
| 3087 | thd->server_status&= ~bits_to_be_cleared; |
| 3088 | |
| 3089 | if (res) |
| 3090 | { |
| 3091 | DBUG_ASSERT(thd->is_error() || thd->killed); |
| 3092 | return 1; // Substatement should already have sent error |
| 3093 | } |
| 3094 | |
| 3095 | affected_rows= thd->affected_rows; // Affected rows for all sub statements |
| 3096 | thd->affected_rows= 0; // Reset total, as my_ok() adds to it |
| 3097 | my_ok(thd, affected_rows); |
| 3098 | return 0; |
| 3099 | } |
| 3100 | |
| 3101 | |
| 3102 | static int __attribute__ ((noinline)) |
no test coverage detected