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 */
24
#include <drizzled/base.h>
31
#define MYRG_NAME_EXT ".MRG"
33
/* In which table to INSERT rows */
34
#define MERGE_INSERT_DISABLED 0
35
#define MERGE_INSERT_TO_FIRST 1
36
#define MERGE_INSERT_TO_LAST 2
38
extern TYPELIB merge_insert_method;
40
/* Param to/from myrg_info */
42
typedef struct st_mymerge_info /* Struct from h_info */
44
uint64_t records; /* Records in database */
45
uint64_t deleted; /* Deleted records in database */
46
uint64_t recpos; /* Pos for last used record */
47
uint64_t data_file_length;
48
uint reclength; /* Recordlength */
49
int errkey; /* With key was dupplicated on err */
50
uint options; /* HA_OPTION_... used */
51
ulong *rec_per_key; /* for sql optimizing */
54
typedef struct st_myrg_table_info
56
struct st_myisam_info *table;
60
typedef struct st_myrg_info
62
MYRG_TABLE *open_tables,*current_table,*end_table,*last_used_table;
63
uint64_t records; /* records in tables */
64
uint64_t del; /* Removed records */
65
uint64_t data_file_length;
67
uint merge_insert_method;
68
uint tables,options,reclength,keys;
70
/* If MERGE children attached to parent. See top comment in ha_myisammrg.cc */
71
bool children_attached;
74
ulong *rec_per_key_part; /* for sql optimizing */
75
pthread_mutex_t mutex;
79
/* Prototypes for merge-functions */
81
extern int myrg_close(MYRG_INFO *file);
82
extern int myrg_delete(MYRG_INFO *file,const uchar *buff);
83
extern MYRG_INFO *myrg_open(const char *name,int mode,int wait_if_locked);
84
extern MYRG_INFO *myrg_parent_open(const char *parent_name,
85
int (*callback)(void*, const char*),
86
void *callback_param);
87
extern int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
88
MI_INFO *(*callback)(void*),
89
void *callback_param);
90
extern int myrg_detach_children(MYRG_INFO *m_info);
91
extern int myrg_panic(enum ha_panic_function function);
92
extern int myrg_rfirst(MYRG_INFO *file,uchar *buf,int inx);
93
extern int myrg_rlast(MYRG_INFO *file,uchar *buf,int inx);
94
extern int myrg_rnext(MYRG_INFO *file,uchar *buf,int inx);
95
extern int myrg_rprev(MYRG_INFO *file,uchar *buf,int inx);
96
extern int myrg_rnext_same(MYRG_INFO *file,uchar *buf);
97
extern int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key,
98
key_part_map keypart_map, enum ha_rkey_function search_flag);
99
extern int myrg_rrnd(MYRG_INFO *file,uchar *buf,uint64_t pos);
100
extern int myrg_rsame(MYRG_INFO *file,uchar *record,int inx);
101
extern int myrg_update(MYRG_INFO *file,const uchar *old,uchar *new_rec);
102
extern int myrg_write(MYRG_INFO *info,uchar *rec);
103
extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag);
104
extern int myrg_lock_database(MYRG_INFO *file,int lock_type);
105
extern int myrg_create(const char *name, const char **table_names,
106
uint insert_method, bool fix_names);
107
extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function,
109
extern int myrg_reset(MYRG_INFO *info);
110
extern void myrg_extrafunc(MYRG_INFO *info,invalidator_by_filename inv);
111
extern ha_rows myrg_records_in_range(MYRG_INFO *info, int inx,
112
key_range *min_key, key_range *max_key);
114
extern uint64_t myrg_position(MYRG_INFO *info);