MySQL 8.0.29
Source Code Documentation
Materialized_cursor Class Referencefinal

Materialized_cursor – an insensitive materialized server-side cursor. More...

Inheritance diagram for Materialized_cursor:
[legend]

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...
 
TABLEtable {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_resultresult
 Row destination used for fetch. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Materialized_cursor()

Materialized_cursor::Materialized_cursor ( Query_result result)

◆ ~Materialized_cursor()

Materialized_cursor::~Materialized_cursor ( )
override

Member Function Documentation

◆ close()

void Materialized_cursor::close ( void  )
overridevirtual

Implements Server_side_cursor.

◆ fetch()

bool Materialized_cursor::fetch ( ulong  num_rows)
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.

◆ is_open()

bool Materialized_cursor::is_open ( ) const
inlineoverridevirtual

Implements Server_side_cursor.

◆ open()

bool Materialized_cursor::open ( THD thd)
overridevirtual

Implements Server_side_cursor.

◆ send_result_set_metadata()

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()).

Parameters
thdThread identifier.
send_result_set_metadataList of fields that would be sent.

◆ set_result()

void Materialized_cursor::set_result ( Query_result result_arg)
inline

◆ set_table()

void Materialized_cursor::set_table ( TABLE table_arg)

Bind a temporary table with a materialized cursor.

Member Data Documentation

◆ fake_query_expression

Query_expression Materialized_cursor::fake_query_expression
private

A fake unit to supply to Query_result_send when fetching.

◆ fetch_count

ulong Materialized_cursor::fetch_count {0}
private

◆ fetch_limit

ulong Materialized_cursor::fetch_limit {0}
private

◆ is_rnd_inited

bool Materialized_cursor::is_rnd_inited {false}
private

◆ item_list

mem_root_deque<Item *> Materialized_cursor::item_list
private

List of items to send to client, copy of original items, but created in the cursor object's mem_root.

◆ table

TABLE* Materialized_cursor::table {nullptr}
private

Cursor to the table that contains the materialized result.


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