Drizzled Public API Documentation

drizzled::Diagnostics_area Class Reference

#include <diagnostics_area.h>

List of all members.

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

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

Detailed Description

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 31 of file diagnostics_area.h.


Member Enumeration Documentation

Enumerator:
DA_EMPTY 

The area is cleared at start of a statement.

DA_OK 

Set whenever one calls my_ok().

DA_EOF 

Set whenever one calls my_eof().

DA_ERROR 

Set whenever one calls my_error() or my_message().

DA_DISABLED 

Set in case of a custom response, such as one from COM_STMT_PREPARE.

Definition at line 34 of file diagnostics_area.h.


Member Function Documentation

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 171 of file diagnostics_area.cc.

References DA_DISABLED.

Referenced by drizzled::dispatch_command().

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 32 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().

Set EOF status.

Only allowed to report eof if has not yet reported an error

Definition at line 116 of file diagnostics_area.cc.

References DA_EOF, m_server_status, and m_total_warn_count.

void drizzled::Diagnostics_area::set_error_status ( drizzled::error_t  sql_errno_arg,
const char *  message_arg 
)

Set ERROR status.

Definition at line 142 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 86 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.


Member Data Documentation

True if status information is sent to the client.

Definition at line 48 of file diagnostics_area.h.

Referenced by drizzled::dispatch_command(), and reset_diagnostics_area().

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 109 of file diagnostics_area.h.

Referenced by reset_diagnostics_area(), and set_ok_status().

This is like m_affected_rows, but contains the number of rows found, not only affected.

Definition at line 114 of file diagnostics_area.h.

Referenced by reset_diagnostics_area(), and set_ok_status().

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 120 of file diagnostics_area.h.

Referenced by reset_diagnostics_area(), and set_ok_status().

char drizzled::Diagnostics_area::m_message[DRIZZLE_ERRMSG_SIZE] [private]

Message buffer. Can be used by OK or ERROR status.

Definition at line 81 of file diagnostics_area.h.

Referenced by reset_diagnostics_area(), set_error_status(), and set_ok_status().

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 96 of file diagnostics_area.h.

Referenced by reset_diagnostics_area(), set_eof_status(), and set_ok_status().

drizzled::error_t drizzled::Diagnostics_area::m_sql_errno [private]

SQL error number. One of ER_ codes from share/errmsg.txt. Set by set_error_status.

Definition at line 86 of file diagnostics_area.h.

Referenced by reset_diagnostics_area(), and set_error_status().

The total number of warnings.

Definition at line 122 of file diagnostics_area.h.

Referenced by reset_diagnostics_area(), set_eof_status(), and set_ok_status().


The documentation for this class was generated from the following files: