1#ifndef MYSQL_SERVICE_PARSER_INCLUDED
2#define MYSQL_SERVICE_PARSER_INCLUDED
28#ifndef MYSQL_ABI_CHECK
34#define MYSQL_THD THD *
45#define PARSER_SERVICE_DIGEST_LENGTH 32
47#define STATEMENT_TYPE_SELECT 1
48#define STATEMENT_TYPE_UPDATE 2
49#define STATEMENT_TYPE_INSERT 3
50#define STATEMENT_TYPE_DELETE 4
51#define STATEMENT_TYPE_REPLACE 5
52#define STATEMENT_TYPE_OTHER 6
58 const char *msg,
void *state);
67 void *(*callback_fun)(
void *),
void *arg,
97 unsigned char is_prepared,
99 void *condition_handler_state);
115 unsigned char *digest);
215#ifdef MYSQL_DYNAMIC_PLUGIN
217#define mysql_parser_current_session() \
218 mysql_parser_service->mysql_current_session()
220#define mysql_parser_open_session() mysql_parser_service->mysql_open_session()
222#define mysql_parser_start_thread(thd, func, arg, thread_handle) \
223 mysql_parser_service->mysql_start_thread(thd, func, arg, thread_handle)
225#define mysql_parser_join_thread(thread_handle) \
226 mysql_parser_service->mysql_join_thread(thread_handle)
228#define mysql_parser_set_current_database(thd, db) \
229 mysql_parser_service->mysql_set_current_database(thd, db)
231#define mysql_parser_parse(thd, query, is_prepared, condition_handler, \
232 condition_handler_state) \
233 mysql_parser_service->mysql_parse( \
234 thd, query, is_prepared, condition_handler, condition_handler_state)
236#define mysql_parser_get_statement_type(thd) \
237 mysql_parser_service->mysql_get_statement_type(thd)
239#define mysql_parser_get_statement_digest(thd, digest) \
240 mysql_parser_service->mysql_get_statement_digest(thd, digest)
242#define mysql_parser_get_number_params(thd) \
243 mysql_parser_service->mysql_get_number_params(thd)
245#define mysql_parser_extract_prepared_params(thd, positions) \
246 mysql_parser_service->mysql_extract_prepared_params(thd, positions)
248#define mysql_parser_visit_tree(thd, processor, arg) \
249 mysql_parser_service->mysql_visit_tree(thd, processor, arg)
251#define mysql_parser_item_string(item) \
252 mysql_parser_service->mysql_item_string(item)
254#define mysql_parser_free_string(string) \
255 mysql_parser_service->mysql_free_string(string)
257#define mysql_parser_get_query(thd) mysql_parser_service->mysql_get_query(thd)
259#define mysql_parser_get_normalized_query(thd) \
260 mysql_parser_service->mysql_get_normalized_query(thd)
263typedef void *(*callback_function)(
void *);
272 unsigned char is_prepared,
274 void *condition_handler_state);
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:936
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
static char * query
Definition: myisam_ftdump.cc:47
void mysql_parser_join_thread(struct my_thread_handle *thread_handle)
Definition: parser_service.cc:218
#define MYSQL_THD
Definition: service_parser.h:34
int mysql_parser_get_statement_type(MYSQL_THD thd)
Definition: parser_service.cc:284
int mysql_parser_parse(MYSQL_THD thd, const MYSQL_LEX_STRING query, unsigned char is_prepared, sql_condition_handler_function handle_condition, void *condition_handler_state)
Definition: parser_service.cc:233
MYSQL_THD(* mysql_open_session_t)()
Definition: service_parser.h:64
void(* mysql_set_current_database_t)(MYSQL_THD thd, const MYSQL_LEX_STRING db)
Definition: service_parser.h:72
Item * MYSQL_ITEM
Definition: service_parser.h:35
int mysql_parser_get_statement_digest(MYSQL_THD thd, unsigned char *digest)
Definition: parser_service.cc:310
int(* parse_node_visit_function)(MYSQL_ITEM item, unsigned char *arg)
Definition: service_parser.h:54
int(* mysql_get_statement_digest_t)(MYSQL_THD thd, unsigned char *digest)
Returns the digest of the last parsed statement in the session.
Definition: service_parser.h:114
void mysql_parser_start_thread(MYSQL_THD thd, callback_function fun, void *arg, struct my_thread_handle *thread_handle)
MYSQL_THD mysql_parser_current_session()
Definition: parser_service.cc:139
MYSQL_LEX_STRING(* mysql_get_normalized_query_t)(MYSQL_THD thd)
Returns the current query in normalized form.
Definition: service_parser.h:195
void mysql_parser_set_current_database(MYSQL_THD thd, const MYSQL_LEX_STRING db)
Definition: parser_service.cc:222
MYSQL_LEX_STRING(* mysql_item_string_t)(MYSQL_ITEM item)
Renders the MYSQL_ITEM as a string and returns a reference in the form of a MYSQL_LEX_STRING.
Definition: service_parser.h:168
int mysql_parser_visit_tree(MYSQL_THD thd, parse_node_visit_function processor, unsigned char *arg)
Definition: parser_service.cc:332
MYSQL_THD mysql_parser_open_session()
Definition: parser_service.cc:141
MYSQL_LEX_STRING(* mysql_get_query_t)(MYSQL_THD thd)
Returns the current query string.
Definition: service_parser.h:185
struct mysql_parser_service_st * mysql_parser_service
int(* mysql_get_statement_type_t)(MYSQL_THD thd)
Definition: service_parser.h:101
int(* mysql_parse_t)(MYSQL_THD thd, const MYSQL_LEX_STRING query, unsigned char is_prepared, sql_condition_handler_function handle_condition, void *condition_handler_state)
Parses the query.
Definition: service_parser.h:96
int(* mysql_get_number_params_t)(MYSQL_THD thd)
Returns the number of parameters ('?') in the parsed query.
Definition: service_parser.h:125
void(* mysql_free_string_t)(MYSQL_LEX_STRING string)
Frees a string buffer allocated by the server.
Definition: service_parser.h:175
void *(* callback_function)(void *)
Definition: service_parser.h:263
int(* mysql_visit_tree_t)(MYSQL_THD thd, parse_node_visit_function processor, unsigned char *arg)
Walks the tree depth first and applies a user defined function on each literal.
Definition: service_parser.h:153
MYSQL_LEX_STRING mysql_parser_item_string(MYSQL_ITEM item)
Definition: parser_service.cc:338
int(* sql_condition_handler_function)(int sql_errno, const char *sqlstate, const char *msg, void *state)
Definition: service_parser.h:56
int mysql_parser_extract_prepared_params(MYSQL_THD thd, int *positions)
Definition: parser_service.cc:324
int mysql_parser_get_number_params(MYSQL_THD thd)
Definition: parser_service.cc:320
MYSQL_LEX_STRING mysql_parser_get_normalized_query(MYSQL_THD thd)
Definition: parser_service.cc:358
void(* mysql_start_thread_t)(MYSQL_THD thd, void *(*callback_fun)(void *), void *arg, struct my_thread_handle *thread_handle)
Definition: service_parser.h:66
int(* mysql_extract_prepared_params_t)(MYSQL_THD thd, int *positions)
Stores in 'positions' the positions in the last parsed query of each parameter marker('?...
Definition: service_parser.h:141
void(* mysql_join_thread_t)(struct my_thread_handle *thread_handle)
Definition: service_parser.h:70
MYSQL_LEX_STRING mysql_parser_get_query(MYSQL_THD thd)
Definition: parser_service.cc:352
MYSQL_THD(* mysql_current_session_t)()
Definition: service_parser.h:62
void mysql_parser_free_string(MYSQL_LEX_STRING string)
Definition: parser_service.cc:350
Definition: mysql_lex_string.h:35
Definition: my_thread_bits.h:58
Definition: service_parser.h:197
mysql_get_number_params_t mysql_get_number_params
Definition: service_parser.h:206
mysql_visit_tree_t mysql_visit_tree
Definition: service_parser.h:208
mysql_start_thread_t mysql_start_thread
Definition: service_parser.h:200
mysql_get_statement_digest_t mysql_get_statement_digest
Definition: service_parser.h:205
mysql_get_normalized_query_t mysql_get_normalized_query
Definition: service_parser.h:212
mysql_join_thread_t mysql_join_thread
Definition: service_parser.h:201
mysql_get_statement_type_t mysql_get_statement_type
Definition: service_parser.h:204
mysql_item_string_t mysql_item_string
Definition: service_parser.h:209
mysql_open_session_t mysql_open_session
Definition: service_parser.h:199
mysql_extract_prepared_params_t mysql_extract_prepared_params
Definition: service_parser.h:207
mysql_set_current_database_t mysql_set_current_database
Definition: service_parser.h:202
mysql_get_query_t mysql_get_query
Definition: service_parser.h:211
mysql_current_session_t mysql_current_session
Definition: service_parser.h:198
mysql_free_string_t mysql_free_string
Definition: service_parser.h:210
mysql_parse_t mysql_parse
Definition: service_parser.h:203