MySQL  8.0.19
Source Code Documentation
test_sql_reset_connection.cc File Reference
#include <fcntl.h>
#include <mysql/plugin.h>
#include <stdlib.h>
#include <sys/types.h>
#include <memory>
#include <mysql/components/my_service.h>
#include <mysql/components/services/log_builtins.h>
#include <mysql/components/services/udf_registration.h>
#include <mysql/service_srv_session_info.h>
#include <mysqld_error.h>
#include "m_string.h"
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_sys.h"
#include "mysql_com.h"
#include "template_utils.h"

Classes

struct  st_send_field_n
 
struct  st_decimal_n
 
struct  st_plugin_ctx
 
struct  Thread_data
 

Macros

#define LOG_COMPONENT_TAG   "test_sql_reset_connection"
 
#define STRING_BUFFER   256
 
#define WRITE_SEP()   my_write(outfile, pointer_cast<const uchar *>(sep), strlen(sep), MYF(0))
 
#define ENSURE_API_OK(call)   ensure_api_ok(__FUNCTION__, (call));
 
#define ENSURE_API_NOT_NULL(call)   ensure_api_not_null(__FUNCTION__, (call));
 

Functions

static void WRITE_STR (const char *format)
 
template<typename T >
void WRITE_VAL (const char *format, T value)
 
template<typename T1 , typename T2 >
void WRITE_VAL2 (const char *format, T1 value1, T2 value2)
 
static int sql_start_result_metadata (void *ctx, uint num_cols, uint, const CHARSET_INFO *resultcs)
 
static int sql_field_metadata (void *ctx, struct st_send_field *field, const CHARSET_INFO *)
 
static int sql_end_result_metadata (void *ctx, uint server_status, uint warn_count)
 
static int sql_start_row (void *ctx)
 
static int sql_end_row (void *ctx)
 
static void sql_abort_row (void *ctx)
 
static ulong sql_get_client_capabilities (void *)
 
static int sql_get_null (void *ctx)
 
static int sql_get_integer (void *ctx, longlong value)
 
static int sql_get_longlong (void *ctx, longlong value, uint is_unsigned)
 
static int sql_get_decimal (void *ctx, const decimal_t *value)
 
static int sql_get_double (void *ctx, double value, uint32)
 
static int sql_get_date (void *ctx, const MYSQL_TIME *value)
 
static int sql_get_time (void *ctx, const MYSQL_TIME *value, uint)
 
static int sql_get_datetime (void *ctx, const MYSQL_TIME *value, uint)
 
static int sql_get_string (void *ctx, const char *const value, size_t length, const CHARSET_INFO *const)
 
static void sql_handle_ok (void *ctx, uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char *const message)
 
static void sql_handle_error (void *ctx, uint sql_errno, const char *const err_msg, const char *const sqlstate)
 
static void sql_shutdown (void *, int)
 
static const char * fieldtype2str (enum enum_field_types type)
 
static void get_data_str (struct st_plugin_ctx *pctx)
 
static void query_execute (MYSQL_SESSION session, st_plugin_ctx *pctx, const std::string &query)
 
static void * test_session_thread (void *ctxt)
 
void test_execute_in_thread (void *p, void(*proc)(void *p))
 
static void ensure_api_ok (const char *function, int result)
 
static void ensure_api_not_null (const char *function, void *result)
 
static void reset_connection (MYSQL_SESSION st_session, st_plugin_ctx *pctx)
 
static void session_error_cb (void *, unsigned int sql_errno, const char *err_msg)
 
static void test_com_reset_connection (void *p)
 
static void test_com_reset_connection_from_another_session (void *p)
 
static void test_sql (void *p)
 
static void create_log_file (const char *log_name)
 
static int test_sql_service_plugin_init (void *p)
 
static int test_sql_service_plugin_deinit (void *p)
 
 mysql_declare_plugin (test_daemon)
 

Variables

static File outfile
 
static const char * sep
 
static const mysql_service_registry_treg_srv = nullptr
 
const mysql_service_log_builtins_tlog_bi = nullptr
 accessor built-ins More...
 
const mysql_service_log_builtins_string_tlog_bs = nullptr
 string built-ins More...
 
const struct st_command_service_cbs sql_cbs
 
static const char * log_filename = "test_sql_reset_connection"
 
struct st_mysql_daemon test_sql_service_plugin
 
 mysql_declare_plugin_end
 

Macro Definition Documentation

◆ ENSURE_API_NOT_NULL

#define ENSURE_API_NOT_NULL (   call)    ensure_api_not_null(__FUNCTION__, (call));

◆ ENSURE_API_OK

#define ENSURE_API_OK (   call)    ensure_api_ok(__FUNCTION__, (call));

◆ LOG_COMPONENT_TAG

#define LOG_COMPONENT_TAG   "test_sql_reset_connection"

◆ STRING_BUFFER

#define STRING_BUFFER   256

◆ WRITE_SEP

#define WRITE_SEP ( )    my_write(outfile, pointer_cast<const uchar *>(sep), strlen(sep), MYF(0))

Function Documentation

◆ create_log_file()

static void create_log_file ( const char *  log_name)
static

◆ ensure_api_not_null()

static void ensure_api_not_null ( const char *  function,
void *  result 
)
static

◆ ensure_api_ok()

static void ensure_api_ok ( const char *  function,
int  result 
)
static

◆ fieldtype2str()

static const char* fieldtype2str ( enum enum_field_types  type)
static

◆ get_data_str()

static void get_data_str ( struct st_plugin_ctx pctx)
static

◆ mysql_declare_plugin()

mysql_declare_plugin ( test_daemon  )

◆ query_execute()

static void query_execute ( MYSQL_SESSION  session,
st_plugin_ctx pctx,
const std::string &  query 
)
static

◆ reset_connection()

static void reset_connection ( MYSQL_SESSION  st_session,
st_plugin_ctx pctx 
)
static

◆ session_error_cb()

static void session_error_cb ( void *  ,
unsigned int  sql_errno,
const char *  err_msg 
)
static

◆ sql_abort_row()

static void sql_abort_row ( void *  ctx)
static

◆ sql_end_result_metadata()

static int sql_end_result_metadata ( void *  ctx,
uint  server_status,
uint  warn_count 
)
static

◆ sql_end_row()

static int sql_end_row ( void *  ctx)
static

◆ sql_field_metadata()

static int sql_field_metadata ( void *  ctx,
struct st_send_field field,
const CHARSET_INFO  
)
static

◆ sql_get_client_capabilities()

static ulong sql_get_client_capabilities ( void *  )
static

◆ sql_get_date()

static int sql_get_date ( void *  ctx,
const MYSQL_TIME value 
)
static

◆ sql_get_datetime()

static int sql_get_datetime ( void *  ctx,
const MYSQL_TIME value,
uint   
)
static

◆ sql_get_decimal()

static int sql_get_decimal ( void *  ctx,
const decimal_t value 
)
static

◆ sql_get_double()

static int sql_get_double ( void *  ctx,
double  value,
uint32   
)
static

◆ sql_get_integer()

static int sql_get_integer ( void *  ctx,
longlong  value 
)
static

◆ sql_get_longlong()

static int sql_get_longlong ( void *  ctx,
longlong  value,
uint  is_unsigned 
)
static

◆ sql_get_null()

static int sql_get_null ( void *  ctx)
static

◆ sql_get_string()

static int sql_get_string ( void *  ctx,
const char *const  value,
size_t  length,
const CHARSET_INFO * const   
)
static

◆ sql_get_time()

static int sql_get_time ( void *  ctx,
const MYSQL_TIME value,
uint   
)
static

◆ sql_handle_error()

static void sql_handle_error ( void *  ctx,
uint  sql_errno,
const char *const  err_msg,
const char *const  sqlstate 
)
static

◆ sql_handle_ok()

static void sql_handle_ok ( void *  ctx,
uint  server_status,
uint  statement_warn_count,
ulonglong  affected_rows,
ulonglong  last_insert_id,
const char *const  message 
)
static

◆ sql_shutdown()

static void sql_shutdown ( void *  ,
int   
)
static

◆ sql_start_result_metadata()

static int sql_start_result_metadata ( void *  ctx,
uint  num_cols,
uint  ,
const CHARSET_INFO resultcs 
)
static

◆ sql_start_row()

static int sql_start_row ( void *  ctx)
static

◆ test_com_reset_connection()

static void test_com_reset_connection ( void *  p)
static

◆ test_com_reset_connection_from_another_session()

static void test_com_reset_connection_from_another_session ( void *  p)
static

◆ test_execute_in_thread()

void test_execute_in_thread ( void *  p,
void(*)(void *p proc 
)

◆ test_session_thread()

static void* test_session_thread ( void *  ctxt)
static

◆ test_sql()

static void test_sql ( void *  p)
static

◆ test_sql_service_plugin_deinit()

static int test_sql_service_plugin_deinit ( void *  p)
static

◆ test_sql_service_plugin_init()

static int test_sql_service_plugin_init ( void *  p)
static

◆ WRITE_STR()

static void WRITE_STR ( const char *  format)
static

◆ WRITE_VAL()

template<typename T >
void WRITE_VAL ( const char *  format,
value 
)

◆ WRITE_VAL2()

template<typename T1 , typename T2 >
void WRITE_VAL2 ( const char *  format,
T1  value1,
T2  value2 
)

Variable Documentation

◆ log_bi

const mysql_service_log_builtins_t* log_bi = nullptr

accessor built-ins

accessor built-ins

◆ log_bs

const mysql_service_log_builtins_string_t* log_bs = nullptr

string built-ins

◆ log_filename

const char* log_filename = "test_sql_reset_connection"
static

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ outfile

File outfile
static

◆ reg_srv

const mysql_service_registry_t* reg_srv = nullptr
static

◆ sep

const char* sep
static
Initial value:
=
"=======================================================================\n"

◆ sql_cbs

◆ test_sql_service_plugin

struct st_mysql_daemon test_sql_service_plugin
Initial value:
sql_get_integer
static int sql_get_integer(void *ctx, longlong value)
Definition: test_sql_reset_connection.cc:235
sql_handle_ok
static void sql_handle_ok(void *ctx, uint server_status, uint statement_warn_count, ulonglong affected_rows, ulonglong last_insert_id, const char *const message)
Definition: test_sql_reset_connection.cc:362
sql_start_row
static int sql_start_row(void *ctx)
Definition: test_sql_reset_connection.cc:197
sql_get_double
static int sql_get_double(void *ctx, double value, uint32)
Definition: test_sql_reset_connection.cc:281
sql_field_metadata
static int sql_field_metadata(void *ctx, struct st_send_field *field, const CHARSET_INFO *)
Definition: test_sql_reset_connection.cc:156
sql_get_longlong
static int sql_get_longlong(void *ctx, longlong value, uint is_unsigned)
Definition: test_sql_reset_connection.cc:249
sql_get_time
static int sql_get_time(void *ctx, const MYSQL_TIME *value, uint)
Definition: test_sql_reset_connection.cc:312
sql_abort_row
static void sql_abort_row(void *ctx)
Definition: test_sql_reset_connection.cc:211
sql_get_datetime
static int sql_get_datetime(void *ctx, const MYSQL_TIME *value, uint)
Definition: test_sql_reset_connection.cc:330
sql_shutdown
static void sql_shutdown(void *, int)
Definition: test_sql_reset_connection.cc:390
sql_get_date
static int sql_get_date(void *ctx, const MYSQL_TIME *value)
Definition: test_sql_reset_connection.cc:296
sql_start_result_metadata
static int sql_start_result_metadata(void *ctx, uint num_cols, uint, const CHARSET_INFO *resultcs)
Definition: test_sql_reset_connection.cc:143
sql_get_string
static int sql_get_string(void *ctx, const char *const value, size_t length, const CHARSET_INFO *const)
Definition: test_sql_reset_connection.cc:348
sql_get_client_capabilities
static ulong sql_get_client_capabilities(void *)
Definition: test_sql_reset_connection.cc:217
sql_get_decimal
static int sql_get_decimal(void *ctx, const decimal_t *value)
Definition: test_sql_reset_connection.cc:265
MYSQL_DAEMON_INTERFACE_VERSION
#define MYSQL_DAEMON_INTERFACE_VERSION
Definition: plugin.h:695
sql_end_row
static int sql_end_row(void *ctx)
Definition: test_sql_reset_connection.cc:204
sql_get_null
static int sql_get_null(void *ctx)
Definition: test_sql_reset_connection.cc:222
sql_end_result_metadata
static int sql_end_result_metadata(void *ctx, uint server_status, uint warn_count)
Definition: test_sql_reset_connection.cc:187
sql_handle_error
static void sql_handle_error(void *ctx, uint sql_errno, const char *const err_msg, const char *const sqlstate)
Definition: test_sql_reset_connection.cc:377