starfix: HoR fix!!! wave+team check fix+2 bos jalan...kurang LK nya + PR:lootannya...
[st4rcore.git] / dep / mysqllite / include / myisammrg.h
blob31ce3fa47b8cd11f6b51462a45d119472662a9c5
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 */
18 #ifndef _myisammrg_h
19 #define _myisammrg_h
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
24 #ifndef _my_base_h
25 #include <my_base.h>
26 #endif
27 #ifndef _myisam_h
28 #include <myisam.h>
29 #endif
31 #include <queues.h>
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 ulonglong records; /* Records in database */
47 ulonglong deleted; /* Deleted records in database */
48 ulonglong recpos; /* Pos for last used record */
49 ulonglong data_file_length;
50 ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */
51 uint reclength; /* Recordlength */
52 int errkey; /* With key was dupplicated on err */
53 uint options; /* HA_OPTION_... used */
54 ulong *rec_per_key; /* for sql optimizing */
55 } MYMERGE_INFO;
57 typedef struct st_myrg_table_info
59 struct st_myisam_info *table;
60 ulonglong file_offset;
61 } MYRG_TABLE;
63 typedef struct st_myrg_info
65 MYRG_TABLE *open_tables,*current_table,*end_table,*last_used_table;
66 ulonglong records; /* records in tables */
67 ulonglong del; /* Removed records */
68 ulonglong data_file_length;
69 ulong cache_size;
70 uint merge_insert_method;
71 uint tables,options,reclength,keys;
72 my_bool cache_in_use;
73 /* If MERGE children attached to parent. See top comment in ha_myisammrg.cc */
74 my_bool children_attached;
75 LIST open_list;
76 QUEUE by_key;
77 ulong *rec_per_key_part; /* for sql optimizing */
78 pthread_mutex_t mutex;
79 } MYRG_INFO;
82 /* Prototypes for merge-functions */
84 extern int myrg_close(MYRG_INFO *file);
85 extern int myrg_delete(MYRG_INFO *file,const uchar *buff);
86 extern MYRG_INFO *myrg_open(const char *name,int mode,int wait_if_locked);
87 extern MYRG_INFO *myrg_parent_open(const char *parent_name,
88 int (*callback)(void*, const char*),
89 void *callback_param);
90 extern int myrg_attach_children(MYRG_INFO *m_info, int handle_locking,
91 MI_INFO *(*callback)(void*),
92 void *callback_param,
93 my_bool *need_compat_check);
94 extern int myrg_detach_children(MYRG_INFO *m_info);
95 extern int myrg_panic(enum ha_panic_function function);
96 extern int myrg_rfirst(MYRG_INFO *file,uchar *buf,int inx);
97 extern int myrg_rlast(MYRG_INFO *file,uchar *buf,int inx);
98 extern int myrg_rnext(MYRG_INFO *file,uchar *buf,int inx);
99 extern int myrg_rprev(MYRG_INFO *file,uchar *buf,int inx);
100 extern int myrg_rnext_same(MYRG_INFO *file,uchar *buf);
101 extern int myrg_rkey(MYRG_INFO *info,uchar *buf,int inx, const uchar *key,
102 key_part_map keypart_map, enum ha_rkey_function search_flag);
103 extern int myrg_rrnd(MYRG_INFO *file,uchar *buf,ulonglong pos);
104 extern int myrg_rsame(MYRG_INFO *file,uchar *record,int inx);
105 extern int myrg_update(MYRG_INFO *file,const uchar *old,uchar *new_rec);
106 extern int myrg_write(MYRG_INFO *info,uchar *rec);
107 extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag);
108 extern int myrg_lock_database(MYRG_INFO *file,int lock_type);
109 extern int myrg_create(const char *name, const char **table_names,
110 uint insert_method, my_bool fix_names);
111 extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function,
112 void *extra_arg);
113 extern int myrg_reset(MYRG_INFO *info);
114 extern void myrg_extrafunc(MYRG_INFO *info,invalidator_by_filename inv);
115 extern ha_rows myrg_records_in_range(MYRG_INFO *info, int inx,
116 key_range *min_key, key_range *max_key);
117 extern ha_rows myrg_records(MYRG_INFO *info);
119 extern ulonglong myrg_position(MYRG_INFO *info);
120 #ifdef __cplusplus
122 #endif
123 #endif