| 383 | } |
| 384 | |
| 385 | bool Sql_cmd_signal::execute(THD *thd) |
| 386 | { |
| 387 | bool result= TRUE; |
| 388 | DBUG_ASSERT(m_cond); |
| 389 | Sql_condition cond(thd->mem_root, m_cond->get_user_condition_identity()); |
| 390 | |
| 391 | DBUG_ENTER("Sql_cmd_signal::execute"); |
| 392 | |
| 393 | /* |
| 394 | WL#2110 SIGNAL specification says: |
| 395 | |
| 396 | When SIGNAL is executed, it has five effects, in the following order: |
| 397 | |
| 398 | (1) First, the diagnostics area is completely cleared. So if the |
| 399 | SIGNAL is in a DECLARE HANDLER then any pending errors or warnings |
| 400 | are gone. So is 'row count'. |
| 401 | |
| 402 | This has roots in the SQL standard specification for SIGNAL. |
| 403 | */ |
| 404 | |
| 405 | thd->get_stmt_da()->reset_diagnostics_area(); |
| 406 | thd->set_row_count_func(0); |
| 407 | thd->get_stmt_da()->clear_warning_info(thd->query_id); |
| 408 | |
| 409 | result= raise_condition(thd, &cond); |
| 410 | |
| 411 | DBUG_RETURN(result); |
| 412 | } |
| 413 | |
| 414 | |
| 415 | /** |
nothing calls this directly
no test coverage detected