24#ifndef SQL_REWRITE_INCLUDED 
   25#define SQL_REWRITE_INCLUDED 
   74                   String *param_metadata_str)
 
  112                             bool do_ps_instrument = 
true);
 
Wrapper object for parameters required for GRANT statement.
Definition: sql_rewrite.h:87
 
Grant_params(bool grant_as_specified, LEX_GRANT_AS *grant_as)
Definition: sql_rewrite.h:89
 
bool grant_as_provided
Definition: sql_rewrite.h:93
 
LEX_GRANT_AS * grant_as_info
Definition: sql_rewrite.h:94
 
An abstract base class to enable the implementation of various query rewriters.
Definition: sql_rewrite.h:127
 
Consumer_type consumer_type()
Return the current consumer type set in the object.
Definition: sql_rewrite.cc:512
 
const I_rewriter & operator=(const I_rewriter &&)=delete
 
I_rewriter(const I_rewriter &)=delete
 
virtual bool rewrite(String &rlb) const =0
 
Consumer_type m_consumer_type
Definition: sql_rewrite.h:146
 
I_rewriter(const I_rewriter &&)=delete
 
void set_consumer_type(Consumer_type type)
Reset the previous consumer type.
Definition: sql_rewrite.cc:504
 
const I_rewriter & operator=(const I_rewriter &)=delete
 
THD *const m_thd
Definition: sql_rewrite.h:145
 
I_rewriter(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:493
 
Definition: sql_lex.h:3912
 
An interface to wrap the parameters required by specific Rewriter.
Definition: sql_rewrite.h:52
 
virtual ~Rewrite_params()=default
 
Rewrites the ALTER SERVER statement.
Definition: sql_rewrite.h:330
 
Rewriter_alter_server(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1806
 
bool rewrite(String &rlb) const override
Rewrite the query for the ALTER SERVER statement.
Definition: sql_rewrite.cc:1817
 
Definition: sql_rewrite.h:396
 
Rewriter_alter_table(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:2081
 
bool rewrite(String &rlb) const override
Rewrite the alter table statement with the PAR id being redacted.
Definition: sql_rewrite.cc:2092
 
Rewrites the ALTER USER statement.
Definition: sql_rewrite.h:228
 
void rewrite_password_history(const LEX *lex, String *str) const override
Append the PASSWORD HISTORY clause for users iff it is specified.
Definition: sql_rewrite.cc:1105
 
void append_user_auth_info(LEX_USER *user, bool comma, String *str) const override
Append the authID, plugin and auth str of the user to output string :
Definition: sql_rewrite.cc:1028
 
void rewrite_user_application_user_metadata(const LEX *lex, String *str) const override
Default implementation of the the rewriter for user applicatiton user metadata.
Definition: sql_rewrite.cc:581
 
void rewrite_password_reuse(const LEX *lex, String *str) const override
Append the PASSWORD REUSE clause for users iff it is specified.
Definition: sql_rewrite.cc:1117
 
Rewriter_alter_user(THD *thd, Consumer_type type=Consumer_type::TEXTLOG)
Definition: sql_rewrite.cc:998
 
bool rewrite(String &rlb) const override
Rewrite the query for the ALTER USER statement.
Definition: sql_rewrite.cc:1008
 
Rewrites the CHANGE REPLICATION SOURCE statement.
Definition: sql_rewrite.h:300
 
bool rewrite(String &rlb) const override
Rewrite the query for the CHANGE REPLICATION SOURCE statement.
Definition: sql_rewrite.cc:1562
 
Rewriter_change_replication_source(THD *thd, Consumer_type)
Definition: sql_rewrite.cc:1550
 
Rewrites CLONE statement.
Definition: sql_rewrite.h:346
 
bool rewrite(String &rlb) const override
Rewrite the query for the CLONE statement to hide password.
Definition: sql_rewrite.cc:1864
 
Rewriter_clone(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1853
 
Rewriter for CREATE EXTERNAL TABLE statements in the binary log.
Definition: sql_rewrite.h:390
 
Rewriter_create_external_table(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1967
 
bool rewrite(String &rlb) const override
Rewrite CREATE EXTERNAL TABLE to CREATE TABLE with explicit ENGINE and SECONDARY_ENGINE for binary lo...
Definition: sql_rewrite.cc:1985
 
Rewrites the CREATE PROCEDURE or CREATE FUNCTION statement.
Definition: sql_rewrite.h:370
 
Rewriter_create_procedure(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1932
 
bool rewrite(String &rlb) const override
Rewrite the query for CREATE PROCEDURE or ROUTINES with the PAR id being redacted.
Definition: sql_rewrite.cc:1943
 
Rewrites the CREATE SERVER statement.
Definition: sql_rewrite.h:322
 
Rewriter_create_server(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1759
 
bool rewrite(String &rlb) const override
Rewrite the query for the CREATE SERVER statement.
Definition: sql_rewrite.cc:1788
 
Rewrites the CREATE TABLE statement for external tables.
Definition: sql_rewrite.h:377
 
Rewriter_create_table(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1950
 
bool rewrite(String &rlb) const override
Rewrite the create table statement with the PAR id being redacted.
Definition: sql_rewrite.cc:1960
 
Rewrites the CREATE USER statement.
Definition: sql_rewrite.h:212
 
void append_user_auth_info(LEX_USER *user, bool comma, String *str) const override
Append the authID, plugin and auth str of the user to output string :
Definition: sql_rewrite.cc:921
 
void rewrite_password_history(const LEX *lex, String *str) const override
Append the PASSWORD HISTORY clause for users iff it is specified.
Definition: sql_rewrite.cc:980
 
void rewrite_password_reuse(const LEX *lex, String *str) const override
Append the PASSWORD REUSE clause for users iff it is specified.
Definition: sql_rewrite.cc:992
 
void rewrite_user_application_user_metadata(const LEX *lex, String *str) const override
Default implementation of the the rewriter for user applicatiton user metadata.
Definition: sql_rewrite.cc:570
 
Rewriter_create_user(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:890
 
bool rewrite(String &rlb) const override
Rewrite the query for the CREATE USER statement.
Definition: sql_rewrite.cc:900
 
Rewrites the GRANT statement.
Definition: sql_rewrite.h:289
 
bool rewrite(String &rlb) const override
Rewrite the query for the GRANT statement.
Definition: sql_rewrite.cc:1377
 
Rewriter_grant(THD *thd, Consumer_type type, const Rewrite_params *params)
Definition: sql_rewrite.cc:1364
 
const Grant_params * grant_params
Definition: sql_rewrite.h:296
 
Rewrites the PREPARE statement.
Definition: sql_rewrite.h:339
 
Rewriter_prepare(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1831
 
bool rewrite(String &rlb) const override
Rewrite the query for the PREPARE statement.
Definition: sql_rewrite.cc:1842
 
Rewrites the START REPLICA statement.
Definition: sql_rewrite.h:307
 
bool rewrite(String &rlb) const override
Rewrite the query for the SLAVE REPLICA statement.
Definition: sql_rewrite.cc:1695
 
Rewriter_replica_start(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1685
 
Rewrites the SELECT statement.
Definition: sql_rewrite.h:363
 
Rewriter_select_query(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1911
 
bool rewrite(String &rlb) const override
Rewrite the query with the PAR id being redacted if the query exports query result to the object stor...
Definition: sql_rewrite.cc:1923
 
Base class for SERVER OPTIONS related statement.
Definition: sql_rewrite.h:313
 
void mysql_rewrite_server_options(const LEX *lex, String *str) const
Append the SERVER OPTIONS clause.
Definition: sql_rewrite.cc:1767
 
Rewriter_server_option(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1757
 
Definition: sql_rewrite.h:275
 
bool rewrite(String &rlb) const override
Rewrite the query for the SET PASSWORD statement.
Definition: sql_rewrite.cc:1315
 
std::set< LEX_USER * > * m_users
Definition: sql_rewrite.h:285
 
Rewriter_set_password(THD *thd, Consumer_type type, const Rewrite_params *params)
Definition: sql_rewrite.cc:1300
 
Rewrites the SET statement.
Definition: sql_rewrite.h:267
 
Rewriter_set(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1270
 
bool rewrite(String &rlb) const override
Rewrite the query for the SET statement.
Definition: sql_rewrite.cc:1281
 
Rewrites the SHOW CREATE USER statement.
Definition: sql_rewrite.h:244
 
void rewrite_password_history(const LEX *lex, String *str) const override
Append the PASSWORD HISTORY clause for users.
Definition: sql_rewrite.cc:1205
 
void rewrite_password_reuse(const LEX *lex, String *str) const override
Append the PASSWORD REUSE clause for users.
Definition: sql_rewrite.cc:1215
 
Rewriter_show_create_user(THD *thd, Consumer_type type, const Rewrite_params *params)
Definition: sql_rewrite.cc:1123
 
void append_user_auth_info(LEX_USER *user, bool comma, String *str) const override
Append the authID, plugin name and suth str user to output string.
Definition: sql_rewrite.cc:1226
 
void rewrite_user_application_user_metadata(const LEX *lex, String *str) const override
Overrides implementation of the the rewriter for user application user metadata.
Definition: sql_rewrite.cc:1154
 
void append_auth_str(LEX_USER *lex, String *str) const override
A special rewriter override to make SHOW CREATE USER convert the string to hex if print_identified_wi...
Definition: sql_rewrite.cc:1173
 
bool rewrite(String &rlb) const override
Rewrite the query for the SHOW CREATE USER statement.
Definition: sql_rewrite.cc:1141
 
const Show_user_params * show_params_
Definition: sql_rewrite.h:263
 
Rewrites the START GROUP_REPLICATION command.
Definition: sql_rewrite.h:353
 
Rewriter_start_group_replication(THD *thd, Consumer_type type)
Definition: sql_rewrite.cc:1869
 
bool rewrite(String &rlb) const override
Rewrite the query for the START GROUP_REPLICATION command.
Definition: sql_rewrite.cc:1880
 
Abstract base class to define the skeleton of rewriting the users, yet deferring some steps to the co...
Definition: sql_rewrite.h:153
 
void append_mfa_auth_str(const LEX_MFA *user, String *str) const
Append the authentication string from LEX_MFA for the user.
Definition: sql_rewrite.cc:806
 
void rewrite_user_resources(const LEX *lex, String *str) const
Append the user resource clauses for users.
Definition: sql_rewrite.cc:655
 
void append_literal_secret(String *str) const
Append the literal <secret> in place of password to the output string.
Definition: sql_rewrite.cc:591
 
void rewrite_password_require_current(LEX *lex, String *str) const
Append the PASSWORD REQUIRE CURRENT clause for users.
Definition: sql_rewrite.cc:718
 
Rewriter_user(THD *thd, Consumer_type target_type)
Definition: sql_rewrite.cc:514
 
void rewrite_password_expired(const LEX *lex, String *str) const
Append the PASSWORD EXPIRE clause for users iff it is specified.
Definition: sql_rewrite.cc:697
 
virtual void rewrite_user_application_user_metadata(const LEX *lex, String *str) const =0
 
void rewrite_users(LEX *lex, String *str) const
Fetch the users from user_list in LEX struct and append them to the String.
Definition: sql_rewrite.cc:857
 
void rewrite_in_memory_user_application_user_metadata(const LEX *user, String *str) const
Use the LEX for reconstructing the ATTRIBUTE or COMMENT clause.
Definition: sql_rewrite.cc:546
 
void rewrite_account_lock_state(LEX *lex, String *str) const
Append the account lock state.
Definition: sql_rewrite.cc:747
 
virtual void rewrite_password_history(const LEX *lex, String *str) const =0
The default implementation is to append the PASSWORD HISTORY clause iff it is specified.
Definition: sql_rewrite.cc:825
 
virtual void append_user_auth_info(LEX_USER *user, bool comma, String *str) const =0
 
void rewrite_ssl_properties(const LEX *lex, String *str) const
Append the SSL clause for users iff it is specified.
Definition: sql_rewrite.cc:613
 
void append_mfa_plugin_name(const LEX_MFA *user, String *str) const
Append the authentication plugin name from LEX_MFA for the user.
Definition: sql_rewrite.cc:790
 
virtual void append_auth_str(LEX_USER *lex, String *str) const
Append the password hash to the output string.
Definition: sql_rewrite.cc:601
 
bool rewrite(String &rlb) const override
Appends the essential clauses for SHOW CREATE|CREATE|ALTER USER statements in the buffer rlb.
Definition: sql_rewrite.cc:525
 
void rewrite_account_lock(const LEX *lex, String *str) const
Append the ACCOUNT LOCK clause for users iff it is specified.
Definition: sql_rewrite.cc:682
 
void append_plugin_name(const LEX_USER *user, String *str) const
Append the authentication plugin name for the user.
Definition: sql_rewrite.cc:767
 
virtual void rewrite_password_reuse(const LEX *lex, String *str) const =0
The default implementation is to append the PASSWORD REUSE clause iff it is specified.
Definition: sql_rewrite.cc:841
 
void rewrite_default_roles(const LEX *lex, String *str) const
Append the DEFAULT ROLE clause for users iff it is specified.
Definition: sql_rewrite.cc:875
 
Wrapper object for parameters required by SHOW CREATE USER statement.
Definition: sql_rewrite.h:71
 
String * metadata_str
Definition: sql_rewrite.h:81
 
bool hide_password_hash
Definition: sql_rewrite.h:79
 
Show_user_params(bool hide_password_hash, bool print_identified_with_as_hex, String *param_metadata_str)
Definition: sql_rewrite.h:73
 
bool print_identified_with_as_hex_
Definition: sql_rewrite.h:80
 
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:169
 
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:36
 
Wrapper object for user related parameters required by: SET PASSWORD|CREATE USER|ALTER USER statement...
Definition: sql_rewrite.h:61
 
User_params(std::set< LEX_USER * > *users_set)
Definition: sql_rewrite.h:63
 
std::set< LEX_USER * > * users
Definition: sql_rewrite.h:65
 
char * user
Definition: mysqladmin.cc:67
 
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1078
 
required string type
Definition: replication_group_member_actions.proto:34
 
void mysql_rewrite_acl_query(THD *thd, String &rlb, Consumer_type type, const Rewrite_params *params=nullptr, bool do_ps_instrument=true)
Provides the default interface to rewrite the ACL query.
Definition: sql_rewrite.cc:452
 
void mysql_rewrite_query(THD *thd, Consumer_type type=Consumer_type::TEXTLOG, const Rewrite_params *params=nullptr)
Provides the default interface to rewrite the SQL statements to to obfuscate passwords.
Definition: sql_rewrite.cc:414
 
void mysql_rewrite_query_for_binlog(THD *thd)
Rewrite query for binary log.
Definition: sql_rewrite.cc:483
 
void redact_external_metadata(String original_query_str, String &rlb)
Rewrites the par URL and OCID used in external tables.
Definition: sql_rewrite.cc:1902
 
Consumer_type
Target types where the rewritten query will be added.
Definition: sql_rewrite.h:38
 
The LEX object currently serves three different purposes:
Definition: sql_lex.h:3999