MySQL 9.7.0
Source Code Documentation
Row_proxy< Typecode_tp, typecode_end_tp, column_count_tp > Class Template Reference

Forward declaration. More...

#include <row_proxy.h>

Public Types

using Type_info_t = Row_proxy_type_info< Typecode_tp, typecode_end_tp, column_count_tp >
 

Public Member Functions

 Row_proxy (const typename Type_info_t::Row_view_definition_t &row_proxy_definition)
 Construct a new Row_proxy for rows in a table whose schema is described by the given Type_info_t::Row_view_definition_t. More...
 
void clear ()
 Make the proxy be a view over an "empty" row, which has NULL in all nullable fields and 0/"" in non-nullable fields. More...
 
void set_row (const typename Type_info_t::Row_t &row)
 Make the proxy be a view over the given row. More...
 
void copy_field (int index, PSI_field *target) const
 Copy the value of the given field of the current row to the target. More...
 

Private Attributes

const Type_info_t::Row_view_definition_tm_row_proxy_definition
 Array where the Nth entry is the definition of the Nth column. More...
 
const Type_info_t::Field_tm_field_by_typecode [Type_info_t::typecode_end]
 Current map from m_type code to row value. More...
 

Detailed Description

template<class Typecode_tp, Typecode_tp typecode_end_tp, std::size_t column_count_tp>
requires requires
class Row_proxy< Typecode_tp, typecode_end_tp, column_count_tp >

Forward declaration.

Fills values in fields in a table row, using an Array_view<Field<Typecode_tp>> as data source (in namespace mysql::abi_helpers), for a given enum type Typecode_tp.

This does not copy or allocate data; internally it only holds fixed-size arrays that map column numbers to type codes in the enum type, and in turn each type code to a field in the row. Using this information, when queried with a column index and a PSI_field, it fills the PSI_field with the correct value from the source data.

The object is meant to be reused for multiple queries to the same table. At construction time, it creates the map associating column number with type code, and for each row the user gives, it recreates the map from type codes to field data.

Template Parameters
Typecode_tpenum type that identifies each column, used in the template argument of Field.
typecode_end_tpenum item whose numeric value is greater than the largest enum value that represents a field in a packet.
column_count_tpThe number of columns in the table.

Member Typedef Documentation

◆ Type_info_t

template<class Typecode_tp , Typecode_tp typecode_end_tp, std::size_t column_count_tp>
using Row_proxy< Typecode_tp, typecode_end_tp, column_count_tp >::Type_info_t = Row_proxy_type_info<Typecode_tp, typecode_end_tp, column_count_tp>

Constructor & Destructor Documentation

◆ Row_proxy()

template<class Typecode_tp , Typecode_tp typecode_end_tp, std::size_t column_count_tp>
Row_proxy< Typecode_tp, typecode_end_tp, column_count_tp >::Row_proxy ( const typename Type_info_t::Row_view_definition_t row_proxy_definition)
inline

Construct a new Row_proxy for rows in a table whose schema is described by the given Type_info_t::Row_view_definition_t.

Parameters
row_proxy_definitionDescription of table definition and packet layout. This is an std::array with column_count_tp elements, each representing a table column. Each element has three members: the typecode of the packet where the field value is found; the typecode of the packet holding a boolean that indicates whether the value is NULL; and the SQL data type.
See also
Field_view_definition .

Member Function Documentation

◆ clear()

template<class Typecode_tp , Typecode_tp typecode_end_tp, std::size_t column_count_tp>
void Row_proxy< Typecode_tp, typecode_end_tp, column_count_tp >::clear ( )
inline

Make the proxy be a view over an "empty" row, which has NULL in all nullable fields and 0/"" in non-nullable fields.

◆ copy_field()

template<class Typecode_tp , Typecode_tp typecode_end_tp, std::size_t column_count_tp>
void Row_proxy< Typecode_tp, typecode_end_tp, column_count_tp >::copy_field ( int  index,
PSI_field target 
) const
inline

Copy the value of the given field of the current row to the target.

Parameters
indexThe column index.
targetOpaque pointer (PSI_field *) to the target field.

If more types are needed, see e.g. plugin/replication_observers_example/src/binlog/service/iterator/tests/pfs.cc

◆ set_row()

template<class Typecode_tp , Typecode_tp typecode_end_tp, std::size_t column_count_tp>
void Row_proxy< Typecode_tp, typecode_end_tp, column_count_tp >::set_row ( const typename Type_info_t::Row_t row)
inline

Make the proxy be a view over the given row.

Parameters
rowObject holding values for all fields in this row.

Member Data Documentation

◆ m_field_by_typecode

template<class Typecode_tp , Typecode_tp typecode_end_tp, std::size_t column_count_tp>
const Type_info_t::Field_t* Row_proxy< Typecode_tp, typecode_end_tp, column_count_tp >::m_field_by_typecode[Type_info_t::typecode_end]
private

Current map from m_type code to row value.

◆ m_row_proxy_definition

template<class Typecode_tp , Typecode_tp typecode_end_tp, std::size_t column_count_tp>
const Type_info_t::Row_view_definition_t& Row_proxy< Typecode_tp, typecode_end_tp, column_count_tp >::m_row_proxy_definition
private

Array where the Nth entry is the definition of the Nth column.


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