MySQL 9.1.0
Source Code Documentation
ClassicProtocolState::SystemVariables Class Reference

system-variables as returned by the server. More...

#include <classic_protocol_state.h>

Public Types

using key_type = std::string
 
using key_view_type = std::string_view
 
using value_type = std::optional< std::string >
 
using iterator = std::map< key_type, value_type >::iterator
 
using const_iterator = std::map< key_type, value_type >::const_iterator
 

Public Member Functions

void set (key_type k, value_type v)
 set k to v. More...
 
std::optional< value_typefind (const key_view_type &k) const
 find 'k' in sytem-vars. More...
 
value_type get (const key_view_type &k) const
 get 'k' from system-vars. More...
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
bool empty () const
 check if there is no system-var. More...
 
void clear ()
 clear the system-vars. More...
 

Private Attributes

std::map< key_type, value_type, std::less<> > vars_
 

Detailed Description

system-variables as returned by the server.

can be queried from the server with:

  • SELECT @SESSION.{k}
  • SELECT @LOCAL.{k}

can be set on the server with:

  • SET k = v;
  • SET @SESSION.k = v;
  • SET @LOCAL.k = v;
  • SET SESSION k = v;
  • SET LOCAL k = v;

changes to system-vars on the server are returned via the sesssion-tracker for system-variables.

Member Typedef Documentation

◆ const_iterator

◆ iterator

◆ key_type

◆ key_view_type

◆ value_type

using ClassicProtocolState::SystemVariables::value_type = std::optional<std::string>

Member Function Documentation

◆ begin() [1/2]

iterator ClassicProtocolState::SystemVariables::begin ( )
inline

◆ begin() [2/2]

const_iterator ClassicProtocolState::SystemVariables::begin ( ) const
inline

◆ clear()

void ClassicProtocolState::SystemVariables::clear ( )
inline

clear the system-vars.

◆ empty()

bool ClassicProtocolState::SystemVariables::empty ( ) const
inline

check if there is no system-var.

◆ end() [1/2]

iterator ClassicProtocolState::SystemVariables::end ( )
inline

◆ end() [2/2]

const_iterator ClassicProtocolState::SystemVariables::end ( ) const
inline

◆ find()

std::optional< value_type > ClassicProtocolState::SystemVariables::find ( const key_view_type k) const
inline

find 'k' in sytem-vars.

Parameters
kkey

if 'k' does not exist in system-vars, a NULL-like value is returned. otherwise return the value for the system-var referenced by 'k'

Returns
std::nullopt if key is not found, the found value otherwise.

◆ get()

value_type ClassicProtocolState::SystemVariables::get ( const key_view_type k) const
inline

get 'k' from system-vars.

Parameters
kkey

if 'k' does not exist in system-vars, a NULL-like value is returned. otherwise return the value for the system-var referenced by 'k' which may be NULL-like or a string.

Returns
std::nullopt if key is not found or value is NULL-like, the found value otherwise

◆ set()

void ClassicProtocolState::SystemVariables::set ( key_type  k,
value_type  v 
)
inline

set k to v.

if k doesn't exist in the system-vars yet, it gets inserted.

Member Data Documentation

◆ vars_

std::map<key_type, value_type, std::less<> > ClassicProtocolState::SystemVariables::vars_
private

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