MySQL  8.0.18
Source Code Documentation
service_srv_session.h File Reference

Header file for the Server session service. More...

#include "mysql/plugin.h"

Go to the source code of this file.

Classes

struct  srv_session_service_st
 

Typedefs

typedef class Srv_sessionMYSQL_SESSION
 
typedef void(* srv_session_error_cb) (void *ctx, unsigned int sql_errno, const char *err_msg)
 

Functions

int srv_session_init_thread (const void *plugin)
 Initializes the current physical thread to use with session service. More...
 
void srv_session_deinit_thread ()
 Deinitializes the current physical thread to use with session service. More...
 
MYSQL_SESSION srv_session_open (srv_session_error_cb error_cb, void *plugin_ctx)
 Opens a server session. More...
 
int srv_session_detach (MYSQL_SESSION session)
 Detaches a session from current physical thread. More...
 
int srv_session_close (MYSQL_SESSION session)
 Closes a previously opened session. More...
 
int srv_session_server_is_available ()
 Returns if the server is available (not booting or shutting down) More...
 
int srv_session_attach (MYSQL_SESSION session, MYSQL_THD *ret_previous_thd)
 Attaches a session to current physical thread. More...
 

Variables

struct srv_session_service_stsrv_session_service
 

Detailed Description

Header file for the Server session service.

This service is to provide of creating sessions with the server. These sessions can be furtherly used together with the Command service to execute commands in the server.

Typedef Documentation

◆ MYSQL_SESSION

typedef class Srv_session* MYSQL_SESSION

◆ srv_session_error_cb

typedef void(* srv_session_error_cb) (void *ctx, unsigned int sql_errno, const char *err_msg)

Function Documentation

◆ srv_session_attach()

int srv_session_attach ( MYSQL_SESSION  session,
MYSQL_THD ret_previous_thd 
)

Attaches a session to current physical thread.

Previously attached THD is detached and returned through ret_previous_thd. THD associated with session is attached.

Parameters
sessionSession to attach
Returns
0 success 1 failure

Attaches a session to current physical thread.

Parameters
sessionSession handle to attach
ret_previous_thdPreviously attached THD
Returns
0 success 1 failure

◆ srv_session_close()

int srv_session_close ( MYSQL_SESSION  session)

Closes a previously opened session.

Parameters
sessionSession to close
Returns
0 success 1 failure

◆ srv_session_deinit_thread()

void srv_session_deinit_thread ( )

Deinitializes the current physical thread to use with session service.

Call this function ONLY in physical threads which were initialized using srv_session_init_thread().

Deinitializes the current physical thread to use with session service.

◆ srv_session_detach()

int srv_session_detach ( MYSQL_SESSION  session)

Detaches a session from current physical thread.

Detaches a previously session. Which can only occur when the MYSQL_SESSION was manually attached by "srv_session_attach". Other srv_session calls automatically attached/detached the THD when the MYSQL_SESSION is used (for example command_service_run_command()).

Parameters
sessionSession to detach
Returns
0 success 1 failure

◆ srv_session_init_thread()

int srv_session_init_thread ( const void *  plugin)

Initializes the current physical thread to use with session service.

Call this function ONLY in physical threads which are not initialized in any way by the server.

Parameters
pluginPointer to the plugin structure, passed to the plugin over the plugin init function.
Returns
0 success 1 failure

Initializes the current physical thread to use with session service.

Returns
0 success 1 failure

◆ srv_session_open()

MYSQL_SESSION srv_session_open ( srv_session_error_cb  error_cb,
void *  plugin_ctx 
)

Opens a server session.

In a thread not initialized by the server itself, this function should be called only after srv_session_init_thread() has already been called.

Parameters
error_cbsession error callback
plugin_ctxPlugin's context, opaque pointer that would be provided to callbacks. Might be NULL.
Returns
session on success NULL on failure

Opens a server session.

Parameters
error_cbDefault completion callback
plugin_ctxPlugin's context, opaque pointer that would be provided to callbacks. Might be NULL.
Returns
handler of session on success NULL on failure

◆ srv_session_server_is_available()

int srv_session_server_is_available ( )

Returns if the server is available (not booting or shutting down)

Returns
0 not available 1 available

Variable Documentation

◆ srv_session_service

struct srv_session_service_st * srv_session_service