16 #ifndef MYSQL_STATEMENT_H
17 #define MYSQL_STATEMENT_H
36 #ifdef HAVE_PSI_STATEMENT_INTERFACE
37 #define mysql_statement_register(P1, P2, P3) \
38 inline_mysql_statement_register(P1, P2, P3)
40 #define mysql_statement_register(P1, P2, P3) \
44 #ifdef HAVE_PSI_STATEMENT_INTERFACE
45 #ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
46 #define MYSQL_DIGEST_START(LOCKER) \
47 inline_mysql_digest_start(LOCKER)
49 #define MYSQL_DIGEST_START(LOCKER) \
53 #define MYSQL_DIGEST_START(LOCKER) \
57 #ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
58 #define MYSQL_ADD_TOKEN(LOCKER, T, Y) \
59 inline_mysql_add_token(LOCKER, T, Y)
61 #define MYSQL_ADD_TOKEN(LOCKER, T, Y) \
65 #ifdef HAVE_PSI_STATEMENT_INTERFACE
66 #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
67 inline_mysql_start_statement(STATE, K, DB, DB_LEN, CS, __FILE__, __LINE__)
69 #define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN, CS) \
73 #ifdef HAVE_PSI_STATEMENT_INTERFACE
74 #define MYSQL_REFINE_STATEMENT(LOCKER, K) \
75 inline_mysql_refine_statement(LOCKER, K)
77 #define MYSQL_REFINE_STATEMENT(LOCKER, K) \
81 #ifdef HAVE_PSI_STATEMENT_INTERFACE
82 #define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
83 inline_mysql_set_statement_text(LOCKER, P1, P2)
85 #define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
89 #ifdef HAVE_PSI_STATEMENT_INTERFACE
90 #define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
91 inline_mysql_set_statement_lock_time(LOCKER, P1)
93 #define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
97 #ifdef HAVE_PSI_STATEMENT_INTERFACE
98 #define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
99 inline_mysql_set_statement_rows_sent(LOCKER, P1)
101 #define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
105 #ifdef HAVE_PSI_STATEMENT_INTERFACE
106 #define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
107 inline_mysql_set_statement_rows_examined(LOCKER, P1)
109 #define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
113 #ifdef HAVE_PSI_STATEMENT_INTERFACE
114 #define MYSQL_END_STATEMENT(LOCKER, DA) \
115 inline_mysql_end_statement(LOCKER, DA)
117 #define MYSQL_END_STATEMENT(LOCKER, DA) \
121 #ifdef HAVE_PSI_STATEMENT_INTERFACE
122 static inline void inline_mysql_statement_register(
123 const char *category, PSI_statement_info *info,
int count)
125 PSI_STATEMENT_CALL(register_statement)(category, info, count);
128 #ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
129 static inline struct PSI_digest_locker *
130 inline_mysql_digest_start(PSI_statement_locker *locker)
132 PSI_digest_locker* digest_locker= NULL;
134 if (likely(locker != NULL))
135 digest_locker= PSI_STATEMENT_CALL(digest_start)(locker);
136 return digest_locker;
140 #ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
141 static inline struct PSI_digest_locker *
142 inline_mysql_add_token(PSI_digest_locker *locker, uint token,
145 if (likely(locker != NULL))
146 locker= PSI_STATEMENT_CALL(digest_add_token)(locker, token,
147 (OPAQUE_LEX_YYSTYPE*)yylval);
152 static inline struct PSI_statement_locker *
153 inline_mysql_start_statement(PSI_statement_locker_state *state,
154 PSI_statement_key key,
155 const char *db, uint db_len,
157 const char *src_file,
int src_line)
159 PSI_statement_locker *locker;
160 locker= PSI_STATEMENT_CALL(get_thread_statement_locker)(state, key, charset);
161 if (likely(locker != NULL))
162 PSI_STATEMENT_CALL(start_statement)(locker, db, db_len, src_file, src_line);
166 static inline struct PSI_statement_locker *
167 inline_mysql_refine_statement(PSI_statement_locker *locker,
168 PSI_statement_key key)
170 if (likely(locker != NULL))
172 locker= PSI_STATEMENT_CALL(refine_statement)(locker, key);
178 inline_mysql_set_statement_text(PSI_statement_locker *locker,
179 const char *text, uint text_len)
181 if (likely(locker != NULL))
183 PSI_STATEMENT_CALL(set_statement_text)(locker, text, text_len);
188 inline_mysql_set_statement_lock_time(PSI_statement_locker *locker,
191 if (likely(locker != NULL))
193 PSI_STATEMENT_CALL(set_statement_lock_time)(locker, count);
198 inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker,
201 if (likely(locker != NULL))
203 PSI_STATEMENT_CALL(set_statement_rows_sent)(locker, count);
208 inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker,
211 if (likely(locker != NULL))
213 PSI_STATEMENT_CALL(set_statement_rows_examined)(locker, count);
218 inline_mysql_end_statement(
struct PSI_statement_locker *locker,
221 PSI_STAGE_CALL(end_stage)();
222 if (likely(locker != NULL))
223 PSI_STATEMENT_CALL(end_statement)(locker, stmt_da);