24#ifndef PACKET_BASED_TABLE_WITH_CURSOR_H
25#define PACKET_BASED_TABLE_WITH_CURSOR_H
44template <
class T1, auto T2, auto T3>
46 :
public std::true_type {};
51 Is_row_view_definition_helper<std::remove_cvref_t<Type>>
::value;
63 decltype(std::declval<Type>().get_row_view_definition())>;
70 Type::value_type::typecode_end,
71 std::tuple_size<Type>{}>;
110template <
class Impl_tp>
112 requires(
const Impl_tp const_impl) {
114 const_impl.get_row_view_definition()
116 { const_impl.get_table_name() } -> std::same_as<const char *>;
117 { const_impl.get_table_definition() } -> std::same_as<const char *>;
124 impl.get_table_data()
137template <Is_packet_based_table_with_cursor_implementation Impl_tp>
151 std::memory_order_relaxed);
170 return Impl_t::get_table_definition();
206 std::memory_order_relaxed);
221 static std::atomic<int>
counter{0};
Class to aid implementing a table with cursor ( Is_table_with_cursor) where the table data is represe...
Definition: packet_based_table_with_cursor.h:138
void advance()
Move the cursor to next row.
Definition: packet_based_table_with_cursor.h:183
bool m_cursor_dirty
True if the cursor has moved away from the row that m_row_proxy refers to.
Definition: packet_based_table_with_cursor.h:242
Packet_based_table_with_cursor(const Packet_based_table_with_cursor &)=delete
Delete copy/move semantics.
static const char * get_table_name()
Return the table name.
Definition: packet_based_table_with_cursor.h:166
Impl_tp Impl_t
Type of the implementation.
Definition: packet_based_table_with_cursor.h:141
Packet_based_table_with_cursor & operator=(const Packet_based_table_with_cursor &)=delete
Packet_based_table_with_cursor(Packet_based_table_with_cursor &&)=delete
static int get_approximate_row_count()
Return the cached approximate row count.
Definition: packet_based_table_with_cursor.h:204
static const char * get_table_definition()
Return the table definition.
Definition: packet_based_table_with_cursor.h:169
bool is_at_end() const
Definition: packet_based_table_with_cursor.h:189
Impl_t m_impl
Definition: packet_based_table_with_cursor.h:210
~Packet_based_table_with_cursor()
Definition: packet_based_table_with_cursor.h:154
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.
Definition: packet_based_table_with_cursor.h:220
Packet_based_table_with_cursor & operator=(Packet_based_table_with_cursor &&)=delete
void set_cursor(int row)
Move the cursor to the given row number.
Definition: packet_based_table_with_cursor.h:174
Type_info_t::Row_proxy_t m_row_proxy
Row proxy, containing a view over the current row.
Definition: packet_based_table_with_cursor.h:239
Packet_based_table_with_cursor()
Definition: packet_based_table_with_cursor.h:146
void copy_field(int index, PSI_field *field) const
Copy the value of the given field index to the given PSI_field object.
Definition: packet_based_table_with_cursor.h:194
int get_cursor()
Return the current cursor (row number).
Definition: packet_based_table_with_cursor.h:180
int m_cursor
Current cursor position.
Definition: packet_based_table_with_cursor.h:229
Type_info_t::Table_t m_table
Table object.
Definition: packet_based_table_with_cursor.h:226
Forward declaration.
Definition: row_proxy.h:142
void set_row(const typename Type_info_t::Row_t &row)
Make the proxy be a view over the given row.
Definition: row_proxy.h:168
void copy_field(int index, PSI_field *target) const
Copy the value of the given field of the current row to the target.
Definition: row_proxy.h:180
Ownership-agnostic array class, which is both trivial and standard-layout.
Definition: array_view.h:53
std::ptrdiff_t ssize() const
Definition: array_base.h:58
std::size_t size() const
Definition: array_base.h:55
Concept that identifies classes that correctly implement the requirements for classes used to impleme...
Definition: packet_based_table_with_cursor.h:111
True if Type is a const reference to a specialization of Row_view_definition.
Definition: packet_based_table_with_cursor.h:56
True if std::remove_cvref_t<Type> is a speciaization of Row_view_definition.
Definition: packet_based_table_with_cursor.h:50
uint counter
Definition: mysqlimport.cc:58
static PFS_engine_table_share_proxy table
Definition: pfs.cc:61
Definition: packet_based_table_with_cursor.h:36
std::remove_cvref_t< decltype(std::declval< Type >().get_row_view_definition())> Return_type_for_get_row_view_definition
The return type for the non-static member function Type::get_row_view_definition.
Definition: packet_based_table_with_cursor.h:63
bool index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:76
Definition: http_server_component.cc:34
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
struct PSI_field PSI_field
This is an opaque structure to denote field in plugin/component code.
Definition: pfs_plugin_table_service.h:93
std::array< Field_view_definition< Typecode_tp, typecode_end_tp >, column_count_tp > Row_view_definition
Description of the mapping between columns and field typecodes, for all columns in a table.
Definition: row_proxy.h:84
Aggregates type definitions and constants for a given typecode enum, end element of that enum,...
Definition: row_proxy.h:96
Helper to define Is_row_view_definition.
Definition: packet_based_table_with_cursor.h:41