24#ifndef MYSQL_STATEMENT_H
25#define MYSQL_STATEMENT_H
41#if defined(MYSQL_SERVER) || defined(PFS_DIRECT_CALL)
52#ifndef PSI_STATEMENT_CALL
53#define PSI_STATEMENT_CALL(M) psi_statement_service->M
56#ifndef PSI_DIGEST_CALL
57#define PSI_DIGEST_CALL(M) psi_statement_service->M
61#define PSI_STAGE_CALL(M) psi_stage_service->M
74#define mysql_statement_register(P1, P2, P3) \
75 inline_mysql_statement_register(P1, P2, P3)
77#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
78#define MYSQL_DIGEST_START(LOCKER) inline_mysql_digest_start(LOCKER)
80#define MYSQL_DIGEST_START(LOCKER) NULL
83#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
84#define MYSQL_DIGEST_END(LOCKER, DIGEST) inline_mysql_digest_end(LOCKER, DIGEST)
86#define MYSQL_DIGEST_END(LOCKER, DIGEST) \
91#ifdef HAVE_PSI_STATEMENT_INTERFACE
92#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \
93 inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, SPS, __FILE__, \
96#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) NULL
99#ifdef HAVE_PSI_STATEMENT_INTERFACE
100#define MYSQL_REFINE_STATEMENT(LOCKER, K) \
101 inline_mysql_refine_statement(LOCKER, K)
103#define MYSQL_REFINE_STATEMENT(LOCKER, K) NULL
106#ifdef HAVE_PSI_STATEMENT_INTERFACE
107#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
108 inline_mysql_set_statement_text(LOCKER, P1, P2)
110#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
115#ifdef HAVE_PSI_STATEMENT_INTERFACE
116#define MYSQL_SET_STATEMENT_QUERY_ID(LOCKER, P1) \
117 inline_mysql_set_statement_query_id(LOCKER, P1)
119#define MYSQL_SET_STATEMENT_QUERY_ID(LOCKER, P1) \
124#ifdef HAVE_PSI_STATEMENT_INTERFACE
125#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
126 inline_mysql_set_statement_lock_time(LOCKER, P1)
128#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
133#ifdef HAVE_PSI_STATEMENT_INTERFACE
134#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
135 inline_mysql_set_statement_rows_sent(LOCKER, P1)
137#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
142#ifdef HAVE_PSI_STATEMENT_INTERFACE
143#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
144 inline_mysql_set_statement_rows_examined(LOCKER, P1)
146#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
151#ifdef HAVE_PSI_STATEMENT_INTERFACE
152#define MYSQL_NOTIFY_STATEMENT_QUERY_ATTRIBUTES(LOCKER, P1) \
153 inline_mysql_notify_statement_query_attributes(LOCKER, P1)
155#define MYSQL_NOTIFY_STATEMENT_QUERY_ATTRIBUTES(LOCKER, P1) \
160#ifdef HAVE_PSI_STATEMENT_INTERFACE
161#define MYSQL_END_STATEMENT(LOCKER, DA) inline_mysql_end_statement(LOCKER, DA)
163#define MYSQL_END_STATEMENT(LOCKER, DA) \
172 const char *
category [[maybe_unused]],
void *info [[maybe_unused]],
173 int count [[maybe_unused]]
176#ifdef HAVE_PSI_STATEMENT_INTERFACE
181#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
186 if (
likely(locker !=
nullptr)) {
189 return digest_locker;
193#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
196 if (
likely(locker !=
nullptr)) {
202#ifdef HAVE_PSI_STATEMENT_INTERFACE
206 const char *src_file,
int src_line) {
210 if (
likely(locker !=
nullptr)) {
218 if (
likely(locker !=
nullptr)) {
227 if (
likely(locker !=
nullptr)) {
234 if (
likely(locker !=
nullptr)) {
241 if (
likely(locker !=
nullptr)) {
248 if (
likely(locker !=
nullptr)) {
255 if (
likely(locker !=
nullptr)) {
262 if (
likely(locker !=
nullptr)) {
264 (locker, with_query_attributes);
270#ifdef HAVE_PSI_STAGE_INTERFACE
273 if (
likely(locker !=
nullptr)) {
281 bool secondary [[maybe_unused]]) {
282#ifdef HAVE_PSI_STATEMENT_INTERFACE
283 if (
likely(locker !=
nullptr)) {
Stores status of the currently executed statement.
Definition: sql_error.h:269
#define PSI_STAGE_CALL(M)
Definition: psi_stage.h:36
#define PSI_STATEMENT_CALL(M)
Definition: psi_statement.h:36
struct PSI_digest_locker PSI_digest_locker
Definition: psi_statement_bits.h:112
unsigned int PSI_statement_key
Instrumented statement key.
Definition: psi_statement_bits.h:49
struct PSI_sp_share PSI_sp_share
Definition: psi_statement_bits.h:119
struct PSI_statement_locker PSI_statement_locker
Definition: psi_statement_bits.h:98
static void inline_mysql_set_statement_query_id(PSI_statement_locker *locker, ulonglong id)
Definition: mysql_statement.h:232
static struct PSI_statement_locker * inline_mysql_refine_statement(PSI_statement_locker *locker, PSI_statement_key key)
Definition: mysql_statement.h:216
static void inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker, ulonglong count)
Definition: mysql_statement.h:253
static void inline_mysql_set_statement_text(PSI_statement_locker *locker, const char *text, uint text_len)
Definition: mysql_statement.h:224
static void inline_mysql_digest_end(PSI_digest_locker *locker, const sql_digest_storage *digest)
Definition: mysql_statement.h:194
static struct PSI_digest_locker * inline_mysql_digest_start(PSI_statement_locker *locker)
Definition: mysql_statement.h:182
static void mysql_statement_set_secondary_engine(PSI_statement_locker *locker, bool secondary)
Definition: mysql_statement.h:279
static void inline_mysql_statement_register(const char *category, PSI_statement_info *info, int count)
Definition: mysql_statement.h:168
static void inline_mysql_end_statement(struct PSI_statement_locker *locker, Diagnostics_area *stmt_da)
Definition: mysql_statement.h:268
static void inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker, ulonglong count)
Definition: mysql_statement.h:246
static void inline_mysql_notify_statement_query_attributes(PSI_statement_locker *locker, bool with_query_attributes)
Definition: mysql_statement.h:260
static struct PSI_statement_locker * inline_mysql_start_statement(PSI_statement_locker_state *state, PSI_statement_key key, const char *db, uint db_len, const CHARSET_INFO *charset, PSI_sp_share *sp_share, const char *src_file, int src_line)
Definition: mysql_statement.h:203
static void inline_mysql_set_statement_lock_time(PSI_statement_locker *locker, ulonglong count)
Definition: mysql_statement.h:239
Header for compiler-dependent features.
constexpr bool likely(bool expr)
Definition: my_compiler.h:57
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:56
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
#define HAVE_PSI_STATEMENT_INTERFACE
Definition: my_psi_config.h:145
static int count
Definition: myisam_ftdump.cc:45
const std::string charset("charset")
static const char * category
Definition: sha2_password.cc:170
Performance schema instrumentation (declarations).
Performance schema instrumentation (declarations).
#define PSI_DIGEST_CALL(M)
Definition: pfs_statement_provider.h:51
Performance schema instrumentation interface.
Performance schema instrumentation interface.
required string key
Definition: replication_asynchronous_connection_failover.proto:60
Definition: m_ctype.h:423
Statement instrument information.
Definition: psi_statement_bits.h:133
State data storage for get_thread_statement_locker_v5_t.
Definition: psi_statement_bits.h:166
Structure to store token count/array for a statement on which digest is to be calculated.
Definition: sql_digest.h:98
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:510