#define MYSQL_THD
Definition: backup_page_tracker.h:37
The in-memory representation of a pattern.
Definition: rule.h:55
Load_status load(MYSQL_THD thd, const Persisted_rule *diskrule)
Loads the pattern.
Definition: rule.cc:113
std::vector< std::string > literals
Definition: rule.h:67
services::Digest digest
The digest obtained from the pattern.
Definition: rule.h:65
std::string m_parse_error_message
Definition: rule.h:92
Load_status
Definition: rule.h:57
@ PARSE_ERROR
Definition: rule.h:57
@ NO_DIGEST
Definition: rule.h:57
@ OK
Definition: rule.h:57
@ NOT_SUPPORTED_STATEMENT
Definition: rule.h:57
std::string parse_error_message()
If any errors were raised during parsing, the first one is available here.
Definition: rule.h:89
int number_parameters
Definition: rule.h:59
std::string normalized_pattern
The pattern in normalized form.
Definition: rule.h:62
A rule as persisted on disk.
Definition: persisted_rule.h:41
std::optional< std::string > replacement
The rewrite rule's replacement string.
Definition: persisted_rule.h:50
std::vector< int > m_param_slots
The positions in query_string of each parameter ('?')
Definition: rule.h:117
std::string m_parse_error_message
Definition: rule.h:119
int number_parameters
The number of parameters (and the size of m_param_slots and parameter_positions.)
Definition: rule.h:104
bool load(MYSQL_THD thd, const std::string replacement)
Load the replacement query string.
Definition: rule.cc:149
std::vector< int > slots() const
Definition: rule.h:113
std::string parse_error_message()
If any errors were raised during parsing, the first one is available here.
Definition: rule.h:111
std::string query_string
The query string of the replacement.
Definition: rule.h:98
Internal representation of a rewrite rule.
Definition: rule.h:126
Pattern m_pattern
Definition: rule.h:195
Rewrite_result create_new_query(MYSQL_THD thd)
Applies the rule on a query, thereby creating a new one.
Definition: rule.cc:165
std::string normalized_pattern()
The pattern in normalized form.
Definition: rule.h:141
Replacement m_replacement
Definition: rule.h:196
std::string pattern_parse_error_message()
Definition: rule.h:186
Load_status load(MYSQL_THD thd, const Persisted_rule *diskrule)
Loads and parses the rule and replacement.
Definition: rule.h:144
Load_status
Definition: rule.h:128
@ PATTERN_NOT_SUPPORTED_STATEMENT
Definition: rule.h:131
@ REPLACEMENT_PARSE_ERROR
Definition: rule.h:133
@ PATTERN_GOT_NO_DIGEST
Definition: rule.h:132
@ PATTERN_PARSE_ERROR
Definition: rule.h:130
@ OK
Definition: rule.h:129
@ REPLACEMENT_HAS_MORE_MARKERS
Definition: rule.h:134
std::string replacement_parse_error_message()
Definition: rule.h:190
const uchar * digest_buffer() const
The digest buffer.
Definition: rule.h:138
bool matches(MYSQL_THD thd) const
Asks the parser service for the current query in normalized form and compares it to the normalized pa...
Definition: rule.cc:180
Definition: services.h:59
const uchar * c_ptr() const
Needed because we use a C hash table to store digests.
Definition: services.h:72
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:51
The facilities for easily manipulating nullable values from a rules_table_service::Cursor.
Conversion layer between the parser service and this plugin.
The results of an attempt to rewrite a query parse tree.
Definition: rule.h:36
bool digest_matched
Means that at lest one matching digest was found in the hash table.
Definition: rule.h:44
std::string new_query
If was_rewritten is true, a new query, otherwise an empty string.
Definition: rule.h:47
Rewrite_result()
Definition: rule.h:49
bool was_rewritten
Means the query was successfully rewritten, and the new query is available in new_query.
Definition: rule.h:41