| 349 | */ |
| 350 | |
| 351 | void |
| 352 | Diagnostics_area::set_ok_status(ulonglong affected_rows, |
| 353 | ulonglong last_insert_id, |
| 354 | const char *message) |
| 355 | { |
| 356 | DBUG_ENTER("set_ok_status"); |
| 357 | DBUG_ASSERT(!is_set() || (m_status == DA_OK_BULK && is_bulk_op())); |
| 358 | /* |
| 359 | In production, refuse to overwrite an error or a custom response |
| 360 | with an OK packet. |
| 361 | */ |
| 362 | if (unlikely(is_error() || is_disabled())) |
| 363 | DBUG_VOID_RETURN; |
| 364 | /* |
| 365 | When running a bulk operation, m_status will be DA_OK for the first |
| 366 | operation and set to DA_OK_BULK for all following operations. |
| 367 | */ |
| 368 | if (m_status == DA_OK_BULK) |
| 369 | { |
| 370 | m_statement_warn_count+= current_statement_warn_count(); |
| 371 | m_affected_rows+= affected_rows; |
| 372 | } |
| 373 | else |
| 374 | { |
| 375 | m_statement_warn_count= current_statement_warn_count(); |
| 376 | m_affected_rows= affected_rows; |
| 377 | m_status= (is_bulk_op() ? DA_OK_BULK : DA_OK); |
| 378 | } |
| 379 | m_last_insert_id= last_insert_id; |
| 380 | if (message) |
| 381 | strmake_buf(m_message, message); |
| 382 | else |
| 383 | m_message[0]= '\0'; |
| 384 | DBUG_VOID_RETURN; |
| 385 | } |
| 386 | |
| 387 | |
| 388 | /** |