#include <srv_session.h>
◆ srv_session_state
Enum for the state of the session.
Enumerator |
---|
SRV_SESSION_CREATED | |
SRV_SESSION_OPENED | |
SRV_SESSION_ATTACHED | |
SRV_SESSION_DETACHED | |
SRV_SESSION_ASSOCIATE | |
SRV_SESSION_ASSOCIATED | |
SRV_SESSION_DISASSOCIATED | |
SRV_SESSION_CLOSED | |
◆ Srv_session() [1/3]
Constructs a server session.
That means This session object owns the THD.
- Note
- May throw if it fails to construct server session.
- Parameters
-
err_cb | Default completion callback |
err_cb_ctx | Plugin's context, opaque pointer that would be provided to callbacks. Might be NULL. |
◆ Srv_session() [2/3]
Have a THD object and wish to associate the same to session object.
Session object will use the thd. It won't own it.
- Parameters
-
err_cb | Default completion callback |
err_cb_ctx | Plugin's context, opaque pointer that would be provided to callbacks. Might be NULL. |
thd | A valid THD |
◆ ~Srv_session()
Srv_session::~Srv_session |
( |
| ) |
|
◆ Srv_session() [3/3]
Delegated constructor to intialize the members.
◆ associate()
bool Srv_session::associate |
( |
| ) |
|
|
private |
Installs the thd pointed by the session object as the current_thd.
- Returns
- false success true failure
◆ attach()
bool Srv_session::attach |
( |
| ) |
|
Attaches the session to the current physical thread.
- Returns
- false success true failure
◆ check_for_stale_threads()
void Srv_session::check_for_stale_threads |
( |
const st_plugin_int * |
plugin | ) |
|
|
static |
Checks if a plugin has left threads and sessions.
- Parameters
-
plugin | The plugin to be checked |
◆ close()
bool Srv_session::close |
( |
void |
| ) |
|
Closes the session.
- Returns
- false Session successfully closed true Session wasn't found or key doesn't match
-
false Session successfully closed true No such session exists / Session is attached to a different thread
◆ deinit_thread()
void Srv_session::deinit_thread |
( |
| ) |
|
|
static |
Deinitializes the current physical thread for use with session service.
Deinitializes physical thread to use with session service.
◆ detach()
bool Srv_session::detach |
( |
| ) |
|
Detaches the session from current physical thread.
Detaches the session from the current physical thread.
- Returns
- false success true failure
◆ disassociate()
bool Srv_session::disassociate |
( |
| ) |
|
|
private |
Uninstall the thd pointed by the session object as the current_thd.
- Returns
- false success true failure
◆ execute_command()
Executes a server command.
- Parameters
-
command | Command to be executed |
data | Command's arguments |
client_cs | The charset for the string data input (COM_QUERY for example) |
command_callbacks | Callbacks to be used by the server to encode data and to communicate with the client (plugin) side. |
text_or_binary | See enum cs_text_or_binary |
callbacks_context | Context passed to the callbacks |
- Returns
- 1 error 0 success
◆ get_client_port()
uint16_t Srv_session::get_client_port |
( |
| ) |
const |
|
inline |
Returns the client port.
- Note
- The client port in SHOW PROCESSLIST, INFORMATION_SCHEMA.PROCESSLIST. This port is NOT shown in PERFORMANCE_SCHEMA.THREADS.
◆ get_current_database()
LEX_CSTRING Srv_session::get_current_database |
( |
| ) |
const |
|
inline |
Returns the current database of a session.
- Note
- This call is not thread-safe. Don't invoke the method from a thread different than the one in which the invocation happens. This means that the call should NOT happen during run_command(). The value returned is valid until the next run_command() call, which may change it.
◆ get_session_id()
Returns the ID of a session.
The value returned from THD::thread_id()
◆ get_thd()
THD * Srv_session::get_thd |
( |
| ) |
|
|
inline |
Returns the internal THD object.
◆ init_thread()
bool Srv_session::init_thread |
( |
const void * |
plugin | ) |
|
|
static |
Initializes the current physical thread for use with this class.
Initializes physical thread to use with session service.
- Parameters
-
plugin | Pointer to the plugin structure, passed to the plugin over the plugin init function. |
- Returns
- false success true failure
◆ is_associate()
bool Srv_session::is_associate |
( |
| ) |
const |
|
private |
Check is the session state is associate.
In other words, session is using the THD provided explicitly.
- Returns
- true session state is associate false Otherwise
◆ is_associated()
bool Srv_session::is_associated |
( |
| ) |
const |
|
private |
Check if the session state is associated.
In other words, explicit thd which pointed by this, is installed
- Returns
- true session state is associated false Otherwise
◆ is_attached()
bool Srv_session::is_attached |
( |
| ) |
const |
|
inline |
Returns if the session is in attached state.
- Returns
- false Not attached true Attached
◆ is_srv_session_thread()
bool Srv_session::is_srv_session_thread |
( |
| ) |
|
|
static |
Check if current physical thread was created to be used with this class.
◆ is_valid()
bool Srv_session::is_valid |
( |
const Srv_session * |
session | ) |
|
|
static |
Checks if the session is valid.
Checked is if session is NULL, or in the list of opened sessions. If the session is not in this list it was either closed or the address is invalid.
- Returns
- true valid false not valid
Checked is if session is NULL, or the state of the session is SRV_SESSION_OPENED, SRV_SESSION_ATTACHED or SRV_SESSION_DETACHED.
- Returns
- true valid false not valid
◆ module_deinit()
bool Srv_session::module_deinit |
( |
| ) |
|
|
static |
Deinitializes the module.
Deinits the module.
This method has to be called at server shutdown.
- Returns
- false success true failure
Never fails
- Returns
- false success
◆ module_init()
bool Srv_session::module_init |
( |
| ) |
|
|
static |
Initializes the module.
Inits the module.
This method has to be called at server startup.
- Returns
- false success true failure
-
false success true failure
◆ open()
bool Srv_session::open |
( |
| ) |
|
Opens a server session.
- Returns
- session on success NULL on failure
-
false on success true on failure
◆ session_count()
unsigned int Srv_session::session_count |
( |
| ) |
|
|
static |
Returns the number opened sessions in thread initialized by this class.
◆ set_associate()
void Srv_session::set_associate |
( |
| ) |
|
|
private |
Changes the state of a session to associate.
◆ set_attached()
void Srv_session::set_attached |
( |
const char * |
stack | ) |
|
|
private |
Sets session's state to attached.
- Parameters
-
◆ set_client_port()
void Srv_session::set_client_port |
( |
uint16_t |
port | ) |
|
Sets the client port.
- Note
- The client port in SHOW PROCESSLIST, INFORMATION_SCHEMA.PROCESSLIST. This port is NOT shown in PERFORMANCE_SCHEMA.THREADS.
- Parameters
-
◆ set_connection_type()
Sets the connection type.
- See also
- enum_vio_type
- Note
- If NO_VIO_TYPE passed as type the call will fail.
- Returns
- false success true failure
- See also
- enum_vio_type
- Returns
- false success true failure
◆ set_detached()
void Srv_session::set_detached |
( |
| ) |
|
|
private |
Changes the state of a session to detached.
◆ set_disassociate()
void Srv_session::set_disassociate |
( |
| ) |
|
|
private |
Changes the state of a session to disassociate.
◆ thread_count()
unsigned int Srv_session::thread_count |
( |
const void * |
plugin_name | ) |
|
|
static |
Returns the number currently running threads initialized by this class.
◆ m_da
◆ m_err_protocol_ctx
◆ m_free_resources
const bool Srv_session::m_free_resources |
|
private |
◆ m_protocol_error
◆ m_state
◆ m_thd
◆ m_vio_type
The documentation for this class was generated from the following files: