1
/* Copyright (C) 2000 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
16
/* This file should be included when using merge_isam_funktions */
33
#define MYRG_NAME_EXT ".MRG"
35
/* In which table to INSERT rows */
36
#define MERGE_INSERT_DISABLED 0
37
#define MERGE_INSERT_TO_FIRST 1
38
#define MERGE_INSERT_TO_LAST 2
40
extern TYPELIB merge_insert_method;
42
/* Param to/from myrg_info */
44
typedef struct st_mymerge_info /* Struct from h_info */
46
uint64_t records; /* Records in database */
47
uint64_t deleted; /* Deleted records in database */
48
uint64_t recpos; /* Pos for last used record */
49
uint64_t data_file_length;
50
uint reclength; /* Recordlength */
51
int errkey; /* With key was dupplicated on err */
52
uint options; /* HA_OPTION_... used */
53
ulong *rec_per_key; /* for sql optimizing */
56
typedef struct st_myrg_table_info
58
struct st_myisam_info *table;
62
typedef struct st_myrg_info
64
MYRG_TABLE *open_tables,*current_table,*end_table,*last_used_table;
65
uint64_t records; /* records in tables */
66
uint64_t del; /* Removed records */
67
uint64_t data_file_length;
69
uint merge_insert_method;
70
uint tables,options,reclength,keys;
72
/* If MERGE children attached to parent. See top comment in ha_myisammrg.cc */
73
my_bool children_attached;
76
ulong *rec_per_key_part; /* for sql optimizing */
77
pthread_mutex_t mutex;
81
/* Prototypes for merge-functions */
83
extern int myrg_close(MYRG_INFO *file);
84
extern int myrg_delete(MYRG_INFO *file,const uchar *buff);
85
extern MYRG_INFO *myrg_open(const char *name,int mode,int wait_if_locked);
86
extern MYRG_INFO *myrg_parent_open(const char *parent_name,
87
int (*callback)(void*, const char*),
88
void *callback_param);
89
extern int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
90
MI_INFO *(*callback)(void*),
91
void *callback_param);
92
extern int myrg_detach_children(MYRG_INFO *m_info);
93
extern int myrg_panic(enum ha_panic_function function);
94
extern int myrg_rfirst(MYRG_INFO *file,uchar *buf,int inx);
95
extern int myrg_rlast(MYRG_INFO *file,uchar *buf,int inx);
96
extern int myrg_rnext(MYRG_INFO *file,uchar *buf,int inx);
97
extern int myrg_rprev(MYRG_INFO *file,uchar *buf,int inx);
98
extern int myrg_rnext_same(MYRG_INFO *file,uchar *buf);
99
extern int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key,
100
key_part_map keypart_map, enum ha_rkey_function search_flag);
101
extern int myrg_rrnd(MYRG_INFO *file,uchar *buf,uint64_t pos);
102
extern int myrg_rsame(MYRG_INFO *file,uchar *record,int inx);
103
extern int myrg_update(MYRG_INFO *file,const uchar *old,uchar *new_rec);
104
extern int myrg_write(MYRG_INFO *info,uchar *rec);
105
extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag);
106
extern int myrg_lock_database(MYRG_INFO *file,int lock_type);
107
extern int myrg_create(const char *name, const char **table_names,
108
uint insert_method, my_bool fix_names);
109
extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function,
111
extern int myrg_reset(MYRG_INFO *info);
112
extern void myrg_extrafunc(MYRG_INFO *info,invalidator_by_filename inv);
113
extern ha_rows myrg_records_in_range(MYRG_INFO *info, int inx,
114
key_range *min_key, key_range *max_key);
116
extern uint64_t myrg_position(MYRG_INFO *info);