MySQL  8.0.26
Source Code Documentation
myisammrg.h File Reference

This file should be included when using merge isam functions. More...

#include <sys/types.h>
#include "my_base.h"
#include "my_inttypes.h"
#include "my_list.h"
#include "my_macros.h"
#include "myisam.h"
#include "mysql/psi/mysql_mutex.h"
#include "storage/myisam/queues.h"
#include "typelib.h"

Go to the source code of this file.

Classes

struct  MYMERGE_INFO
 
struct  MYRG_TABLE
 
struct  MYRG_INFO
 

Macros

#define MYRG_NAME_EXT   ".MRG"
 
#define MERGE_INSERT_DISABLED   0
 
#define MERGE_INSERT_TO_FIRST   1
 
#define MERGE_INSERT_TO_LAST   2
 

Functions

int myrg_close (MYRG_INFO *file)
 
int myrg_delete (MYRG_INFO *file, const uchar *buff)
 
MYRG_INFOmyrg_open (const char *name, int mode, int wait_if_locked)
 
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...
 
int myrg_panic (enum ha_panic_function function)
 
int myrg_rfirst (MYRG_INFO *file, uchar *buf, int inx)
 
int myrg_rlast (MYRG_INFO *file, uchar *buf, int inx)
 
int myrg_rnext (MYRG_INFO *file, uchar *buf, int inx)
 
int myrg_rprev (MYRG_INFO *file, uchar *buf, int inx)
 
int myrg_rnext_same (MYRG_INFO *file, uchar *buf)
 
int myrg_rkey (MYRG_INFO *info, uchar *buf, int inx, const uchar *key, key_part_map keypart_map, enum ha_rkey_function search_flag)
 
int myrg_rrnd (MYRG_INFO *file, uchar *buf, ulonglong pos)
 
int myrg_update (MYRG_INFO *file, const uchar *old, uchar *new_rec)
 
int myrg_write (MYRG_INFO *info, uchar *rec)
 
int myrg_status (MYRG_INFO *file, MYMERGE_INFO *x, int flag)
 
int myrg_lock_database (MYRG_INFO *file, int lock_type)
 
int myrg_create (const char *name, const char **table_names, uint insert_method, bool fix_names)
 
int myrg_extra (MYRG_INFO *file, enum ha_extra_function function, void *extra_arg)
 
int myrg_reset (MYRG_INFO *info)
 
ha_rows myrg_records_in_range (MYRG_INFO *info, int inx, key_range *min_key, key_range *max_key)
 
ha_rows myrg_records (MYRG_INFO *info)
 
ulonglong myrg_position (MYRG_INFO *info)
 

Variables

TYPELIB merge_insert_method
 

Detailed Description

This file should be included when using merge isam functions.

Macro Definition Documentation

◆ MERGE_INSERT_DISABLED

#define MERGE_INSERT_DISABLED   0

◆ MERGE_INSERT_TO_FIRST

#define MERGE_INSERT_TO_FIRST   1

◆ MERGE_INSERT_TO_LAST

#define MERGE_INSERT_TO_LAST   2

◆ MYRG_NAME_EXT

#define MYRG_NAME_EXT   ".MRG"

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_close()

int myrg_close ( MYRG_INFO file)

◆ myrg_create()

int myrg_create ( const char *  name,
const char **  table_names,
uint  insert_method,
bool  fix_names 
)

◆ myrg_delete()

int myrg_delete ( MYRG_INFO file,
const uchar buff 
)

◆ 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 ths point already. All references to the children should be removed.
Returns
status
Return values
0OK

◆ myrg_extra()

int myrg_extra ( MYRG_INFO file,
enum ha_extra_function  function,
void *  extra_arg 
)

◆ myrg_lock_database()

int myrg_lock_database ( MYRG_INFO file,
int  lock_type 
)

◆ myrg_open()

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

◆ myrg_panic()

int myrg_panic ( enum ha_panic_function  function)

◆ 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.

◆ myrg_position()

ulonglong myrg_position ( MYRG_INFO info)

◆ myrg_records()

ha_rows myrg_records ( MYRG_INFO info)

◆ myrg_records_in_range()

ha_rows myrg_records_in_range ( MYRG_INFO info,
int  inx,
key_range min_key,
key_range max_key 
)

◆ myrg_reset()

int myrg_reset ( MYRG_INFO info)

◆ myrg_rfirst()

int myrg_rfirst ( MYRG_INFO file,
uchar buf,
int  inx 
)

◆ myrg_rkey()

int myrg_rkey ( MYRG_INFO info,
uchar buf,
int  inx,
const uchar key,
key_part_map  keypart_map,
enum ha_rkey_function  search_flag 
)

◆ myrg_rlast()

int myrg_rlast ( MYRG_INFO file,
uchar buf,
int  inx 
)

◆ myrg_rnext()

int myrg_rnext ( MYRG_INFO file,
uchar buf,
int  inx 
)

◆ myrg_rnext_same()

int myrg_rnext_same ( MYRG_INFO file,
uchar buf 
)

◆ myrg_rprev()

int myrg_rprev ( MYRG_INFO file,
uchar buf,
int  inx 
)

◆ myrg_rrnd()

int myrg_rrnd ( MYRG_INFO file,
uchar buf,
ulonglong  pos 
)

◆ myrg_status()

int myrg_status ( MYRG_INFO file,
MYMERGE_INFO x,
int  flag 
)

◆ myrg_update()

int myrg_update ( MYRG_INFO file,
const uchar old,
uchar new_rec 
)

◆ myrg_write()

int myrg_write ( MYRG_INFO info,
uchar rec 
)

Variable Documentation

◆ merge_insert_method

TYPELIB merge_insert_method
extern