MySQL  8.0.27
Source Code Documentation
srv_session_info_service.cc File Reference

Implementation of setters and getters of some properties of a session. More...

#include <stddef.h>
#include <stdint.h>
#include <atomic>
#include "lex_string.h"
#include "my_thread_local.h"
#include "sql/sql_class.h"
#include "sql/srv_session.h"
#include "violite.h"

Macros

#define VALID_SESSION(s)   ((s) && Srv_session::is_valid((s)))
 

Functions

THDsrv_session_info_get_thd (Srv_session *session)
 Returns the THD of a session. More...
 
my_thread_id srv_session_info_get_session_id (Srv_session *session)
 Returns the ID of a session. More...
 
uint16_t srv_session_info_get_client_port (Srv_session *session)
 Returns the client port of a session. More...
 
int srv_session_info_set_client_port (Srv_session *session, uint16_t port)
 Sets the client port of a session. More...
 
LEX_CSTRING srv_session_info_get_current_db (Srv_session *session)
 Returns the current database of a session. More...
 
int srv_session_info_set_connection_type (Srv_session *session, enum_vio_type type)
 Sets the connection type of a session. More...
 
int srv_session_info_killed (Srv_session *session)
 Returns whether the session was killed. More...
 
unsigned int srv_session_info_session_count ()
 Returns the number opened sessions in thread initialized by srv_session service. More...
 
unsigned int srv_session_info_thread_count (const void *plugin)
 Returns the number opened sessions in thread initialized by srv_session service. More...
 

Detailed Description

Implementation of setters and getters of some properties of a session.

Macro Definition Documentation

◆ VALID_SESSION

#define VALID_SESSION (   s)    ((s) && Srv_session::is_valid((s)))

Function Documentation

◆ srv_session_info_get_client_port()

uint16_t srv_session_info_get_client_port ( Srv_session session)

Returns the client port of a session.

Note
The client port in SHOW PROCESSLIST, INFORMATION_SCHEMA.PROCESSLIST. This port is NOT shown in PERFORMANCE_SCHEMA.THREADS.
Parameters
sessionSession

◆ srv_session_info_get_current_db()

LEX_CSTRING srv_session_info_get_current_db ( Srv_session session)

Returns the current database of a session.

Parameters
sessionSession

◆ srv_session_info_get_session_id()

my_thread_id srv_session_info_get_session_id ( Srv_session session)

Returns the ID of a session.

The value returned from THD::thread_id()

Parameters
sessionSession

◆ srv_session_info_get_thd()

THD* srv_session_info_get_thd ( Srv_session session)

Returns the THD of a session.

Parameters
sessionSession

◆ srv_session_info_killed()

int srv_session_info_killed ( Srv_session session)

Returns whether the session was killed.

Parameters
sessionSession
Returns
0 not killed 1 killed

◆ srv_session_info_session_count()

unsigned int srv_session_info_session_count ( )

Returns the number opened sessions in thread initialized by srv_session service.

◆ srv_session_info_set_client_port()

int srv_session_info_set_client_port ( Srv_session session,
uint16_t  port 
)

Sets the client port of a session.

Note
The client port in SHOW PROCESSLIST, INFORMATION_SCHEMA.PROCESSLIST. This port is NOT shown in PERFORMANCE_SCHEMA.THREADS.
Parameters
sessionSession
portPort number
Returns
0 success 1 failure

◆ srv_session_info_set_connection_type()

int srv_session_info_set_connection_type ( Srv_session session,
enum_vio_type  type 
)

Sets the connection type of a session.

See also
enum_vio_type
Note
If NO_VIO_TYPE passed as type the call will fail.
Returns
0 success 1 failure

◆ srv_session_info_thread_count()

unsigned int srv_session_info_thread_count ( const void *  plugin)

Returns the number opened sessions in thread initialized by srv_session service.

Parameters
pluginPointer to the plugin structure, passed to the plugin over the plugin init function.