23#ifndef MYSQL_STATEMENT_H
24#define MYSQL_STATEMENT_H
40#if defined(MYSQL_SERVER) || defined(PFS_DIRECT_CALL)
51#ifndef PSI_STATEMENT_CALL
52#define PSI_STATEMENT_CALL(M) psi_statement_service->M
55#ifndef PSI_DIGEST_CALL
56#define PSI_DIGEST_CALL(M) psi_statement_service->M
60#define PSI_STAGE_CALL(M) psi_stage_service->M
73#define mysql_statement_register(P1, P2, P3) \
74 inline_mysql_statement_register(P1, P2, P3)
76#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
77#define MYSQL_DIGEST_START(LOCKER) inline_mysql_digest_start(LOCKER)
79#define MYSQL_DIGEST_START(LOCKER) NULL
82#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
83#define MYSQL_DIGEST_END(LOCKER, DIGEST) inline_mysql_digest_end(LOCKER, DIGEST)
85#define MYSQL_DIGEST_END(LOCKER, DIGEST) \
90#ifdef HAVE_PSI_STATEMENT_INTERFACE
91#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) \
92 inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, SPS, __FILE__, \
95#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS, SPS) NULL
98#ifdef HAVE_PSI_STATEMENT_INTERFACE
99#define MYSQL_REFINE_STATEMENT(LOCKER, K) \
100 inline_mysql_refine_statement(LOCKER, K)
102#define MYSQL_REFINE_STATEMENT(LOCKER, K) NULL
105#ifdef HAVE_PSI_STATEMENT_INTERFACE
106#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
107 inline_mysql_set_statement_text(LOCKER, P1, P2)
109#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
114#ifdef HAVE_PSI_STATEMENT_INTERFACE
115#define MYSQL_SET_STATEMENT_QUERY_ID(LOCKER, P1) \
116 inline_mysql_set_statement_query_id(LOCKER, P1)
118#define MYSQL_SET_STATEMENT_QUERY_ID(LOCKER, P1) \
123#ifdef HAVE_PSI_STATEMENT_INTERFACE
124#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
125 inline_mysql_set_statement_lock_time(LOCKER, P1)
127#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
132#ifdef HAVE_PSI_STATEMENT_INTERFACE
133#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
134 inline_mysql_set_statement_rows_sent(LOCKER, P1)
136#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
141#ifdef HAVE_PSI_STATEMENT_INTERFACE
142#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
143 inline_mysql_set_statement_rows_examined(LOCKER, P1)
145#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
150#ifdef HAVE_PSI_STATEMENT_INTERFACE
151#define MYSQL_NOTIFY_STATEMENT_QUERY_ATTRIBUTES(LOCKER, P1) \
152 inline_mysql_notify_statement_query_attributes(LOCKER, P1)
154#define MYSQL_NOTIFY_STATEMENT_QUERY_ATTRIBUTES(LOCKER, P1) \
159#ifdef HAVE_PSI_STATEMENT_INTERFACE
160#define MYSQL_END_STATEMENT(LOCKER, DA) inline_mysql_end_statement(LOCKER, DA)
162#define MYSQL_END_STATEMENT(LOCKER, DA) \
171 const char *
category [[maybe_unused]],
void *
info [[maybe_unused]],
172 int count [[maybe_unused]]
175#ifdef HAVE_PSI_STATEMENT_INTERFACE
180#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
185 if (
likely(locker !=
nullptr)) {
188 return digest_locker;
192#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
195 if (
likely(locker !=
nullptr)) {
201#ifdef HAVE_PSI_STATEMENT_INTERFACE
205 const char *src_file,
int src_line) {
209 if (
likely(locker !=
nullptr)) {
217 if (
likely(locker !=
nullptr)) {
226 if (
likely(locker !=
nullptr)) {
233 if (
likely(locker !=
nullptr)) {
240 if (
likely(locker !=
nullptr)) {
247 if (
likely(locker !=
nullptr)) {
254 if (
likely(locker !=
nullptr)) {
261 if (
likely(locker !=
nullptr)) {
263 (locker, with_query_attributes);
269#ifdef HAVE_PSI_STAGE_INTERFACE
272 if (
likely(locker !=
nullptr)) {
280 bool secondary [[maybe_unused]]) {
281#ifdef HAVE_PSI_STATEMENT_INTERFACE
282 if (
likely(locker !=
nullptr)) {
Stores status of the currently executed statement.
Definition: sql_error.h:268
#define PSI_STAGE_CALL(M)
Definition: psi_stage.h:35
#define PSI_STATEMENT_CALL(M)
Definition: psi_statement.h:35
struct PSI_digest_locker PSI_digest_locker
Definition: psi_statement_bits.h:111
unsigned int PSI_statement_key
Instrumented statement key.
Definition: psi_statement_bits.h:48
struct PSI_sp_share PSI_sp_share
Definition: psi_statement_bits.h:118
struct PSI_statement_locker PSI_statement_locker
Definition: psi_statement_bits.h:97
static void inline_mysql_set_statement_query_id(PSI_statement_locker *locker, ulonglong id)
Definition: mysql_statement.h:231
static struct PSI_statement_locker * inline_mysql_refine_statement(PSI_statement_locker *locker, PSI_statement_key key)
Definition: mysql_statement.h:215
static void inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker, ulonglong count)
Definition: mysql_statement.h:252
static void inline_mysql_set_statement_text(PSI_statement_locker *locker, const char *text, uint text_len)
Definition: mysql_statement.h:223
static void inline_mysql_digest_end(PSI_digest_locker *locker, const sql_digest_storage *digest)
Definition: mysql_statement.h:193
static struct PSI_digest_locker * inline_mysql_digest_start(PSI_statement_locker *locker)
Definition: mysql_statement.h:181
static void mysql_statement_set_secondary_engine(PSI_statement_locker *locker, bool secondary)
Definition: mysql_statement.h:278
static void inline_mysql_statement_register(const char *category, PSI_statement_info *info, int count)
Definition: mysql_statement.h:167
static void inline_mysql_end_statement(struct PSI_statement_locker *locker, Diagnostics_area *stmt_da)
Definition: mysql_statement.h:267
static void inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker, ulonglong count)
Definition: mysql_statement.h:245
static void inline_mysql_notify_statement_query_attributes(PSI_statement_locker *locker, bool with_query_attributes)
Definition: mysql_statement.h:259
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:202
static void inline_mysql_set_statement_lock_time(PSI_statement_locker *locker, ulonglong count)
Definition: mysql_statement.h:238
Header for compiler-dependent features.
constexpr bool likely(bool expr)
Definition: my_compiler.h:56
Some integer typedefs for easier portability.
unsigned long long int ulonglong
Definition: my_inttypes.h:55
Defines various enable/disable and HAVE_ macros related to the performance schema instrumentation sys...
#define HAVE_PSI_STATEMENT_INTERFACE
Definition: my_psi_config.h:143
static int count
Definition: myisam_ftdump.cc:44
const std::string charset("charset")
static const char * category
Definition: sha2_password.cc:169
Performance schema instrumentation (declarations).
Performance schema instrumentation (declarations).
#define PSI_DIGEST_CALL(M)
Definition: pfs_statement_provider.h:50
Performance schema instrumentation interface.
Performance schema instrumentation interface.
required string key
Definition: replication_asynchronous_connection_failover.proto:59
Definition: m_ctype.h:422
Statement instrument information.
Definition: psi_statement_bits.h:132
State data storage for get_thread_statement_locker_v5_t.
Definition: psi_statement_bits.h:165
Structure to store token count/array for a statement on which digest is to be calculated.
Definition: sql_digest.h:97
unsigned long id[MAX_DEAD]
Definition: xcom_base.cc:509