![]() |
MySQL 9.5.0
Source Code Documentation
|
Statement_handle is similar to Ed_connection. More...
#include <statement.h>
Public Member Functions | |
| Statement_handle (THD *thd, const char *query, size_t length) | |
| bool | is_error () const |
| Check if error is reported. More... | |
| LEX_CSTRING | get_last_error () |
| Check if error is reported. More... | |
| unsigned int | get_last_errno () const |
| Get the last mysql errno. More... | |
| LEX_CSTRING | get_mysql_state () |
| Get the mysql error state. More... | |
| ulonglong | warning_count () const |
| Get number of warnings generated. More... | |
| Warning * | get_warnings () |
| Get list of all warnings. More... | |
| void | set_clear_diagnostics_area_on_success (bool clear_da) |
| Set the flag to indicate clear diagnostics area on successful execution of a statement. More... | |
| bool | clear_diagnostics_area_on_success () const |
| Get value of a flag which indicates whether diagnostics area should be cleared on successful execution of a statement or not. More... | |
| Result_set * | get_result_sets () |
| Get the next result sets generated while executing the statement. More... | |
| Result_set * | get_current_result_set () |
| Get the current result set object. More... | |
| void | next_result_set () |
| Make the next result set the current result set. More... | |
| virtual bool | execute ()=0 |
| Execute the SQL command. More... | |
| virtual bool | is_prepared_statement ()=0 |
| Check if we are processing a prepared statement. More... | |
| virtual bool | is_executed_or_prepared ()=0 |
| Check if the statement has been executed or prepared. More... | |
| void | free_old_result () |
| Feel all the result collected so far, from query execution. More... | |
| std::string_view | get_query () |
| Get the query string being executed. More... | |
| void | set_capacity (size_t capacity) |
| Set the capacity in bytes allowed for caching results. More... | |
| size_t | get_capacity () |
| Get the capacity in bytes allowed for caching results. More... | |
| void | set_use_thd_protocol (bool use_thd_protocol) |
| Set thd protocol to enable result pass through. More... | |
| bool | is_using_thd_protocol () const |
| Check if thd protocol is used. More... | |
| void | set_thd_protocol () |
| Set either Protocol_local_v2 when m_use_thd_protocol is not set or or classical protocol when m_use_thd_protocol is set to THD. More... | |
| void | reset_thd_protocol () |
| Reset THD protocol. More... | |
| void | set_expected_charset (const char *charset_name) |
| Set the expected charset. More... | |
| const char * | get_expected_charset () |
| Get the expected charset. More... | |
| size_t | get_num_rows_per_fetch () |
| Get the num rows per fetch. More... | |
| void | set_num_rows_per_fetch (size_t num_rows_per_fetch) |
| Set the num of rows to be retrieved per fetch. More... | |
| virtual | ~Statement_handle () |
| Destroy the Statement_handle object. More... | |
Protected Member Functions | |
| void | send_statement_status () |
| Send statement execution status after execute(). More... | |
| void | add_result_set (Result_set *result_set) |
| void | set_result_set (Result_set *result_set) |
| void | copy_warnings () |
| Copy the warnings generated for the query from the diagnostics area. More... | |
| Statement_handle (const Statement_handle &)=delete | |
| Statement_handle (Statement_handle &&)=delete | |
| Statement_handle & | operator= (const Statement_handle &)=delete |
| Statement_handle & | operator= (Statement_handle &&)=delete |
Protected Attributes | |
| std::string | m_query |
| MEM_ROOT | m_warning_mem_root |
| Warning * | m_warnings |
| ulonglong | m_warnings_count = 0 |
| Diagnostics_area * | m_diagnostics_area |
| bool | m_clear_diagnostics_area_on_success {true} |
| Flag to indicate if diagnostics area should be cleared or retained on successful execution of a statement. More... | |
| THD * | m_thd |
| Result_set * | m_result_sets |
| Result_set * | m_current_rset |
| bool | m_use_thd_protocol = false |
| size_t | m_num_rows_per_fetch = 1 |
| CHARSET_INFO * | m_expected_charset |
| Protocol_local_v2 | m_protocol |
| Protocol * | m_saved_protocol {nullptr} |
Friends | |
| class | Protocol_local_v2 |
Statement_handle is similar to Ed_connection.
Some of the limitations in Ed_connection is that,
Above limitation leads to implementation of this interface.
Statement_handle supports both execution of regular and prepared statement.
Note that we can get rid of Ed_connection implementation as we support more functionality with Statement_handle.
| Statement_handle::Statement_handle | ( | THD * | thd, |
| const char * | query, | ||
| size_t | length | ||
| ) |
|
inlinevirtual |
Destroy the Statement_handle object.
|
protecteddelete |
|
protecteddelete |
|
protected |
|
inline |
Get value of a flag which indicates whether diagnostics area should be cleared on successful execution of a statement or not.
|
protected |
Copy the warnings generated for the query from the diagnostics area.
|
pure virtual |
Execute the SQL command.
This can be either Regular or Prepared statement.
Implemented in Regular_statement_handle, and Prepared_statement_handle.
| void Statement_handle::free_old_result | ( | ) |
Feel all the result collected so far, from query execution.
|
inline |
Get the capacity in bytes allowed for caching results.
|
inline |
Get the current result set object.
|
inline |
Get the expected charset.
|
inline |
Get the last mysql errno.
|
inline |
Check if error is reported.
|
inline |
Get the mysql error state.
|
inline |
Get the num rows per fetch.
|
inline |
Get the query string being executed.
|
inline |
Get the next result sets generated while executing the statement.
| auto Statement_handle::get_warnings | ( | ) |
Get list of all warnings.
|
inline |
Check if error is reported.
|
pure virtual |
Check if the statement has been executed or prepared.
Implemented in Regular_statement_handle, and Prepared_statement_handle.
|
pure virtual |
Check if we are processing a prepared statement.
Implemented in Regular_statement_handle, and Prepared_statement_handle.
|
inline |
Check if thd protocol is used.
|
inline |
Make the next result set the current result set.
We do it once we have read the current result set.
|
protecteddelete |
|
protecteddelete |
| void Statement_handle::reset_thd_protocol | ( | ) |
Reset THD protocol.
|
protected |
Send statement execution status after execute().
|
inline |
Set the capacity in bytes allowed for caching results.
| capacity | of the result set |
|
inline |
Set the flag to indicate clear diagnostics area on successful execution of a statement.
| clear_da | If false, the diagnostics area is not cleared on successful execution of a statement. Otherwise, the diagnostics area is cleared. |
|
inline |
Set the expected charset.
| charset_name | Name of the charset |
|
inline |
Set the num of rows to be retrieved per fetch.
| num_rows_per_fetch | number of rows per fetch |
|
protected |
| void Statement_handle::set_thd_protocol | ( | ) |
Set either Protocol_local_v2 when m_use_thd_protocol is not set or or classical protocol when m_use_thd_protocol is set to THD.
|
inline |
Set thd protocol to enable result pass through.
| use_thd_protocol | - parameter that decides if THD protocol should be used |
|
inline |
Get number of warnings generated.
|
friend |
|
protected |
Flag to indicate if diagnostics area should be cleared or retained on successful execution of a statement.
If retained, then user of this class should manage diagnostics area.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |