MySQL 9.1.0
Source Code Documentation
myrg_open.cc File Reference
#include <errno.h>
#include <fcntl.h>
#include <stddef.h>
#include <sys/types.h>
#include "my_dbug.h"
#include "my_inttypes.h"
#include "my_io.h"
#include "mysql/psi/mysql_file.h"
#include "storage/myisam/myisamdef.h"
#include "storage/myisammrg/myrg_def.h"
#include "strmake.h"
#include "typelib.h"

Functions

MYRG_INFOmyrg_open (const char *name, int mode, int handle_locking)
 
MYRG_INFOmyrg_parent_open (const char *parent_name, int(*callback)(void *, const char *), void *callback_param)
 Open parent table of a MyISAM MERGE table. More...
 
int myrg_attach_children (MYRG_INFO *m_info, int handle_locking, MI_INFO *(*callback)(void *), void *callback_param, bool *need_compat_check)
 Attach children to a MyISAM MERGE parent table. More...
 
int myrg_detach_children (MYRG_INFO *m_info)
 Detach children from a MyISAM MERGE parent table. More...
 

Function Documentation

◆ myrg_attach_children()

int myrg_attach_children ( MYRG_INFO m_info,
int  handle_locking,
MI_INFO *(*)(void *)  callback,
void *  callback_param,
bool *  need_compat_check 
)

Attach children to a MyISAM MERGE parent table.

Call a callback function for each child table. The callback returns the MyISAM table handle of the child table. Check table definition match.

Parameters
[in]m_infoMERGE parent table structure
[in]handle_lockingif contains HA_OPEN_FOR_REPAIR, warn about incompatible child tables, but continue
[in]callbackfunction to call for each child table
[in]callback_paramdata pointer to give to the callback
[in]need_compat_checkpointer to ha_myisammrg::need_compat_check (we need this one to decide if previously allocated buffers can be reused).
Returns
status
Return values
0OK
!=0 Error
Note
: Currently there is some code duplication between myrg_open() and myrg_parent_open() + myrg_attach_children(). Please duplicate changes in these functions or make common sub-functions.

◆ myrg_detach_children()

int myrg_detach_children ( MYRG_INFO m_info)

Detach children from a MyISAM MERGE parent table.

Parameters
[in]m_infoMERGE parent table structure
Note
Detach must not touch the children in any way. They may have been closed at this point already. All references to the children should be removed.
Returns
status
Return values
0OK

◆ myrg_open()

MYRG_INFO * myrg_open ( const char *  name,
int  mode,
int  handle_locking 
)

◆ myrg_parent_open()

MYRG_INFO * myrg_parent_open ( const char *  parent_name,
int(*)(void *, const char *)  callback,
void *  callback_param 
)

Open parent table of a MyISAM MERGE table.

Open MERGE meta file to get the table name paths for the child tables. Count the children. Allocate and initialize MYRG_INFO structure. Call a callback function for each child table.

Parameters
[in]parent_namemerge table name path as "database/table"
[in]callbackfunction to call for each child table
[in]callback_paramdata pointer to give to the callback
Returns
MYRG_INFO pointer
Return values
!=NULL OK
NULLError
Note
Currently there is some code duplication between myrg_open() and myrg_parent_open() + myrg_attach_children(). Please duplicate changes in these functions or make common sub-functions.