Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions include/mysql/service_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,17 @@ extern struct mysql_parser_service_st {
MYSQL_LEX_STRING (*mysql_item_string)(MYSQL_ITEM item);


/**
Returns the MYSQL_ITEM type as integer

@param item The item to get the type of.

@return The type as integer

*/
int (*mysql_item_type)(MYSQL_ITEM item);


/**
Frees a string buffer allocated by the server.

Expand Down Expand Up @@ -244,6 +255,9 @@ extern struct mysql_parser_service_st {
#define mysql_parser_item_string(item) \
mysql_parser_service->mysql_item_string(item)

#define mysql_parser_item_type(item) \
mysql_parser_service->mysql_item_type(item)

#define mysql_parser_free_string(string) \
mysql_parser_service->mysql_free_string(string)

Expand Down Expand Up @@ -273,6 +287,7 @@ int mysql_parser_extract_prepared_params(MYSQL_THD thd, int *positions);
int mysql_parser_visit_tree(MYSQL_THD thd, parse_node_visit_function processor,
unsigned char* arg);
MYSQL_LEX_STRING mysql_parser_item_string(MYSQL_ITEM item);
int mysql_parser_item_type(MYSQL_ITEM item);
void mysql_parser_free_string(MYSQL_LEX_STRING string);
MYSQL_LEX_STRING mysql_parser_get_query(MYSQL_THD thd);
MYSQL_LEX_STRING mysql_parser_get_normalized_query(MYSQL_THD thd);
Expand Down
8 changes: 5 additions & 3 deletions include/mysql/services.h.pp
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@
int (*mysql_visit_tree)(void* thd, parse_node_visit_function processor,
unsigned char* arg);
MYSQL_LEX_STRING (*mysql_item_string)(MYSQL_ITEM item);
int (*mysql_item_type)(MYSQL_ITEM item);
void (*mysql_free_string)(MYSQL_LEX_STRING string);
MYSQL_LEX_STRING (*mysql_get_query)(void* thd);
MYSQL_LEX_STRING (*mysql_get_normalized_query)(void* thd);
Expand All @@ -416,6 +417,7 @@
int mysql_parser_visit_tree(void* thd, parse_node_visit_function processor,
unsigned char* arg);
MYSQL_LEX_STRING mysql_parser_item_string(MYSQL_ITEM item);
int mysql_parser_item_type(MYSQL_ITEM item);
void mysql_parser_free_string(MYSQL_LEX_STRING string);
MYSQL_LEX_STRING mysql_parser_get_query(void* thd);
MYSQL_LEX_STRING mysql_parser_get_normalized_query(void* thd);
Expand Down Expand Up @@ -494,13 +496,13 @@
int (*my_key_store_func)(const char *, const char *, const char *,
const void *, size_t);
int (*my_key_fetch_func)(const char *, char **, const char *, void **,
size_t *);
size_t *);
int (*my_key_remove_func)(const char *, const char *);
int (*my_key_generate_func)(const char *, const char *, const char *,
size_t);
size_t);
} *mysql_keyring_service;
int my_key_store(const char *, const char *, const char *, const void *, size_t);
int my_key_fetch(const char *, char **, const char *, void **,
size_t *);
size_t *);
int my_key_remove(const char *, const char *);
int my_key_generate(const char *, const char *, const char *, size_t);
6 changes: 6 additions & 0 deletions sql/parser_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ class Service_visitor: public Select_lex_visitor
case Item::NULL_ITEM:
case Item::VARBIN_ITEM:
case Item::CACHE_ITEM:
case Item::FUNC_ITEM:
return m_processor(item, m_arg);
default:
break;
Expand Down Expand Up @@ -362,6 +363,11 @@ MYSQL_LEX_STRING mysql_parser_item_string(MYSQL_ITEM item)
return res;
}

extern "C"
int mysql_parser_item_type(MYSQL_ITEM item)
{
return item->type();
}

extern "C"
void mysql_parser_free_string(MYSQL_LEX_STRING string)
Expand Down
1 change: 1 addition & 0 deletions sql/sql_plugin_services.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ static struct mysql_parser_service_st parser_handler=
mysql_parser_extract_prepared_params,
mysql_parser_visit_tree,
mysql_parser_item_string,
mysql_parser_item_type,
mysql_parser_free_string,
mysql_parser_get_query,
mysql_parser_get_normalized_query
Expand Down