MySQL 9.7.0
Source Code Documentation
detail::Table_handle_adaptor< Table_with_cursor_tp > Class Template Reference

Adaptor class that takes a table with cursor and provides an implementation of MySQL's handler interface. More...

#include <table_with_cursor.h>

Public Types

using Table_with_cursor_t = Table_with_cursor_tp
 
using Self_t = Table_handle_adaptor< Table_with_cursor_t >
 
using Cursor_t = decltype(std::declval< Table_with_cursor_t >().get_cursor())
 

Public Member Functions

 Table_handle_adaptor ()
 

Static Public Member Functions

static PFS_engine_table_share_proxyget_table_share ()
 

Private Member Functions

int do_rnd_init ()
 Member function implementing rnd_init. More...
 
int do_rnd_next ()
 Member function implementing rnd_next. More...
 
int do_rnd_pos ()
 Member function implementing rnd_pos. More...
 
void do_read_column_value (PSI_field *field, unsigned int index)
 Member function implementing read_column_value. More...
 
int status () const
 

Static Private Member Functions

static PFS_engine_table_share_proxyinit_table_share ()
 
static int rnd_init (PSI_table_handle *opaque_handle, bool)
 Implementation of PFS_engine_table_proxy::rnd_init, matching rnd_init_t. More...
 
static int rnd_next (PSI_table_handle *opaque_handle)
 Implementation of PFS_engine_table_proxy::rnd_next, matching rnd_next_t. More...
 
static int rnd_pos (PSI_table_handle *opaque_handle)
 Implementation of PFS_engine_table_proxy::rnd_pos, matching rnd_pos_t. More...
 
static int read_column_value (PSI_table_handle *opaque_handle, PSI_field *field, unsigned int index)
 Implementation of PFS_engine_table_proxy::read_column_value, matching read_column_value_t. More...
 
static unsigned long long get_row_count ()
 Implementation of PFS_engine_table_share_proxy::get_row_count, matching get_row_count_t. More...
 
static PSI_table_handleopen_table (PSI_pos **opaque_pos)
 Implementation of PFS_engine_table_proxy::open_table, matching open_table_t. More...
 
static void close_table (PSI_table_handle *opaque_handle)
 Implementation of PFS_engine_table_proxy::close_table, matching close_table_t. More...
 
static Self_tget_handle_adaptor (PSI_table_handle *opaque_handle)
 Cast point to PSI_table_handle to reference to Table_handle_adaptor. More...
 

Private Attributes

bool m_before_first_row {true}
 True if the current position is "one-before-the-first-row". More...
 
Table_with_cursor_t m_table_with_cursor {}
 Table_with_cursor object representing the table and the current cursor position. More...
 
Cursor_t m_begin_cursor
 Cursor to the first row. More...
 
Cursor_t m_current_cursor
 Current cursor. More...
 

Detailed Description

template<Is_table_with_cursor Table_with_cursor_tp>
class detail::Table_handle_adaptor< Table_with_cursor_tp >

Adaptor class that takes a table with cursor and provides an implementation of MySQL's handler interface.

Member Typedef Documentation

◆ Cursor_t

template<Is_table_with_cursor Table_with_cursor_tp>
using detail::Table_handle_adaptor< Table_with_cursor_tp >::Cursor_t = decltype(std::declval<Table_with_cursor_t>().get_cursor())

◆ Self_t

template<Is_table_with_cursor Table_with_cursor_tp>
using detail::Table_handle_adaptor< Table_with_cursor_tp >::Self_t = Table_handle_adaptor<Table_with_cursor_t>

◆ Table_with_cursor_t

template<Is_table_with_cursor Table_with_cursor_tp>
using detail::Table_handle_adaptor< Table_with_cursor_tp >::Table_with_cursor_t = Table_with_cursor_tp

Constructor & Destructor Documentation

◆ Table_handle_adaptor()

template<Is_table_with_cursor Table_with_cursor_tp>
detail::Table_handle_adaptor< Table_with_cursor_tp >::Table_handle_adaptor ( )
inline

Member Function Documentation

◆ close_table()

template<Is_table_with_cursor Table_with_cursor_tp>
static void detail::Table_handle_adaptor< Table_with_cursor_tp >::close_table ( PSI_table_handle opaque_handle)
inlinestaticprivate

Implementation of PFS_engine_table_proxy::close_table, matching close_table_t.

Parameters
opaque_handlePointer to Table_handle_adaptor object, cast to PSI_table_handle *.

◆ do_read_column_value()

template<Is_table_with_cursor Table_with_cursor_tp>
void detail::Table_handle_adaptor< Table_with_cursor_tp >::do_read_column_value ( PSI_field field,
unsigned int  index 
)
inlineprivate

Member function implementing read_column_value.

Parameters
fieldOpaque pointer to the output field.
indexThe column index.

◆ do_rnd_init()

template<Is_table_with_cursor Table_with_cursor_tp>
int detail::Table_handle_adaptor< Table_with_cursor_tp >::do_rnd_init ( )
inlineprivate

Member function implementing rnd_init.

Returns
PFS_HA_ERR_END_OF_FILE if the table is empty, 0 otherwise.

◆ do_rnd_next()

template<Is_table_with_cursor Table_with_cursor_tp>
int detail::Table_handle_adaptor< Table_with_cursor_tp >::do_rnd_next ( )
inlineprivate

Member function implementing rnd_next.

Returns
PFS_HA_ERR_END_OF_FILE if the new position is at the end of the table, 0 otherwise.

◆ do_rnd_pos()

template<Is_table_with_cursor Table_with_cursor_tp>
int detail::Table_handle_adaptor< Table_with_cursor_tp >::do_rnd_pos ( )
inlineprivate

Member function implementing rnd_pos.

Returns
PFS_HA_ERR_END_OF_FILE if the new position is at the end of the table, 0 otherwise.

◆ get_handle_adaptor()

template<Is_table_with_cursor Table_with_cursor_tp>
static Self_t & detail::Table_handle_adaptor< Table_with_cursor_tp >::get_handle_adaptor ( PSI_table_handle opaque_handle)
inlinestaticprivate

Cast point to PSI_table_handle to reference to Table_handle_adaptor.

Parameters
opaque_handlePSI_table_handle that actually is a pointer to a Table_handle_adaptor.
Returns
Reference to the Table_handle_adaptor pointed to by the parameter.

◆ get_row_count()

template<Is_table_with_cursor Table_with_cursor_tp>
static unsigned long long detail::Table_handle_adaptor< Table_with_cursor_tp >::get_row_count ( )
inlinestaticprivate

Implementation of PFS_engine_table_share_proxy::get_row_count, matching get_row_count_t.

Returns
The row count.

◆ get_table_share()

template<Is_table_with_cursor Table_with_cursor_tp>
static PFS_engine_table_share_proxy & detail::Table_handle_adaptor< Table_with_cursor_tp >::get_table_share ( )
inlinestatic

◆ init_table_share()

template<Is_table_with_cursor Table_with_cursor_tp>
static PFS_engine_table_share_proxy & detail::Table_handle_adaptor< Table_with_cursor_tp >::init_table_share ( )
inlinestaticprivate
Returns
PFS_engine_table_share_proxy initialized based on this class.

◆ open_table()

template<Is_table_with_cursor Table_with_cursor_tp>
static PSI_table_handle * detail::Table_handle_adaptor< Table_with_cursor_tp >::open_table ( PSI_pos **  opaque_pos)
inlinestaticprivate

Implementation of PFS_engine_table_proxy::open_table, matching open_table_t.

Parameters
opaque_posPointer to pointer to opaque "position". *opaque_pos will be set to point to the m_position member of the returned object.
Returns
Pointer to a new Table_handler_adaptor object, cast to PSI_table_handle *.

◆ read_column_value()

template<Is_table_with_cursor Table_with_cursor_tp>
static int detail::Table_handle_adaptor< Table_with_cursor_tp >::read_column_value ( PSI_table_handle opaque_handle,
PSI_field field,
unsigned int  index 
)
inlinestaticprivate

Implementation of PFS_engine_table_proxy::read_column_value, matching read_column_value_t.

Parameters
opaque_handlePointer to Table_handle_adaptor object, cast to PSI_table_handle *.
fieldPSI_field to which the value should be copied.
indexColumn number in the table.
Returns
0.

◆ rnd_init()

template<Is_table_with_cursor Table_with_cursor_tp>
static int detail::Table_handle_adaptor< Table_with_cursor_tp >::rnd_init ( PSI_table_handle opaque_handle,
bool   
)
inlinestaticprivate

Implementation of PFS_engine_table_proxy::rnd_init, matching rnd_init_t.

Parameters
opaque_handlePointer to Table_handle_adaptor object, cast to PSI_table_handle *.
Returns
PFS_HA_ERR_END_OF_FILE if table is empty, 0 otherwise.

◆ rnd_next()

template<Is_table_with_cursor Table_with_cursor_tp>
static int detail::Table_handle_adaptor< Table_with_cursor_tp >::rnd_next ( PSI_table_handle opaque_handle)
inlinestaticprivate

Implementation of PFS_engine_table_proxy::rnd_next, matching rnd_next_t.

Parameters
opaque_handlePointer to Table_handle_adaptor object, cast to PSI_table_handle *.
Returns
PFS_HA_ERR_END_OF_FILE if it reached end of the table, 0 otherwise.

◆ rnd_pos()

template<Is_table_with_cursor Table_with_cursor_tp>
static int detail::Table_handle_adaptor< Table_with_cursor_tp >::rnd_pos ( PSI_table_handle opaque_handle)
inlinestaticprivate

Implementation of PFS_engine_table_proxy::rnd_pos, matching rnd_pos_t.

Parameters
opaque_handlePointer to Table_handle_adaptor object, cast to PSI_table_handle *.
Returns
PFS_HA_ERR_END_OF_FILE if the position is at the end of the table, 0 otherwise.

◆ status()

template<Is_table_with_cursor Table_with_cursor_tp>
int detail::Table_handle_adaptor< Table_with_cursor_tp >::status ( ) const
inlineprivate
Returns
PFS_HA_ERR_END_OF_FILE if the position is at the end of the table, 0 otherwise.

Member Data Documentation

◆ m_before_first_row

template<Is_table_with_cursor Table_with_cursor_tp>
bool detail::Table_handle_adaptor< Table_with_cursor_tp >::m_before_first_row {true}
private

True if the current position is "one-before-the-first-row".

The caller expects that rnd_init followed by rnd_next positions the cursor on the first row, thus it has to be initially positioned at "one-before-the-first-row". Since Table_and_row does not have that concept, we identify the position using this flag.

◆ m_begin_cursor

template<Is_table_with_cursor Table_with_cursor_tp>
Cursor_t detail::Table_handle_adaptor< Table_with_cursor_tp >::m_begin_cursor
private

Cursor to the first row.

We capture this after initializing the object, and use it to implement rnd_init.

◆ m_current_cursor

template<Is_table_with_cursor Table_with_cursor_tp>
Cursor_t detail::Table_handle_adaptor< Table_with_cursor_tp >::m_current_cursor
private

Current cursor.

We set this in rnd_next and rnd_init, share the pointer to it with the Optimizer code in the output parameter for open_table, and allow Optimizer to alter it as it needs, as long as the alteration is followed by a call to rnd_pos.

◆ m_table_with_cursor

template<Is_table_with_cursor Table_with_cursor_tp>
Table_with_cursor_t detail::Table_handle_adaptor< Table_with_cursor_tp >::m_table_with_cursor {}
private

Table_with_cursor object representing the table and the current cursor position.


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