merge.h
Upload User: tsgydb
Upload Date: 2007-04-14
Package Size: 10674k
Code Size: 3k
Category:

MySQL

Development Platform:

Visual C++

  1. /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
  2.    
  3.    This library is free software; you can redistribute it and/or
  4.    modify it under the terms of the GNU Library General Public
  5.    License as published by the Free Software Foundation; either
  6.    version 2 of the License, or (at your option) any later version.
  7.    
  8.    This library is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11.    Library General Public License for more details.
  12.    
  13.    You should have received a copy of the GNU Library General Public
  14.    License along with this library; if not, write to the Free
  15.    Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  16.    MA 02111-1307, USA */
  17. /* This file should be included when using merge_isam_funktions */
  18. /* Author: Michael Widenius */
  19. #ifndef _merge_h
  20. #define _merge_h
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. #ifndef _my_base_h
  25. #include <my_base.h>
  26. #endif
  27. #ifndef _nisam_h
  28. #include <nisam.h>
  29. #endif
  30. #define MRG_NAME_EXT ".MRG"
  31. /* Param to/from mrg_info */
  32. typedef struct st_mrg_info /* Struct from h_info */
  33. {
  34.   ulonglong records; /* Records in database */
  35.   ulonglong deleted; /* Deleted records in database */
  36.   ulonglong recpos; /* Pos for last used record */
  37.   ulonglong data_file_length;
  38.   uint reclength; /* Recordlength */
  39.   int errkey; /* With key was dupplicated on err */
  40.   uint options; /* HA_OPTIONS_... used */
  41. } MERGE_INFO;
  42. typedef struct st_mrg_table_info
  43. {
  44.   N_INFO *table;
  45.   ulonglong file_offset;
  46. } MRG_TABLE;
  47. typedef struct st_merge
  48. {
  49.   MRG_TABLE *open_tables,*current_table,*end_table,*last_used_table;
  50.   ulonglong records; /* records in tables */
  51.   ulonglong del; /* Removed records */
  52.   ulonglong data_file_length;
  53.   uint  tables,options,reclength;
  54.   my_bool cache_in_use;
  55.   LIST open_list;
  56. } MRG_INFO;
  57. typedef ulong mrg_off_t;
  58. /* Prototypes for merge-functions */
  59. extern int mrg_close(MRG_INFO *file);
  60. extern int mrg_delete(MRG_INFO *file,const byte *buff);
  61. extern MRG_INFO *mrg_open(const char *name,int mode,int wait_if_locked);
  62. extern int mrg_panic(enum ha_panic_function function);
  63. extern int mrg_rfirst(MRG_INFO *file,byte *buf,int inx);
  64. extern int mrg_rkey(MRG_INFO *file,byte *buf,int inx,const byte *key,
  65.        uint key_len, enum ha_rkey_function search_flag);
  66. extern int mrg_rrnd(MRG_INFO *file,byte *buf, mrg_off_t pos);
  67. extern int mrg_rsame(MRG_INFO *file,byte *record,int inx);
  68. extern int mrg_update(MRG_INFO *file,const byte *old,const byte *new_rec);
  69. extern int mrg_info(MRG_INFO *file,MERGE_INFO *x,int flag);
  70. extern int mrg_lock_database(MRG_INFO *file,int lock_type);
  71. extern int mrg_create(const char *name,const char **table_names);
  72. extern int mrg_extra(MRG_INFO *file,enum ha_extra_function function);
  73. extern ha_rows mrg_records_in_range(MRG_INFO *info,int inx,
  74.     const byte *start_key,uint start_key_len,
  75.     enum ha_rkey_function start_search_flag,
  76.     const byte *end_key,uint end_key_len,
  77.     enum ha_rkey_function end_search_flag);
  78. extern mrg_off_t mrg_position(MRG_INFO *info);
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif