Eneboo - Documentación para desarrolladores
|
00001 /* Copyright (C) 2000 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; version 2 of the License. 00006 00007 This program is distributed in the hope that it will be useful, 00008 but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 GNU General Public License for more details. 00011 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software 00014 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00015 00016 /* This file should be included when using merge_isam_funktions */ 00017 00018 #ifndef _myisammrg_h 00019 #define _myisammrg_h 00020 #ifdef __cplusplus 00021 extern "C" { 00022 #endif 00023 00024 #ifndef _my_base_h 00025 #include <my_base.h> 00026 #endif 00027 #ifndef _myisam_h 00028 #include <myisam.h> 00029 #endif 00030 00031 #include <queues.h> 00032 00033 #define MYRG_NAME_EXT ".MRG" 00034 00035 /* In which table to INSERT rows */ 00036 #define MERGE_INSERT_DISABLED 0 00037 #define MERGE_INSERT_TO_FIRST 1 00038 #define MERGE_INSERT_TO_LAST 2 00039 00040 extern TYPELIB merge_insert_method; 00041 00042 /* Param to/from myrg_info */ 00043 00044 typedef struct st_mymerge_info /* Struct from h_info */ 00045 { 00046 ulonglong records; /* Records in database */ 00047 ulonglong deleted; /* Deleted records in database */ 00048 ulonglong recpos; /* Pos for last used record */ 00049 ulonglong data_file_length; 00050 uint reclength; /* Recordlength */ 00051 int errkey; /* With key was dupplicated on err */ 00052 uint options; /* HA_OPTION_... used */ 00053 ulong *rec_per_key; /* for sql optimizing */ 00054 } MYMERGE_INFO; 00055 00056 typedef struct st_myrg_table_info 00057 { 00058 struct st_myisam_info *table; 00059 ulonglong file_offset; 00060 } MYRG_TABLE; 00061 00062 typedef struct st_myrg_info 00063 { 00064 MYRG_TABLE *open_tables,*current_table,*end_table,*last_used_table; 00065 ulonglong records; /* records in tables */ 00066 ulonglong del; /* Removed records */ 00067 ulonglong data_file_length; 00068 ulong cache_size; 00069 uint merge_insert_method; 00070 uint tables,options,reclength,keys; 00071 my_bool cache_in_use; 00072 LIST open_list; 00073 QUEUE by_key; 00074 ulong *rec_per_key_part; /* for sql optimizing */ 00075 } MYRG_INFO; 00076 00077 00078 /* Prototypes for merge-functions */ 00079 00080 extern int myrg_close(MYRG_INFO *file); 00081 extern int myrg_delete(MYRG_INFO *file,const byte *buff); 00082 extern MYRG_INFO *myrg_open(const char *name,int mode,int wait_if_locked); 00083 extern int myrg_panic(enum ha_panic_function function); 00084 extern int myrg_rfirst(MYRG_INFO *file,byte *buf,int inx); 00085 extern int myrg_rlast(MYRG_INFO *file,byte *buf,int inx); 00086 extern int myrg_rnext(MYRG_INFO *file,byte *buf,int inx); 00087 extern int myrg_rprev(MYRG_INFO *file,byte *buf,int inx); 00088 extern int myrg_rnext_same(MYRG_INFO *file,byte *buf); 00089 extern int myrg_rkey(MYRG_INFO *file,byte *buf,int inx,const byte *key, 00090 uint key_len, enum ha_rkey_function search_flag); 00091 extern int myrg_rrnd(MYRG_INFO *file,byte *buf,ulonglong pos); 00092 extern int myrg_rsame(MYRG_INFO *file,byte *record,int inx); 00093 extern int myrg_update(MYRG_INFO *file,const byte *old,byte *new_rec); 00094 extern int myrg_write(MYRG_INFO *info,byte *rec); 00095 extern int myrg_status(MYRG_INFO *file,MYMERGE_INFO *x,int flag); 00096 extern int myrg_lock_database(MYRG_INFO *file,int lock_type); 00097 extern int myrg_create(const char *name, const char **table_names, 00098 uint insert_method, my_bool fix_names); 00099 extern int myrg_extra(MYRG_INFO *file,enum ha_extra_function function, 00100 void *extra_arg); 00101 extern void myrg_extrafunc(MYRG_INFO *info,invalidator_by_filename inv); 00102 extern ha_rows myrg_records_in_range(MYRG_INFO *info,int inx, 00103 key_range *min_key, key_range *max_key); 00104 00105 extern ulonglong myrg_position(MYRG_INFO *info); 00106 #ifdef __cplusplus 00107 } 00108 #endif 00109 #endif