| 397 | */ |
| 398 | |
| 399 | static Prepared_statement * |
| 400 | find_prepared_statement(THD *thd, ulong id) |
| 401 | { |
| 402 | /* |
| 403 | To strictly separate namespaces of SQL prepared statements and C API |
| 404 | prepared statements find() will return 0 if there is a named prepared |
| 405 | statement with such id. |
| 406 | |
| 407 | LAST_STMT_ID is special value which mean last prepared statement ID |
| 408 | (it was made for COM_MULTI to allow prepare and execute a statement |
| 409 | in the same command but usage is not limited by COM_MULTI only). |
| 410 | */ |
| 411 | Statement *stmt= ((id == LAST_STMT_ID) ? |
| 412 | thd->last_stmt : |
| 413 | thd->stmt_map.find(id)); |
| 414 | |
| 415 | if (stmt == 0 || stmt->type() != Query_arena::PREPARED_STATEMENT) |
| 416 | return NULL; |
| 417 | |
| 418 | return (Prepared_statement *) stmt; |
| 419 | } |
| 420 | |
| 421 | |
| 422 | /** |
no test coverage detected