My Project
Public Types | Public Member Functions
Diagnostics_area Class Reference

#include <sql_error.h>

List of all members.

Public Types

enum  enum_diagnostics_status {
  DA_EMPTY = 0, DA_OK, DA_EOF, DA_ERROR,
  DA_DISABLED
}
typedef
Warning_info::Sql_condition_list::Const_Iterator 
Sql_condition_iterator

Public Member Functions

void set_overwrite_status (bool can_overwrite_status)
bool is_sent () const
void set_is_sent (bool is_sent)
void set_ok_status (ulonglong affected_rows, ulonglong last_insert_id, const char *message)
void set_eof_status (THD *thd)
void set_error_status (uint sql_errno)
void set_error_status (uint sql_errno, const char *message, const char *sqlstate, const Sql_condition *error_condition)
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
uint sql_errno () const
const char * get_sqlstate () const
ulonglong affected_rows () const
ulonglong last_insert_id () const
uint statement_warn_count () const
 Diagnostics_area (ulonglong warning_info_id, bool allow_unlimited_warnings)
void push_warning_info (Warning_info *wi)
void pop_warning_info ()
void set_warning_info_id (ulonglong id)
ulonglong warning_info_id () const
bool warning_info_changed (const Warning_info *wi) const
bool is_warning_info_empty () const
ulong current_statement_warn_count () const
bool has_sql_condition (const char *message_str, ulong message_length) const
void reset_for_next_command ()
void clear_warning_info (ulonglong id)
void opt_clear_warning_info (ulonglong query_id)
ulong current_row_for_warning () const
void inc_current_row_for_warning ()
void reset_current_row_for_warning ()
bool is_warning_info_read_only () const
void set_warning_info_read_only (bool read_only)
ulong error_count () const
ulong warn_count () const
uint cond_count () const
Sql_condition_iterator sql_conditions () const
void reserve_space (THD *thd, uint count)
Sql_conditionpush_warning (THD *thd, const Sql_condition *sql_condition)
Sql_conditionpush_warning (THD *thd, uint sql_errno, const char *sqlstate, Sql_condition::enum_warning_level level, const char *msg)
void mark_sql_conditions_for_removal ()
void unmark_sql_conditions_from_removal ()
void remove_marked_sql_conditions ()
const Sql_conditionget_error_condition () const
void copy_sql_conditions_to_wi (THD *thd, Warning_info *dst_wi) const
void copy_sql_conditions_from_wi (THD *thd, const Warning_info *src_wi)
void copy_non_errors_from_wi (THD *thd, const Warning_info *src_wi)

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.


Member Typedef Documentation

Const iterator used to iterate through the warning list.


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.


Member Function Documentation

void Diagnostics_area::copy_non_errors_from_wi ( THD *  thd,
const Warning_info src_wi 
)

Copy Sql_conditions that are not WARN_LEVEL_ERROR from the source Warning_info to the current Warning_info.

Parameters:
thdThread context.
sp_wiStored-program Warning_info
thdThread context.
src_wiWarning_info to copy from.

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.

Clear this diagnostics area.

Normally called at the end of a statement.

Tiny reset in debug mode to see garbage right away

void Diagnostics_area::set_eof_status ( THD *  thd)

Set EOF status.

void Diagnostics_area::set_error_status ( uint  sql_errno)

Set ERROR status in the Diagnostics Area. This function should be used to report fatal errors (such as out-of-memory errors) when no further processing is possible.

Parameters:
sql_errnoSQL-condition error number
void Diagnostics_area::set_error_status ( uint  sql_errno,
const char *  message,
const char *  sqlstate,
const Sql_condition error_condition 
)

Set ERROR status in the Diagnostics Area.

Note:
error_condition may be NULL. It happens if a) OOM error is being reported; or b) when Warning_info is full.
Parameters:
sql_errnoSQL-condition error number
messageSQL-condition message
sqlstateSQL-condition state
error_conditionSQL-condition object representing the error state
void Diagnostics_area::set_ok_status ( ulonglong  affected_rows,
ulonglong  last_insert_id,
const char *  message 
)

Set OK status -- ends commands that do not return a result set, e.g. INSERT/UPDATE/DELETE.

bool Diagnostics_area::warning_info_changed ( const Warning_info wi) const [inline]

Compare given current warning info and current warning info and see if they are different. They will be different if warnings have been generated or statements that use tables have been executed. This is checked by comparing m_warn_id.

Parameters:
wiWarning info to compare with current Warning info.
Returns:
false if they are equal, true if they are not.

The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines