MySQL 9.7.0
Source Code Documentation
Packet_based_table_with_cursor< Impl_tp > Class Template Reference

Class to aid implementing a table with cursor ( Is_table_with_cursor) where the table data is represented in a mysql::abi_helpers::Packet_array object. More...

#include <packet_based_table_with_cursor.h>

Public Types

using Impl_t = Impl_tp
 Type of the implementation. More...
 
using Type_info_t = detail::Type_info_for_get_row_view_definition< Impl_t >
 Type of Row_view_definitions returned by the get_row_view_definition() member of Impl_t. More...
 

Public Member Functions

 Packet_based_table_with_cursor ()
 
 ~Packet_based_table_with_cursor ()
 
 Packet_based_table_with_cursor (const Packet_based_table_with_cursor &)=delete
 Delete copy/move semantics. More...
 
 Packet_based_table_with_cursor (Packet_based_table_with_cursor &&)=delete
 
Packet_based_table_with_cursoroperator= (const Packet_based_table_with_cursor &)=delete
 
Packet_based_table_with_cursoroperator= (Packet_based_table_with_cursor &&)=delete
 
void set_cursor (int row)
 Move the cursor to the given row number. More...
 
int get_cursor ()
 Return the current cursor (row number). More...
 
void advance ()
 Move the cursor to next row. More...
 
bool is_at_end () const
 
void copy_field (int index, PSI_field *field) const
 Copy the value of the given field index to the given PSI_field object. More...
 

Static Public Member Functions

static const char * get_table_name ()
 Return the table name. More...
 
static const char * get_table_definition ()
 Return the table definition. More...
 
static int get_approximate_row_count ()
 Return the cached approximate row count. More...
 

Static Private Member Functions

static std::atomic< int > & get_cached_approximate_row_count_ref ()
 Return a reference to an atomic integer that caches the row count for the last created object. More...
 

Private Attributes

Impl_t m_impl
 
Type_info_t::Table_t m_table
 Table object. More...
 
int m_cursor {0}
 Current cursor position. More...
 
Type_info_t::Row_proxy_t m_row_proxy
 Row proxy, containing a view over the current row. More...
 
bool m_cursor_dirty {true}
 True if the cursor has moved away from the row that m_row_proxy refers to. More...
 

Detailed Description

template<Is_packet_based_table_with_cursor_implementation Impl_tp>
class Packet_based_table_with_cursor< Impl_tp >

Class to aid implementing a table with cursor ( Is_table_with_cursor) where the table data is represented in a mysql::abi_helpers::Packet_array object.

Template Parameters
Impl_tpImplementation capable of returning the name, definition, and data for the table.

Member Typedef Documentation

◆ Impl_t

Type of the implementation.

◆ Type_info_t

Type of Row_view_definitions returned by the get_row_view_definition() member of Impl_t.

Constructor & Destructor Documentation

◆ Packet_based_table_with_cursor() [1/3]

◆ ~Packet_based_table_with_cursor()

◆ Packet_based_table_with_cursor() [2/3]

Delete copy/move semantics.

◆ Packet_based_table_with_cursor() [3/3]

Member Function Documentation

◆ advance()

void Packet_based_table_with_cursor< Impl_tp >::advance ( )
inline

Move the cursor to next row.

◆ copy_field()

void Packet_based_table_with_cursor< Impl_tp >::copy_field ( int  index,
PSI_field field 
) const
inline

Copy the value of the given field index to the given PSI_field object.

Parameters
indexThe column number
fieldThe output PSI_field.

◆ get_approximate_row_count()

static int Packet_based_table_with_cursor< Impl_tp >::get_approximate_row_count ( )
inlinestatic

Return the cached approximate row count.

◆ get_cached_approximate_row_count_ref()

static std::atomic< int > & Packet_based_table_with_cursor< Impl_tp >::get_cached_approximate_row_count_ref ( )
inlinestaticprivate

Return a reference to an atomic integer that caches the row count for the last created object.

(This could have been implemented as a static member variable. But that would be less convenient, since each specialization of this class template would have to provide a definition of the member variable in exactly one compilation unit. Using a function-local static variable, the variable gets automatically instantiated in each specialization of the function.)

◆ get_cursor()

int Packet_based_table_with_cursor< Impl_tp >::get_cursor ( )
inline

Return the current cursor (row number).

◆ get_table_definition()

static const char * Packet_based_table_with_cursor< Impl_tp >::get_table_definition ( )
inlinestatic

Return the table definition.

◆ get_table_name()

static const char * Packet_based_table_with_cursor< Impl_tp >::get_table_name ( )
inlinestatic

Return the table name.

◆ is_at_end()

bool Packet_based_table_with_cursor< Impl_tp >::is_at_end ( ) const
inline
Returns
true if the cursor is positioned at the end of the table.

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ set_cursor()

void Packet_based_table_with_cursor< Impl_tp >::set_cursor ( int  row)
inline

Move the cursor to the given row number.

Member Data Documentation

◆ m_cursor

int Packet_based_table_with_cursor< Impl_tp >::m_cursor {0}
private

Current cursor position.

◆ m_cursor_dirty

bool Packet_based_table_with_cursor< Impl_tp >::m_cursor_dirty {true}
mutableprivate

True if the cursor has moved away from the row that m_row_proxy refers to.

◆ m_impl

◆ m_row_proxy

Row proxy, containing a view over the current row.

This is capable of translating column index to an entry in the mysql::abi_helpers::Packet object for the current row, and of copying the value in that column to a PSI_field object.

Mutable, because it is updated lazily. The actual object state is represented by m_table and m_cursor.

◆ m_table


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