|
| Prepared_statement_handle (THD *thd, const char *query, uint length) |
|
bool | prepare () |
| Prepares the statement using m_query. More...
|
|
bool | set_parameter (uint idx, bool is_null, enum_field_types type, bool is_unsigned, const void *data, unsigned long data_length, const char *name, unsigned long name_length) |
| Set the parameter value in a prepared statement. More...
|
|
Item_param * | get_parameter (size_t index) |
| Get the parameter object. More...
|
|
bool | execute () override |
| Execute the statement that is prepared. More...
|
|
bool | fetch () |
| Fetch rows from statement using cursor. More...
|
|
bool | is_cursor_open () |
| Check if the statement uses cursor and it is open. More...
|
|
bool | uses_cursor () |
| Check if the statement uses cursor. More...
|
|
bool | reset () |
| Reset the statement parameters and cursors. More...
|
|
bool | close () |
| Close the statement that is prepared. More...
|
|
uint | get_param_count () |
| Get number of parameters used in the statement. More...
|
|
bool | is_prepared_statement () override |
| Convey that this is prepared statement. More...
|
|
bool | is_executed_or_prepared () override |
| Check if the statement has been executed or prepared. More...
|
|
virtual | ~Prepared_statement_handle () override |
| Virtual destroy for Prepared_statement_handle object. More...
|
|
Public Member Functions inherited from Statement_handle |
| Statement_handle (THD *thd, const char *query, size_t length) |
|
bool | is_error () const |
| Check if error is reported. More...
|
|
const char * | get_last_error () |
| Check if error is reported. More...
|
|
unsigned int | get_last_errno () const |
| Get the last mysql errno. More...
|
|
const char * | 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...
|
|
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...
|
|
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...
|
|
Prepared_statement_handle enables support for prepared statement execution.
Supports parameters and cursors.
bool Prepared_statement_handle::execute |
( |
| ) |
|
|
overridevirtual |
Execute the statement that is prepared.
If a statement is not yet prepared, we fail.
If a statement was already in EXECUTED state, we close the cursor and execute the statement again.
- Returns
- true
-
false
Implements Statement_handle.
bool Prepared_statement_handle::fetch |
( |
| ) |
|
Fetch rows from statement using cursor.
Not all statement uses cursor. Check is_cursor_open() and then invoke this call.
Attempt to call fetch rows without preparing or executing the statement will cause failure.
Attempt to call fetch() without cursor in use, will cause failure.
- Returns
- true
-
false
template<typename Function >
bool Prepared_statement_handle::run |
( |
Function |
exec_func | ) |
|
|
private |
This is a wrapper function used to execute and operation on Prepared_statement.
This takes case of using relevant protocol, diagnostic area, backup the current query arena before executing the prepared statement operation.
- Template Parameters
-
Function | type of function to run |
- Parameters
-
- Returns
- true
-
false