MySQL 8.4.3
Source Code Documentation
sql_show_processlist.cc File Reference
#include <stddef.h>
#include "sql/sql_show_processlist.h"
#include "lex_string.h"
#include "sql/auth/auth_acls.h"
#include "sql/debug_sync.h"
#include "sql/item_cmpfunc.h"
#include "sql/item_func.h"
#include "sql/mem_root_array.h"
#include "sql/parse_tree_items.h"
#include "sql/parse_tree_nodes.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_lex.h"
#include "sql/sql_parse.h"
#include "sql/strfunc.h"
#include "sql_string.h"
#include "string_with_len.h"

Functions

static bool add_expression (const POS &pos, THD *thd, PT_select_item_list *item_list, const LEX_CSTRING &field, const LEX_CSTRING &alias)
 Build a replacement query for SHOW PROCESSLIST. More...
 
bool build_processlist_query (const POS &pos, THD *thd, bool verbose)
 

Variables

bool pfs_processlist_enabled = false
 Implement SHOW PROCESSLIST by using performance schema.processlist. More...
 
static const LEX_CSTRING field_id = {STRING_WITH_LEN("ID")}
 
static const LEX_CSTRING alias_id = {STRING_WITH_LEN("Id")}
 
static const LEX_CSTRING field_user = {STRING_WITH_LEN("USER")}
 
static const LEX_CSTRING alias_user = {STRING_WITH_LEN("User")}
 
static const LEX_CSTRING field_host = {STRING_WITH_LEN("HOST")}
 
static const LEX_CSTRING alias_host = {STRING_WITH_LEN("Host")}
 
static const LEX_CSTRING field_db = {STRING_WITH_LEN("DB")}
 
static const LEX_CSTRING alias_db = {STRING_WITH_LEN("db")}
 
static const LEX_CSTRING field_command = {STRING_WITH_LEN("COMMAND")}
 
static const LEX_CSTRING alias_command = {STRING_WITH_LEN("Command")}
 
static const LEX_CSTRING field_time = {STRING_WITH_LEN("TIME")}
 
static const LEX_CSTRING alias_time = {STRING_WITH_LEN("Time")}
 
static const LEX_CSTRING field_state = {STRING_WITH_LEN("STATE")}
 
static const LEX_CSTRING alias_state = {STRING_WITH_LEN("State")}
 
static const LEX_CSTRING field_info = {STRING_WITH_LEN("INFO")}
 
static const LEX_CSTRING alias_info = {STRING_WITH_LEN("Info")}
 
static const LEX_CSTRING pfs = {STRING_WITH_LEN("performance_schema")}
 
static const LEX_CSTRING table_processlist = {STRING_WITH_LEN("processlist")}
 
static const Query_options options
 

Function Documentation

◆ add_expression()

static bool add_expression ( const POS pos,
THD thd,
PT_select_item_list item_list,
const LEX_CSTRING field,
const LEX_CSTRING alias 
)
static

Build a replacement query for SHOW PROCESSLIST.

When the parser accepts the following syntax:

SHOW [FULL] PROCESSLIST

the parsed tree built for this query is in fact:

SELECT * FROM (SELECT ID Id, USER User, HOST Host, DB db, COMMAND Command, TIME Time, STATE State, LEFT(INFO, <info_len>) Info FROM performance_schema.processlist) AS show_processlist;

where info_len is 100 by default, otherwise 1024 for FULL PROCESSLIST.

MAINTAINER: This code builds a parsed tree for a query. Write the query to build in SQL first, then see turn_parser_debug_on() in sql_yacc.yy to understand which grammar actions are needed to build a parsed tree for this SQL query.

◆ build_processlist_query()

bool build_processlist_query ( const POS pos,
THD thd,
bool  verbose 
)

Variable Documentation

◆ alias_command

const LEX_CSTRING alias_command = {STRING_WITH_LEN("Command")}
static

◆ alias_db

const LEX_CSTRING alias_db = {STRING_WITH_LEN("db")}
static

◆ alias_host

const LEX_CSTRING alias_host = {STRING_WITH_LEN("Host")}
static

◆ alias_id

const LEX_CSTRING alias_id = {STRING_WITH_LEN("Id")}
static

◆ alias_info

const LEX_CSTRING alias_info = {STRING_WITH_LEN("Info")}
static

◆ alias_state

const LEX_CSTRING alias_state = {STRING_WITH_LEN("State")}
static

◆ alias_time

const LEX_CSTRING alias_time = {STRING_WITH_LEN("Time")}
static

◆ alias_user

const LEX_CSTRING alias_user = {STRING_WITH_LEN("User")}
static

◆ field_command

const LEX_CSTRING field_command = {STRING_WITH_LEN("COMMAND")}
static

◆ field_db

const LEX_CSTRING field_db = {STRING_WITH_LEN("DB")}
static

◆ field_host

const LEX_CSTRING field_host = {STRING_WITH_LEN("HOST")}
static

◆ field_id

const LEX_CSTRING field_id = {STRING_WITH_LEN("ID")}
static

◆ field_info

const LEX_CSTRING field_info = {STRING_WITH_LEN("INFO")}
static

◆ field_state

const LEX_CSTRING field_state = {STRING_WITH_LEN("STATE")}
static

◆ field_time

const LEX_CSTRING field_time = {STRING_WITH_LEN("TIME")}
static

◆ field_user

const LEX_CSTRING field_user = {STRING_WITH_LEN("USER")}
static

◆ options

const Query_options options
static
Initial value:
= {
0
}

◆ pfs

const LEX_CSTRING pfs = {STRING_WITH_LEN("performance_schema")}
static

◆ pfs_processlist_enabled

bool pfs_processlist_enabled = false

Implement SHOW PROCESSLIST by using performance schema.processlist.

◆ table_processlist

const LEX_CSTRING table_processlist = {STRING_WITH_LEN("processlist")}
static