#include <diagnostics_area.h>
Public Types | |
enum | enum_diagnostics_status { DA_EMPTY = 0, DA_OK, DA_EOF, DA_ERROR, DA_DISABLED } |
Public Member Functions | |
void | set_ok_status (Session *session, ha_rows affected_rows_arg, ha_rows found_rows_arg, uint64_t last_insert_id_arg, const char *message) |
void | set_eof_status (Session *session) |
void | set_error_status (drizzled::error_t sql_errno_arg, const char *message_arg) |
void | disable_status () |
void | reset_diagnostics_area () |
bool | is_set () const |
bool | is_error () const |
bool | is_eof () const |
bool | is_ok () const |
bool | is_disabled () const |
enum_diagnostics_status | status () const |
const char * | message () const |
drizzled::error_t | sql_errno () const |
uint32_t | server_status () const |
ha_rows | affected_rows () const |
ha_rows | found_rows () const |
uint64_t | last_insert_id () const |
uint32_t | total_warn_count () const |
Public Attributes | |
bool | is_sent |
bool | can_overwrite_status |
std::list< DRIZZLE_ERROR * > | m_warn_list |
Private Attributes | |
char | m_message [DRIZZLE_ERRMSG_SIZE] |
drizzled::error_t | m_sql_errno |
uint32_t | m_server_status |
ha_rows | m_affected_rows |
ha_rows | m_found_rows |
uint64_t | m_last_insert_id |
uint32_t | m_total_warn_count |
enum_diagnostics_status | m_status |
Stores status of the currently executed statement. Cleared at the beginning of the statement, and then can hold either OK, ERROR, or EOF status. Can not be assigned twice per statement.
Definition at line 35 of file diagnostics_area.h.
Definition at line 38 of file diagnostics_area.h.
void drizzled::Diagnostics_area::disable_status | ( | ) |
Mark the diagnostics area as 'DISABLED'.
This is used in rare cases when the COM_ command at hand sends a response in a custom format. One example is the query cache, another is COM_STMT_PREPARE.
Definition at line 170 of file diagnostics_area.cc.
References DA_DISABLED.
Referenced by drizzled::dispatch_command().
void drizzled::Diagnostics_area::reset_diagnostics_area | ( | ) |
Clear this diagnostics area.
Normally called at the end of a statement.
Don't take chances in production
Tiny reset in debug mode to see garbage right away
Definition at line 31 of file diagnostics_area.cc.
References can_overwrite_status, DA_EMPTY, is_sent, m_affected_rows, m_found_rows, m_last_insert_id, m_message, m_server_status, m_sql_errno, and m_total_warn_count.
Referenced by drizzled::delete_query(), drizzled::Session::executeStatement(), drizzled::Session::reset_for_next_command(), and drizzled::update_query().
void drizzled::Diagnostics_area::set_eof_status | ( | Session * | session) |
Set EOF status.
Only allowed to report eof if has not yet reported an error
Definition at line 115 of file diagnostics_area.cc.
References DA_EOF, m_server_status, and m_total_warn_count.
Referenced by drizzled::Session::my_eof().
void drizzled::Diagnostics_area::set_error_status | ( | drizzled::error_t | sql_errno_arg, |
const char * | message_arg | ||
) |
Set ERROR status.
Definition at line 141 of file diagnostics_area.cc.
References can_overwrite_status, DA_ERROR, m_message, and m_sql_errno.
void drizzled::Diagnostics_area::set_ok_status | ( | Session * | session, |
ha_rows | affected_rows_arg, | ||
ha_rows | found_rows_arg, | ||
uint64_t | last_insert_id_arg, | ||
const char * | message_arg | ||
) |
Set OK status – ends commands that do not return a result set, e.g. INSERT/UPDATE/DELETE.
Only allowed to report success if has not yet reported an error
Definition at line 85 of file diagnostics_area.cc.
References DA_OK, m_affected_rows, m_found_rows, m_last_insert_id, m_message, m_server_status, and m_total_warn_count.
Referenced by drizzled::Session::my_ok().
bool drizzled::Diagnostics_area::can_overwrite_status |
Set to make set_error_status after set_{ok,eof}_status possible.
Definition at line 54 of file diagnostics_area.h.
Referenced by drizzled::Session::close_thread_tables(), drizzled::dispatch_command(), reset_diagnostics_area(), drizzle_plugin::ClientMySQLProtocol::sendEOF(), drizzle_plugin::ClientMySQLProtocol::sendError(), drizzle_plugin::ClientMySQLProtocol::sendOK(), and set_error_status().
bool drizzled::Diagnostics_area::is_sent |
True if status information is sent to the client.
Definition at line 52 of file diagnostics_area.h.
Referenced by drizzled::dispatch_command(), and reset_diagnostics_area().
|
private |
The number of rows affected by the last statement. This is semantically close to session->row_count_func, but has a different life cycle. session->row_count_func stores the value returned by function ROW_COUNT() and is cleared only by statements that update its value, such as INSERT, UPDATE, DELETE and few others. This member is cleared at the beginning of the next statement.
We could possibly merge the two, but life cycle of session->row_count_func can not be changed.
Definition at line 115 of file diagnostics_area.h.
Referenced by reset_diagnostics_area(), and set_ok_status().
|
private |
This is like m_affected_rows, but contains the number of rows found, not only affected.
Definition at line 120 of file diagnostics_area.h.
Referenced by reset_diagnostics_area(), and set_ok_status().
|
private |
Similarly to the previous member, this is a replacement of session->first_successful_insert_id_in_prev_stmt, which is used to implement LAST_INSERT_ID().
Definition at line 126 of file diagnostics_area.h.
Referenced by reset_diagnostics_area(), and set_ok_status().
|
private |
Message buffer. Can be used by OK or ERROR status.
Definition at line 87 of file diagnostics_area.h.
Referenced by reset_diagnostics_area(), set_error_status(), and set_ok_status().
|
private |
Copied from session->server_status when the diagnostics area is assigned. We need this member as some places in the code use the following pattern: session->server_status|= ... my_eof(session); session->server_status&= ~... Assigned by OK, EOF or ERROR.
Definition at line 102 of file diagnostics_area.h.
Referenced by reset_diagnostics_area(), set_eof_status(), and set_ok_status().
|
private |
SQL error number. One of ER_ codes from share/errmsg.txt. Set by set_error_status.
Definition at line 92 of file diagnostics_area.h.
Referenced by reset_diagnostics_area(), and set_error_status().
|
private |
The total number of warnings.
Definition at line 128 of file diagnostics_area.h.
Referenced by reset_diagnostics_area(), set_eof_status(), and set_ok_status().