MySQL 9.1.0
Source Code Documentation
|
State and operations for importing an sdi file into the DD. More...
#include <sdi_api.h>
Public Member Functions | |
Import_target (String_type &&path, bool in_datadir) | |
Creates an instance to handle the import of a single sdi file. More... | |
Import_target (Import_target &&)=default | |
Having a unique_ptr as member makes this a move-only type. More... | |
Import_target (const Import_target &)=delete | |
bool | commit () const |
Finish import by removing tmp sdi file when importing from sdi file in datadir. More... | |
bool | rollback () const |
Restore old state by renaming tmp sdi file back to its original name when importing from sdi file in datadir. More... | |
const dd::String_type * | can_table_name () const |
Obtains the canonical table name for use with MDL and privilege-checking. More... | |
const dd::String_type * | can_schema_name () const |
Obtains the canonical schema name for use with MDL and privilege-checking. More... | |
bool | load (THD *thd, String_type *shared_buffer) |
Reads the sdi file from disk and dserializes it into a Table object and its schema name, but does not store Table object in the DD. More... | |
Table_ref | make_table_ref () const |
Constructs a Table_ref object with info from this Import_target. More... | |
bool | store_in_dd (THD *thd) const |
Update the schema reference in the Table object and store it in the DD so that it becomes visible. More... | |
Private Attributes | |
dd::String_type | m_path |
Full path to the sdi file being imported. More... | |
bool | m_in_datadir |
True if path points inside data dir. More... | |
dd::String_type | m_tmp_sdi_filename |
Temporary name for sdi files in data dir when import is ongoing. More... | |
std::unique_ptr< dd::Table > | m_table_object |
Table object which the sdi will be deserialized into. More... | |
dd::String_type | m_schema_name_in_sdi |
Schema name found in sdi. More... | |
std::unique_ptr< dd::String_type > | m_lc_tname |
Lower-case representation of table name if lower_case_table_names==2, nullptr otherwise. More... | |
std::unique_ptr< dd::String_type > | m_lc_sname |
Lower-case representation of schema name if lower_case_table_names==2, nullptr otherwise. More... | |
State and operations for importing an sdi file into the DD.
dd::sdi::Import_target::Import_target | ( | String_type && | path, |
bool | in_datadir | ||
) |
Creates an instance to handle the import of a single sdi file.
path | full path to an sdi file to import |
in_datadir | true if the file is located somewhere under the server's data directory. |
|
default |
Having a unique_ptr as member makes this a move-only type.
|
delete |
const dd::String_type * dd::sdi::Import_target::can_schema_name | ( | ) | const |
Obtains the canonical schema name for use with MDL and privilege-checking.
For lower_case_table_names=0 and 1, this is the same as the schema name of the table in the sdi. For lower_case_table_names=2 it is the lower case version of the schemaname.
const dd::String_type * dd::sdi::Import_target::can_table_name | ( | ) | const |
Obtains the canonical table name for use with MDL and privilege-checking.
For lower_case_table_names=0 and 1, this is the same as the name of the Table object. For lower_case_table_names=2 it is the lower case version of the tablename.
bool dd::sdi::Import_target::commit | ( | ) | const |
Finish import by removing tmp sdi file when importing from sdi file in datadir.
true | if an error occurred |
false | otherwise |
bool dd::sdi::Import_target::load | ( | THD * | thd, |
String_type * | shared_buffer | ||
) |
Reads the sdi file from disk and dserializes it into a Table object and its schema name, but does not store Table object in the DD.
thd | thread context |
shared_buffer | pointer to a dd::String_type which is used to store the sdi string until it is deserialized. |
true | if an error occurred |
false | otherwise |
Table_ref dd::sdi::Import_target::make_table_ref | ( | ) | const |
Constructs a Table_ref object with info from this Import_target.
Table_ref::db and Table_ref::table_name are initialized to the canonical (lowercased for lctn==2) representation, Table_ref::alias to the native table_name, and Table_ref::m_lock_descriptor.type is set to TL_IGNORE.
bool dd::sdi::Import_target::rollback | ( | ) | const |
Restore old state by renaming tmp sdi file back to its original name when importing from sdi file in datadir.
true | if an error occurred |
false | otherwise |
bool dd::sdi::Import_target::store_in_dd | ( | THD * | thd | ) | const |
Update the schema reference in the Table object and store it in the DD so that it becomes visible.
Precondition: The Import_target must be loaded and privileges checked before this member function is called.
thd | thread handle |
true | if an error occurred |
false | otherwise |
|
private |
True if path points inside data dir.
|
private |
Lower-case representation of schema name if lower_case_table_names==2, nullptr otherwise.
|
private |
Lower-case representation of table name if lower_case_table_names==2, nullptr otherwise.
|
private |
Full path to the sdi file being imported.
|
private |
Schema name found in sdi.
|
private |
Table object which the sdi will be deserialized into.
|
private |
Temporary name for sdi files in data dir when import is ongoing.