MySQL  8.0.17
Source Code Documentation
test_sql_cmds_1.cc File Reference
#include <fcntl.h>
#include <mysql/plugin.h>
#include <mysql/service_srv_session_info.h>
#include <stdlib.h>
#include <sys/types.h>
#include <mysql/components/my_service.h>
#include <mysql/components/services/log_builtins.h>
#include <mysqld_error.h>
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "my_sys.h"
#include "sql_string.h"
#include "template_utils.h"
#include "thr_cond.h"

Classes

struct  Callback_data
 
struct  st_send_field_n
 
struct  Test_data
 

Macros

#define LOG_COMPONENT_TAG   "test_sql_cmds_1"
 
#define STRING_BUFFER   1024
 
#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_VAL (const char *format, T1 value1, T2 value2)
 
static void switch_user (MYSQL_SESSION session, const char *user)
 
static void ensure_api_ok (const char *function, int result)
 
static void ensure_api_not_null (const char *function, void *result)
 
static int sql_start_result_metadata (void *, uint num_cols, uint, const CHARSET_INFO *resultcs)
 
static int sql_field_metadata (void *, struct st_send_field *field, const CHARSET_INFO *)
 
static int sql_end_result_metadata (void *, uint, uint)
 
static int sql_start_row (void *)
 
static int sql_end_row (void *)
 
static void sql_abort_row (void *)
 
static ulong sql_get_client_capabilities (void *)
 
static int sql_get_null (void *)
 
static int sql_get_integer (void *, longlong)
 
static int sql_get_longlong (void *, longlong, uint)
 
static int sql_get_decimal (void *, const decimal_t *)
 
static int sql_get_double (void *, double, uint32)
 
static int sql_get_date (void *, const MYSQL_TIME *)
 
static int sql_get_time (void *, const MYSQL_TIME *, uint)
 
static int sql_get_datetime (void *, const MYSQL_TIME *, uint)
 
static int sql_get_string (void *, 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 *ctx, int shutdown_server)
 
static void test_com_query (void *p)
 
static int test_com_init_db (void *p)
 
static void * test_session_thread (Test_data *tdata)
 
static void session_error_cb (void *, unsigned int sql_errno, const char *err_msg)
 
static int test_query_kill (void *p)
 
static int test_com_process_kill (void *p)
 
static int test_priv (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 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...
 
static File outfile
 
static const char * user_localhost = "localhost"
 
static const char * user_local = "127.0.0.1"
 
static const char * user_db = ""
 
static const char * user_privileged = "root"
 
static const char * user_ordinary = "ordinary"
 
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][64]
 
int row_count = 0
 
char sql_str_value [64][64][256]
 
size_t sql_str_len [64][64]
 
const struct st_command_service_cbs sql_cbs
 
static const char * log_filename = "test_sql_cmds_1"
 
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_cmds_1"

◆ STRING_BUFFER

#define STRING_BUFFER   1024

◆ 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

◆ mysql_declare_plugin()

mysql_declare_plugin ( test_daemon  )

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

◆ sql_end_result_metadata()

static int sql_end_result_metadata ( void *  ,
uint  ,
uint   
)
static

◆ sql_end_row()

static int sql_end_row ( void *  )
static

◆ sql_field_metadata()

static int sql_field_metadata ( void *  ,
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 *  ,
const MYSQL_TIME  
)
static

◆ sql_get_datetime()

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

◆ sql_get_decimal()

static int sql_get_decimal ( void *  ,
const decimal_t  
)
static

◆ sql_get_double()

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

◆ sql_get_integer()

static int sql_get_integer ( void *  ,
longlong   
)
static

◆ sql_get_longlong()

static int sql_get_longlong ( void *  ,
longlong  ,
uint   
)
static

◆ sql_get_null()

static int sql_get_null ( void *  )
static

◆ sql_get_string()

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

◆ sql_get_time()

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

◆ sql_start_result_metadata()

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

◆ sql_start_row()

static int sql_start_row ( void *  )
static

◆ switch_user()

static void switch_user ( MYSQL_SESSION  session,
const char *  user 
)
static

◆ test_com_init_db()

static int test_com_init_db ( void *  p)
static

◆ test_com_process_kill()

static int test_com_process_kill ( void *  p)
static

◆ test_com_query()

static void test_com_query ( void *  p)
static

◆ test_priv()

static int test_priv ( void *  p)
static

◆ test_query_kill()

static int test_query_kill ( void *  p)
static

◆ test_session_thread()

static void* test_session_thread ( Test_data tdata)
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() [1/2]

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

◆ WRITE_VAL() [2/2]

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

Variable Documentation

◆ col_count

uint col_count = 0

◆ log_bi

const mysql_service_log_builtins_t* log_bi = nullptr

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_cmds_1"
static

◆ mysql_declare_plugin_end

mysql_declare_plugin_end

◆ outfile

File outfile
static

◆ reg_srv

const mysql_service_registry_t* reg_srv = nullptr
static

◆ row_count

int row_count = 0

◆ sep

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

◆ sql_cbs

const struct st_command_service_cbs sql_cbs
Initial value:
= {
}
static ulong sql_get_client_capabilities(void *)
Definition: test_sql_cmds_1.cc:220
static int sql_get_double(void *, double, uint32)
Definition: test_sql_cmds_1.cc:245
static void sql_shutdown(void *ctx, int shutdown_server)
Definition: test_sql_cmds_1.cc:306
static int sql_get_decimal(void *, const decimal_t *)
Definition: test_sql_cmds_1.cc:240
static int sql_get_null(void *)
Definition: test_sql_cmds_1.cc:225
static int sql_get_longlong(void *, longlong, uint)
Definition: test_sql_cmds_1.cc:235
static void sql_abort_row(void *)
Definition: test_sql_cmds_1.cc:215
static int sql_get_time(void *, const MYSQL_TIME *, uint)
Definition: test_sql_cmds_1.cc:255
static int sql_start_result_metadata(void *, uint num_cols, uint, const CHARSET_INFO *resultcs)
Definition: test_sql_cmds_1.cc:158
static int sql_end_row(void *)
Definition: test_sql_cmds_1.cc:209
static int sql_end_result_metadata(void *, uint, uint)
Definition: test_sql_cmds_1.cc:196
static int sql_get_datetime(void *, const MYSQL_TIME *, uint)
Definition: test_sql_cmds_1.cc:260
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_cmds_1.cc:277
static int sql_get_string(void *, const char *const value, size_t length, const CHARSET_INFO *const)
Definition: test_sql_cmds_1.cc:268
static void sql_handle_error(void *ctx, uint sql_errno, const char *const err_msg, const char *const sqlstate)
Definition: test_sql_cmds_1.cc:293
static int sql_get_date(void *, const MYSQL_TIME *)
Definition: test_sql_cmds_1.cc:250
static int sql_start_row(void *)
Definition: test_sql_cmds_1.cc:203
static int sql_field_metadata(void *, struct st_send_field *field, const CHARSET_INFO *)
Definition: test_sql_cmds_1.cc:170
static int sql_get_integer(void *, longlong)
Definition: test_sql_cmds_1.cc:230

◆ sql_field

st_send_field_n sql_field[64][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_str_len

size_t sql_str_len[64][64]

◆ sql_str_value

char sql_str_value[64][64][256]

◆ test_sql_service_plugin

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

◆ user_db

const char* user_db = ""
static

◆ user_local

const char* user_local = "127.0.0.1"
static

◆ user_localhost

const char* user_localhost = "localhost"
static

◆ user_ordinary

const char* user_ordinary = "ordinary"
static

◆ user_privileged

const char* user_privileged = "root"
static