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