~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to storage/maria/ha_maria.h

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2006,2004 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
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 */
 
15
 
 
16
 
 
17
#ifdef USE_PRAGMA_INTERFACE
 
18
#pragma interface                               /* gcc class implementation */
 
19
#endif
 
20
 
 
21
/* class for the maria handler */
 
22
 
 
23
#include <maria.h>
 
24
 
 
25
#define HA_RECOVER_NONE         0       /* No automatic recover */
 
26
#define HA_RECOVER_DEFAULT      1       /* Automatic recover active */
 
27
#define HA_RECOVER_BACKUP       2       /* Make a backupfile on recover */
 
28
#define HA_RECOVER_FORCE        4       /* Recover even if we loose rows */
 
29
#define HA_RECOVER_QUICK        8       /* Don't check rows in data file */
 
30
 
 
31
extern ulong maria_sort_buffer_size;
 
32
extern TYPELIB maria_recover_typelib;
 
33
extern ulong maria_recover_options;
 
34
 
 
35
class ha_maria :public handler
 
36
{
 
37
  MARIA_HA *file;
 
38
  ulonglong int_table_flags;
 
39
  MARIA_RECORD_POS remember_pos;
 
40
  char *data_file_name, *index_file_name;
 
41
  enum data_file_type data_file_type;
 
42
  bool can_enable_indexes;
 
43
  /**
 
44
    If a transactional table is doing bulk insert with a single
 
45
    UNDO_BULK_INSERT with/without repair. 
 
46
  */
 
47
  uint8 bulk_insert_single_undo;
 
48
  int repair(THD * thd, HA_CHECK *param, bool optimize);
 
49
  int zerofill(THD * thd, HA_CHECK_OPT *check_opt);
 
50
 
 
51
public:
 
52
  ha_maria(handlerton *hton, TABLE_SHARE * table_arg);
 
53
  ~ha_maria() {}
 
54
  handler *clone(MEM_ROOT *mem_root);
 
55
  const char *table_type() const
 
56
  { return "MARIA"; }
 
57
  const char *index_type(uint key_number);
 
58
  const char **bas_ext() const;
 
59
  ulonglong table_flags() const
 
60
  { return int_table_flags; }
 
61
  ulong index_flags(uint inx, uint part, bool all_parts) const
 
62
  {
 
63
    return ((table_share->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
 
64
            0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
 
65
            HA_READ_ORDER | HA_KEYREAD_ONLY);
 
66
  }
 
67
  uint max_supported_keys() const
 
68
  { return MARIA_MAX_KEY; }
 
69
  uint max_supported_key_length() const;
 
70
  uint max_supported_key_part_length() const
 
71
  { return max_supported_key_length(); }
 
72
  enum row_type get_row_type() const;
 
73
  uint checksum() const;
 
74
  virtual double scan_time();
 
75
 
 
76
  int open(const char *name, int mode, uint test_if_locked);
 
77
  int close(void);
 
78
  int write_row(uchar * buf);
 
79
  int update_row(const uchar * old_data, uchar * new_data);
 
80
  int delete_row(const uchar * buf);
 
81
  int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map,
 
82
                     enum ha_rkey_function find_flag);
 
83
  int index_read_idx_map(uchar * buf, uint idx, const uchar * key,
 
84
                         key_part_map keypart_map,
 
85
                         enum ha_rkey_function find_flag);
 
86
  int index_read_last_map(uchar * buf, const uchar * key,
 
87
                          key_part_map keypart_map);
 
88
  int index_next(uchar * buf);
 
89
  int index_prev(uchar * buf);
 
90
  int index_first(uchar * buf);
 
91
  int index_last(uchar * buf);
 
92
  int index_next_same(uchar * buf, const uchar * key, uint keylen);
 
93
  int ft_init()
 
94
  {
 
95
    if (!ft_handler)
 
96
      return 1;
 
97
    ft_handler->please->reinit_search(ft_handler);
 
98
    return 0;
 
99
  }
 
100
  FT_INFO *ft_init_ext(uint flags, uint inx, String * key)
 
101
  {
 
102
    return maria_ft_init_search(flags, file, inx,
 
103
                                (uchar *) key->ptr(), key->length(),
 
104
                                key->charset(), table->record[0]);
 
105
  }
 
106
  int ft_read(uchar * buf);
 
107
  int rnd_init(bool scan);
 
108
  int rnd_end(void);
 
109
  int rnd_next(uchar * buf);
 
110
  int rnd_pos(uchar * buf, uchar * pos);
 
111
  int remember_rnd_pos();
 
112
  int restart_rnd_next(uchar * buf);
 
113
  void position(const uchar * record);
 
114
  int info(uint);
 
115
  int extra(enum ha_extra_function operation);
 
116
  int extra_opt(enum ha_extra_function operation, ulong cache_size);
 
117
  int reset(void);
 
118
  int external_lock(THD * thd, int lock_type);
 
119
  int start_stmt(THD *thd, thr_lock_type lock_type);
 
120
  int delete_all_rows(void);
 
121
  int disable_indexes(uint mode);
 
122
  int enable_indexes(uint mode);
 
123
  int indexes_are_disabled(void);
 
124
  void start_bulk_insert(ha_rows rows);
 
125
  int end_bulk_insert(bool abort);
 
126
  ha_rows records_in_range(uint inx, key_range * min_key, key_range * max_key);
 
127
  void update_create_info(HA_CREATE_INFO * create_info);
 
128
  int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info);
 
129
  THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to,
 
130
                             enum thr_lock_type lock_type);
 
131
  virtual void get_auto_increment(ulonglong offset, ulonglong increment,
 
132
                                  ulonglong nb_desired_values,
 
133
                                  ulonglong *first_value,
 
134
                                  ulonglong *nb_reserved_values);
 
135
  int rename_table(const char *from, const char *to);
 
136
  int delete_table(const char *name);
 
137
  int check(THD * thd, HA_CHECK_OPT * check_opt);
 
138
  int analyze(THD * thd, HA_CHECK_OPT * check_opt);
 
139
  int repair(THD * thd, HA_CHECK_OPT * check_opt);
 
140
  bool check_and_repair(THD * thd);
 
141
  bool is_crashed() const;
 
142
  bool auto_repair() const { return 1; }
 
143
  int optimize(THD * thd, HA_CHECK_OPT * check_opt);
 
144
  int assign_to_keycache(THD * thd, HA_CHECK_OPT * check_opt);
 
145
  int preload_keys(THD * thd, HA_CHECK_OPT * check_opt);
 
146
  bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes);
 
147
#ifdef HAVE_REPLICATION
 
148
  int dump(THD * thd, int fd);
 
149
  int net_read_dump(NET * net);
 
150
#endif
 
151
#ifdef HAVE_QUERY_CACHE
 
152
  my_bool register_query_cache_table(THD *thd, char *table_key,
 
153
                                     uint key_length,
 
154
                                     qc_engine_callback
 
155
                                     *engine_callback,
 
156
                                     ulonglong *engine_data);
 
157
#endif
 
158
  MARIA_HA *file_ptr(void)
 
159
  {
 
160
    return file;
 
161
  }
 
162
  static int implicit_commit(THD *thd);
 
163
};