![]()  | 
  
    MySQL 9.5.0
    
   Source Code Documentation 
   | 
 
Rewriter for CREATE EXTERNAL TABLE statements in the binary log. More...
#include <sql_rewrite.h>
Public Member Functions | |
| Rewriter_create_external_table (THD *thd, Consumer_type type) | |
| bool | rewrite (String &rlb) const override | 
| Rewrite CREATE EXTERNAL TABLE to CREATE TABLE with explicit ENGINE and SECONDARY_ENGINE for binary logging to ensure proper replication.  More... | |
  Public Member Functions inherited from I_rewriter | |
| I_rewriter (THD *thd, Consumer_type type) | |
| virtual | ~I_rewriter () | 
| I_rewriter (const I_rewriter &)=delete | |
| const I_rewriter & | operator= (const I_rewriter &)=delete | 
| I_rewriter (const I_rewriter &&)=delete | |
| const I_rewriter & | operator= (const I_rewriter &&)=delete | 
| void | set_consumer_type (Consumer_type type) | 
| Reset the previous consumer type.  More... | |
| Consumer_type | consumer_type () | 
| Return the current consumer type set in the object.  More... | |
Additional Inherited Members | |
  Protected Attributes inherited from I_rewriter | |
| THD *const | m_thd | 
| Consumer_type | m_consumer_type | 
Rewriter for CREATE EXTERNAL TABLE statements in the binary log.
When CREATE EXTERNAL TABLE is used, MySQL implicitly assigns ENGINE and SECONDARY_ENGINE values from global variables. For replication to work correctly, we need to rewrite this to an explicit CREATE TABLE with the ENGINE and SECONDARY_ENGINE values included.
| Rewriter_create_external_table::Rewriter_create_external_table | ( | THD * | thd, | 
| Consumer_type | type | ||
| ) | 
      
  | 
  overridevirtual | 
Rewrite CREATE EXTERNAL TABLE to CREATE TABLE with explicit ENGINE and SECONDARY_ENGINE for binary logging to ensure proper replication.
The EXTERNAL keyword implicitly assigns storage_engine and secondary_engine based on session variables during parsing. For proper replication, we need to replace the EXTERNAL keyword and ensure the explicitly resolved ENGINE values from create_info are included after the closing parenthesis of column definitions.
| [in,out] | rlb | Buffer to return the rewritten query in. | 
| true | the query was rewritten | 
| false | if rewriting failed | 
Implements I_rewriter.