MySQL 9.1.0
Source Code Documentation
dd::sdi_file Namespace Reference

Typedefs

typedef std::pair< dd::String_type, bool > Path_type
 Instantiation of std::pair to represent the full path to an sdi file. More...
 
typedef Prealloced_array< Path_type, 3 > Paths_type
 Typedef for container type to use as out-parameter when expanding sdi file patterns into paths. More...
 

Functions

String_type sdi_filename (Object_id id, const String_type &entity_name, const String_type &schema)
 Formats an sdi filename according to the mysql conventions for an entity name and schema name, where the schema may be "". More...
 
bool store_tbl_sdi (const Sdi_type &sdi, const dd::Table &table, const dd::Schema &schema)
 Stores sdi for table in a file. More...
 
bool remove (const String_type &fname)
 Remove a file name from the file system. More...
 
static bool remove_sdi_file_if_exists (const String_type &fname)
 
bool drop_tbl_sdi (const dd::Table &table, const dd::Schema &schema)
 Removes sdi file for a table. More...
 
bool load (THD *thd, const dd::String_type &fname, dd::String_type *buf)
 Read an sdi file from disk and store in a buffer. More...
 
bool expand_pattern (THD *thd, const MYSQL_LEX_STRING &pattern, Paths_type *paths)
 Expand an sdi filename pattern into the set of full paths that match. More...
 
template<typename CLOS >
bool with_str_error (CLOS &&clos)
 
bool check_data_files_exist (const dd::String_type &schema_name, const dd::String_type &table_name)
 Check that the MYD and MYI files for table exists. More...
 

Variables

const size_t FILENAME_PREFIX_CHARS = 16
 Number of character (not bytes) of a tablename which will contrubute to the sdi file name. More...
 
const String_type EXT = ".sdi"
 File name extension for sdi files. More...
 

Typedef Documentation

◆ Path_type

typedef std::pair<dd::String_type, bool> dd::sdi_file::Path_type

Instantiation of std::pair to represent the full path to an sdi file.

Member first is the path, second is true if the path is inside datadir, false otherwise.

◆ Paths_type

Typedef for container type to use as out-parameter when expanding sdi file patterns into paths.

Function Documentation

◆ check_data_files_exist()

bool dd::sdi_file::check_data_files_exist ( const dd::String_type schema_name,
const dd::String_type table_name 
)

Check that the MYD and MYI files for table exists.

Parameters
schema_nameschema name
table_nametable name
Return values
trueif an error occurs
falseotherwise

◆ drop_tbl_sdi()

bool dd::sdi_file::drop_tbl_sdi ( const dd::Table table,
const dd::Schema schema 
)

Removes sdi file for a table.

Parameters
tabledd object for which to remove sdi
schemaobject which table belongs to
Return values
trueif an error occurs
falseotherwise

◆ expand_pattern()

bool dd::sdi_file::expand_pattern ( THD thd,
const MYSQL_LEX_STRING pattern,
Paths_type paths 
)

Expand an sdi filename pattern into the set of full paths that match.

The paths and a bool indicating if the path is inside data dir is appended to the Paths_type collection provided as argument.

Parameters
thdthread handle
patternfilenam pattern to expand
pathscollection of expanded file paths
Return values
trueif an error occurs
falseotherwise

◆ load()

bool dd::sdi_file::load ( THD thd,
const dd::String_type fname,
dd::String_type buf 
)

Read an sdi file from disk and store in a buffer.

Parameters
thdthread handle
fnamepath to sdi file to load
bufwhere to store file content
Return values
trueif an error occurs
falseotherwise

◆ remove()

bool dd::sdi_file::remove ( const String_type fname)

Remove a file name from the file system.

Parameters
fnamefile name to remove from file system.
Return values
trueif an error occurs
falseotherwise

◆ remove_sdi_file_if_exists()

static bool dd::sdi_file::remove_sdi_file_if_exists ( const String_type fname)
static

◆ sdi_filename()

String_type dd::sdi_file::sdi_filename ( Object_id  id,
const String_type entity_name,
const String_type schema 
)

Formats an sdi filename according to the mysql conventions for an entity name and schema name, where the schema may be "".

Parameters
idobject id if dd object
entity_namename (as returned by dd::Entity_object::name()) of dd object.
schemaname of schema, or "" for schemaless entities (schemata).
Return values
filenameto use for sdi file

◆ store_tbl_sdi()

bool dd::sdi_file::store_tbl_sdi ( const Sdi_type sdi,
const dd::Table table,
const dd::Schema schema 
)

Stores sdi for table in a file.

Parameters
sdijson string to store
tabledd object from which sdi was generated
schemaobject which table belongs to
Return values
trueif an error occurs
falseotherwise

◆ with_str_error()

template<typename CLOS >
bool dd::sdi_file::with_str_error ( CLOS &&  clos)

Variable Documentation

◆ EXT

const String_type dd::sdi_file::EXT = ".sdi"

File name extension for sdi files.

◆ FILENAME_PREFIX_CHARS

const size_t dd::sdi_file::FILENAME_PREFIX_CHARS = 16

Number of character (not bytes) of a tablename which will contrubute to the sdi file name.

The whole name is not needed as the Object_id is added so that uniqueness is ensured