MySQL 8.0.39
Source Code Documentation
|
Materialized_cursor – an insensitive materialized server-side cursor. More...
Public Member Functions | |
Materialized_cursor (Query_result *result) | |
void | set_table (TABLE *table_arg) |
Bind a temporary table with a materialized cursor. More... | |
void | set_result (Query_result *result_arg) |
int | send_result_set_metadata (THD *thd, const mem_root_deque< Item * > &send_result_set_metadata) |
Preserve the original metadata to be sent to the client. More... | |
bool | is_open () const override |
bool | open (THD *) override |
bool | fetch (ulong num_rows) override |
Fetch up to the given number of rows from a materialized cursor. More... | |
void | close () override |
~Materialized_cursor () override | |
Public Member Functions inherited from Server_side_cursor | |
Server_side_cursor (Query_result *result_arg) | |
virtual | ~Server_side_cursor () |
Private Attributes | |
Query_expression | fake_query_expression |
A fake unit to supply to Query_result_send when fetching. More... | |
TABLE * | m_table {nullptr} |
Cursor to the table that contains the materialized result. More... | |
mem_root_deque< Item * > | item_list |
List of items to send to client, copy of original items, but created in the cursor object's mem_root. More... | |
ulong | fetch_limit {0} |
ulong | fetch_count {0} |
bool | is_rnd_inited {false} |
Additional Inherited Members | |
Static Public Member Functions inherited from Server_side_cursor | |
static void * | operator new (size_t size, MEM_ROOT *mem_root, const std::nothrow_t &=std::nothrow) noexcept |
static void | operator delete (void *, size_t) |
static void | operator delete (void *, MEM_ROOT *, const std::nothrow_t &) noexcept |
Public Attributes inherited from Server_side_cursor | |
MEM_ROOT | mem_root {key_memory_TABLE, 1024} |
For allocation of Handler objects for the temporary table. More... | |
Protected Attributes inherited from Server_side_cursor | |
Query_arena | m_arena |
Query_result * | m_result |
Row destination used for fetch. More... | |
Materialized_cursor – an insensitive materialized server-side cursor.
The result set of this cursor is saved in a temporary table at open. The cursor itself is simply an interface for the handler of the temporary table.
The materialized cursor is usually attached to a preparable statement through a query result object. The lifetime of the cursor is the same as the lifetime of the preparable statement. When the preparable statement is destroyed, the materialized cursor (including the temporary table) is also destroyed.
Materialized_cursor::Materialized_cursor | ( | Query_result * | result | ) |
|
override |
|
overridevirtual |
Implements Server_side_cursor.
|
overridevirtual |
Fetch up to the given number of rows from a materialized cursor.
Precondition: the cursor is open.
If the cursor points after the last row, the fetch will automatically close the cursor and not send any data (except the 'EOF' packet with SERVER_STATUS_LAST_ROW_SENT). This is an extra round trip and probably should be improved to return SERVER_STATUS_LAST_ROW_SENT along with the last row.
Implements Server_side_cursor.
|
inlineoverridevirtual |
Implements Server_side_cursor.
|
overridevirtual |
Implements Server_side_cursor.
int Materialized_cursor::send_result_set_metadata | ( | THD * | thd, |
const mem_root_deque< Item * > & | send_result_set_metadata | ||
) |
Preserve the original metadata to be sent to the client.
Initiate sending of the original metadata to the client (call Protocol::send_result_set_metadata()).
thd | Thread identifier. |
send_result_set_metadata | List of fields that would be sent. |
|
inline |
void Materialized_cursor::set_table | ( | TABLE * | table_arg | ) |
Bind a temporary table with a materialized cursor.
|
private |
A fake unit to supply to Query_result_send when fetching.
|
private |
|
private |
|
private |
|
private |
List of items to send to client, copy of original items, but created in the cursor object's mem_root.
Cursor to the table that contains the materialized result.