MySQL  8.0.15
Source Code Documentation
test_sql_9_sessions.cc File Reference
#include <mysql/plugin.h>
#include <stdlib.h>
#include "my_sys.h"

Classes

struct  st_send_field_n
 
struct  st_test_decimal_t
 
struct  st_test_date
 
struct  st_my_time
 
struct  st_my_datetime
 

Macros

#define LOG_COMPONENT_TAG   "test_sql_9_sessions"
 
#define STRING_BUFFER   256
 
#define WRITE_STR(format)
 
#define WRITE_VAL(format, value)
 
#define WRITE_VAL_2(format, value1, value2)
 

Functions

static int sql_start_result_metadata (void *ctx, uint num_cols, uint flags, const CHARSET_INFO *resultcs)
 
static int sql_field_metadata (void *ctx, struct st_send_field *field, const CHARSET_INFO *charset)
 
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 *ctx)
 
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 decimals)
 
static int sql_get_date (void *ctx, const MYSQL_TIME *value)
 
static int sql_get_time (void *ctx, const MYSQL_TIME *value, uint decimals)
 
static int sql_get_datetime (void *ctx, const MYSQL_TIME *value, uint decimals)
 
static int sql_get_string (void *ctx, const char *const value, size_t length, const CHARSET_INFO *const valuecs)
 
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 *ctx, int shutdown_server)
 
static const char * fieldtype2str (enum enum_field_types type)
 
static void get_data_str ()
 
static void handle_error ()
 
static void exec_test_cmd (MYSQL_SESSION session, const char *test_cmd, void *p)
 
int 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

File outfile
 
char buffer [STRING_BUFFER]
 
const CHARSET_INFOsql_resultcs = NULL
 
uint sql_num_meta_rows = 0
 
uint sql_num_rows = 0
 
uint col_count = 0
 
uint sql_num_cols = 0
 
uint sql_flags = 0
 
st_send_field_n sql_field [64]
 
MYSQL_SESSION session [9]
 
void * plugin_ctx = NULL
 
bool session_ret = false
 
bool fail = false
 
COM_DATA cmd
 
int row_count = 0
 
longlong test_int [64][64]
 
longlong test_longlong [64][64]
 
uint test_is_unsigned [64][64]
 
struct st_test_decimal_t test_decimal [64][64]
 
char test_dec_str [256][64][64]
 
double test_double [64][64]
 
uint32 test_decimals [64][64]
 
struct st_test_date test_date [64][64]
 
struct st_my_time test_time [64][64]
 
struct st_my_datetime test_datetime [64][64]
 
char sql_str_value [1024][64][64]
 
size_t sql_str_len [64][64]
 
uint sql_server_status = 0
 
char msg [1024]
 
uint sql_warn_count = 0
 
ulonglong sql_affected_rows = 0
 
uint sql_error = 0
 
char sql_errormsg [128]
 
char sql_state [64]
 
struct st_protocol_cbs sql_cbs
 
const st_protocol_cbs * p_sql_cbs = &sql_cbs
 
MYSQL_PROTOCOL select_prot
 
struct st_mysql_daemon test_sql_service_plugin
 
 mysql_declare_plugin_end
 

Macro Definition Documentation

◆ LOG_COMPONENT_TAG

#define LOG_COMPONENT_TAG   "test_sql_9_sessions"

◆ STRING_BUFFER

#define STRING_BUFFER   256

◆ WRITE_STR

#define WRITE_STR (   format)
Value:
snprintf(buffer, sizeof(buffer), "%s", format); \
my_write(outfile, (uchar *)buffer, strlen(buffer), MYF(0))
unsigned char uchar
Definition: my_inttypes.h:49
File outfile
Definition: test_sql_9_sessions.cc:42
char buffer[STRING_BUFFER]
Definition: test_sql_9_sessions.cc:57
#define MYF(v)
Definition: my_inttypes.h:131

◆ WRITE_VAL

#define WRITE_VAL (   format,
  value 
)
Value:
snprintf(buffer, sizeof(buffer), format, value); \
my_write(outfile, (uchar *)buffer, strlen(buffer), MYF(0))
unsigned char uchar
Definition: my_inttypes.h:49
File outfile
Definition: test_sql_9_sessions.cc:42
char buffer[STRING_BUFFER]
Definition: test_sql_9_sessions.cc:57
#define MYF(v)
Definition: my_inttypes.h:131
const string value("\"Value\"")

◆ WRITE_VAL_2

#define WRITE_VAL_2 (   format,
  value1,
  value2 
)
Value:
snprintf(buffer, sizeof(buffer), format, value1, value2); \
my_write(outfile, (uchar *)buffer, strlen(buffer), MYF(0))
unsigned char uchar
Definition: my_inttypes.h:49
File outfile
Definition: test_sql_9_sessions.cc:42
char buffer[STRING_BUFFER]
Definition: test_sql_9_sessions.cc:57
#define MYF(v)
Definition: my_inttypes.h:131

Function Documentation

◆ create_log_file()

static void create_log_file ( const char *  log_name)
static

◆ exec_test_cmd()

static void exec_test_cmd ( MYSQL_SESSION  session,
const char *  test_cmd,
void *  p 
)
static

◆ fieldtype2str()

static const char* fieldtype2str ( enum enum_field_types  type)
static

◆ get_data_str()

static void get_data_str ( )
static

◆ handle_error()

static void handle_error ( )
static

◆ mysql_declare_plugin()

mysql_declare_plugin ( test_daemon  )

◆ 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 charset 
)
static

◆ sql_get_client_capabilities()

static ulong sql_get_client_capabilities ( void *  ctx)
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  decimals 
)
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  decimals 
)
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  valuecs 
)
static

◆ sql_get_time()

static int sql_get_time ( void *  ctx,
const MYSQL_TIME value,
uint  decimals 
)
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 *  ctx,
int  shutdown_server 
)
static

◆ sql_start_result_metadata()

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

◆ sql_start_row()

static int sql_start_row ( void *  ctx)
static

◆ test_sql()

int test_sql ( void *  p)

◆ 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

Variable Documentation

◆ buffer

char buffer[STRING_BUFFER]

◆ cmd

COM_DATA cmd

◆ col_count

uint col_count = 0

◆ fail

bool fail = false

◆ msg

char msg[1024]

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ outfile

File outfile

◆ p_sql_cbs

const st_protocol_cbs* p_sql_cbs = &sql_cbs

◆ plugin_ctx

void* plugin_ctx = NULL

◆ row_count

int row_count = 0

◆ select_prot

MYSQL_PROTOCOL select_prot

◆ session

MYSQL_SESSION session[9]

◆ session_ret

bool session_ret = false

◆ sql_affected_rows

ulonglong sql_affected_rows = 0

◆ sql_cbs

struct st_protocol_cbs sql_cbs
Initial value:
static int sql_get_string(void *ctx, const char *const value, size_t length, const CHARSET_INFO *const valuecs)
Definition: test_sql_9_sessions.cc:272
static int sql_end_result_metadata(void *ctx, uint server_status, uint warn_count)
Definition: test_sql_9_sessions.cc:111
static int sql_get_double(void *ctx, double value, uint32 decimals)
Definition: test_sql_9_sessions.cc:192
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_9_sessions.cc:285
static void sql_shutdown(void *ctx, int shutdown_server)
Definition: test_sql_9_sessions.cc:314
static int sql_get_decimal(void *ctx, const decimal_t *value)
Definition: test_sql_9_sessions.cc:174
static void sql_handle_error(void *ctx, uint sql_errno, const char *const err_msg, const char *const sqlstate)
Definition: test_sql_9_sessions.cc:300
static int sql_end_row(void *ctx)
Definition: test_sql_9_sessions.cc:125
static int sql_get_null(void *ctx)
Definition: test_sql_9_sessions.cc:142
static int sql_start_result_metadata(void *ctx, uint num_cols, uint flags, const CHARSET_INFO *resultcs)
Definition: test_sql_9_sessions.cc:72
static int sql_start_row(void *ctx)
Definition: test_sql_9_sessions.cc:119
static int sql_get_datetime(void *ctx, const MYSQL_TIME *value, uint decimals)
Definition: test_sql_9_sessions.cc:254
static ulong sql_get_client_capabilities(void *ctx)
Definition: test_sql_9_sessions.cc:137
static int sql_field_metadata(void *ctx, struct st_send_field *field, const CHARSET_INFO *charset)
Definition: test_sql_9_sessions.cc:84
static int sql_get_longlong(void *ctx, longlong value, uint is_unsigned)
Definition: test_sql_9_sessions.cc:159
static void sql_abort_row(void *ctx)
Definition: test_sql_9_sessions.cc:131
static int sql_get_integer(void *ctx, longlong value)
Definition: test_sql_9_sessions.cc:149
static int sql_get_time(void *ctx, const MYSQL_TIME *value, uint decimals)
Definition: test_sql_9_sessions.cc:230
static int sql_get_date(void *ctx, const MYSQL_TIME *value)
Definition: test_sql_9_sessions.cc:207

◆ sql_error

uint sql_error = 0

◆ sql_errormsg

char sql_errormsg[128]

◆ sql_field

st_send_field_n sql_field[64]

◆ sql_flags

uint sql_flags = 0

◆ sql_num_cols

uint sql_num_cols = 0

◆ sql_num_meta_rows

uint sql_num_meta_rows = 0

◆ sql_num_rows

uint sql_num_rows = 0

◆ sql_resultcs

const CHARSET_INFO* sql_resultcs = NULL

◆ sql_server_status

uint sql_server_status = 0

◆ sql_state

char sql_state[64]

◆ sql_str_len

size_t sql_str_len[64][64]

◆ sql_str_value

char sql_str_value[1024][64][64]

◆ sql_warn_count

uint sql_warn_count = 0

◆ test_date

struct st_test_date test_date[64][64]

◆ test_datetime

struct st_my_datetime test_datetime[64][64]

◆ test_dec_str

char test_dec_str[256][64][64]

◆ test_decimal

struct st_test_decimal_t test_decimal[64][64]

◆ test_decimals

uint32 test_decimals[64][64]

◆ test_double

double test_double[64][64]

◆ test_int

longlong test_int[64][64]

◆ test_is_unsigned

uint test_is_unsigned[64][64]

◆ test_longlong

longlong test_longlong[64][64]

◆ test_sql_service_plugin

struct st_mysql_daemon test_sql_service_plugin
Initial value:
= {
#define MYSQL_DAEMON_INTERFACE_VERSION
Definition: plugin.h:672

◆ test_time

struct st_my_time test_time[64][64]