#define MYSQL_THD
Definition: backup_page_tracker.h:38
The in-memory representation of a pattern.
Definition: rule.h:56
Load_status load(MYSQL_THD thd, const Persisted_rule *diskrule)
Loads the pattern.
Definition: rule.cc:114
std::vector< std::string > literals
Definition: rule.h:68
services::Digest digest
The digest obtained from the pattern.
Definition: rule.h:66
std::string m_parse_error_message
Definition: rule.h:93
Load_status
Definition: rule.h:58
@ PARSE_ERROR
Definition: rule.h:58
@ NO_DIGEST
Definition: rule.h:58
@ OK
Definition: rule.h:58
@ NOT_SUPPORTED_STATEMENT
Definition: rule.h:58
std::string parse_error_message()
If any errors were raised during parsing, the first one is available here.
Definition: rule.h:90
int number_parameters
Definition: rule.h:60
std::string normalized_pattern
The pattern in normalized form.
Definition: rule.h:63
A rule as persisted on disk.
Definition: persisted_rule.h:42
std::optional< std::string > replacement
The rewrite rule's replacement string.
Definition: persisted_rule.h:51
std::vector< int > m_param_slots
The positions in query_string of each parameter ('?')
Definition: rule.h:118
std::string m_parse_error_message
Definition: rule.h:120
int number_parameters
The number of parameters (and the size of m_param_slots and parameter_positions.)
Definition: rule.h:105
bool load(MYSQL_THD thd, const std::string replacement)
Load the replacement query string.
Definition: rule.cc:150
std::vector< int > slots() const
Definition: rule.h:114
std::string parse_error_message()
If any errors were raised during parsing, the first one is available here.
Definition: rule.h:112
std::string query_string
The query string of the replacement.
Definition: rule.h:99
Internal representation of a rewrite rule.
Definition: rule.h:127
Pattern m_pattern
Definition: rule.h:196
Rewrite_result create_new_query(MYSQL_THD thd)
Applies the rule on a query, thereby creating a new one.
Definition: rule.cc:166
std::string normalized_pattern()
The pattern in normalized form.
Definition: rule.h:142
Replacement m_replacement
Definition: rule.h:197
std::string pattern_parse_error_message()
Definition: rule.h:187
Load_status load(MYSQL_THD thd, const Persisted_rule *diskrule)
Loads and parses the rule and replacement.
Definition: rule.h:145
Load_status
Definition: rule.h:129
@ PATTERN_NOT_SUPPORTED_STATEMENT
Definition: rule.h:132
@ REPLACEMENT_PARSE_ERROR
Definition: rule.h:134
@ PATTERN_GOT_NO_DIGEST
Definition: rule.h:133
@ PATTERN_PARSE_ERROR
Definition: rule.h:131
@ OK
Definition: rule.h:130
@ REPLACEMENT_HAS_MORE_MARKERS
Definition: rule.h:135
std::string replacement_parse_error_message()
Definition: rule.h:191
const uchar * digest_buffer() const
The digest buffer.
Definition: rule.h:139
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:181
Definition: services.h:60
const uchar * c_ptr() const
Needed because we use a C hash table to store digests.
Definition: services.h:73
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
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:37
bool digest_matched
Means that at lest one matching digest was found in the hash table.
Definition: rule.h:45
std::string new_query
If was_rewritten is true, a new query, otherwise an empty string.
Definition: rule.h:48
Rewrite_result()
Definition: rule.h:50
bool was_rewritten
Means the query was successfully rewritten, and the new query is available in new_query.
Definition: rule.h:42