drizzle
C++ MySQL-protocol-compatible database server
Loading...
Searching...
No Matches
drizzled::Diagnostics_area Class Reference

#include <diagnostics_area.h>

Collaboration diagram for drizzled::Diagnostics_area:
[legend]

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

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

Member Enumeration Documentation

◆ enum_diagnostics_status

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

Constructor & Destructor Documentation

◆ Diagnostics_area()

drizzled::Diagnostics_area::Diagnostics_area ( )
inline

Definition at line 83 of file diagnostics_area.h.

Member Function Documentation

◆ affected_rows()

ha_rows drizzled::Diagnostics_area::affected_rows ( ) const

Definition at line 66 of file diagnostics_area.cc.

◆ disable_status()

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.

◆ found_rows()

ha_rows drizzled::Diagnostics_area::found_rows ( ) const

Definition at line 69 of file diagnostics_area.cc.

◆ is_disabled()

bool drizzled::Diagnostics_area::is_disabled ( ) const
inline

Definition at line 70 of file diagnostics_area.h.

◆ is_eof()

bool drizzled::Diagnostics_area::is_eof ( ) const
inline

Definition at line 68 of file diagnostics_area.h.

◆ is_error()

bool drizzled::Diagnostics_area::is_error ( ) const
inline

Definition at line 67 of file diagnostics_area.h.

◆ is_ok()

bool drizzled::Diagnostics_area::is_ok ( ) const
inline

Definition at line 69 of file diagnostics_area.h.

◆ is_set()

bool drizzled::Diagnostics_area::is_set ( ) const
inline

Definition at line 66 of file diagnostics_area.h.

◆ last_insert_id()

uint64_t drizzled::Diagnostics_area::last_insert_id ( ) const

Definition at line 72 of file diagnostics_area.cc.

◆ message()

const char * drizzled::Diagnostics_area::message ( ) const

Definition at line 47 of file diagnostics_area.cc.

◆ reset_diagnostics_area()

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.

◆ server_status()

uint32_t drizzled::Diagnostics_area::server_status ( ) const

Definition at line 60 of file diagnostics_area.cc.

◆ set_eof_status()

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.

◆ set_error_status()

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.

◆ set_ok_status()

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.

◆ sql_errno()

error_t drizzled::Diagnostics_area::sql_errno ( ) const

Definition at line 54 of file diagnostics_area.cc.

◆ status()

enum_diagnostics_status drizzled::Diagnostics_area::status ( ) const
inline

Definition at line 71 of file diagnostics_area.h.

◆ total_warn_count()

uint32_t drizzled::Diagnostics_area::total_warn_count ( ) const

Definition at line 75 of file diagnostics_area.cc.

Member Data Documentation

◆ can_overwrite_status

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.

◆ is_sent

bool drizzled::Diagnostics_area::is_sent

True if status information is sent to the client.

Definition at line 52 of file diagnostics_area.h.

◆ m_affected_rows

ha_rows drizzled::Diagnostics_area::m_affected_rows
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.

◆ m_found_rows

ha_rows drizzled::Diagnostics_area::m_found_rows
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.

◆ m_last_insert_id

uint64_t drizzled::Diagnostics_area::m_last_insert_id
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.

◆ m_message

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

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

Definition at line 87 of file diagnostics_area.h.

◆ m_server_status

uint32_t drizzled::Diagnostics_area::m_server_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.

◆ m_sql_errno

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

◆ m_status

enum_diagnostics_status drizzled::Diagnostics_area::m_status
private

Definition at line 129 of file diagnostics_area.h.

◆ m_total_warn_count

uint32_t drizzled::Diagnostics_area::m_total_warn_count
private

The total number of warnings.

Definition at line 128 of file diagnostics_area.h.

◆ m_warn_list

std::list<DRIZZLE_ERROR*> drizzled::Diagnostics_area::m_warn_list

Definition at line 81 of file diagnostics_area.h.


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