MySQL 9.4.0
Source Code Documentation
Rewriter_create_external_table Class Reference

Rewriter for CREATE EXTERNAL TABLE statements in the binary log. More...

#include <sql_rewrite.h>

Inheritance diagram for Rewriter_create_external_table:
[legend]

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_rewriteroperator= (const I_rewriter &)=delete
 
 I_rewriter (const I_rewriter &&)=delete
 
const I_rewriteroperator= (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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Rewriter_create_external_table()

Rewriter_create_external_table::Rewriter_create_external_table ( THD thd,
Consumer_type  type 
)

Member Function Documentation

◆ rewrite()

bool Rewriter_create_external_table::rewrite ( String rlb) const
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.

Parameters
[in,out]rlbBuffer to return the rewritten query in.
Return values
truethe query was rewritten
falseif rewriting failed

Implements I_rewriter.


The documentation for this class was generated from the following files: