~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler_structs.h

  • Committer: Lee
  • Date: 2009-01-01 17:36:53 UTC
  • mto: (758.1.3 devel)
  • mto: This revision was merged to the branch mainline in revision 759.
  • Revision ID: lbieber@lbieber-desktop-20090101173653-qo5945pnje5j3vuu
more header file cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
#ifndef DRIZZLED_HANDLER_STRUCTS_H
21
21
#define DRIZZLED_HANDLER_STRUCTS_H
22
22
 
23
 
#if TIME_WITH_SYS_TIME
24
 
# include <sys/time.h>
25
 
# include <time.h>
26
 
#else
27
 
# if HAVE_SYS_TIME_H
28
 
#  include <sys/time.h>
29
 
# else
30
 
#  include <time.h>
31
 
# endif
32
 
#endif
 
23
#include <stdint.h>
 
24
#include <time.h>
33
25
 
34
26
#include <drizzled/base.h>
35
27
#include <drizzled/structs.h>
36
28
#include <drizzled/definitions.h>
37
29
#include <drizzled/lex_string.h>
38
 
#include "drizzled/global_charset_info.h"
39
 
 
40
 
namespace drizzled
41
 
{
42
 
 
43
 
namespace plugin
44
 
{
45
 
class StorageEngine;
46
 
}
 
30
 
 
31
class Ha_trx_info;
 
32
struct handlerton;
 
33
struct st_key;
 
34
typedef struct st_key KEY;
 
35
struct st_key_cache;
 
36
typedef struct st_key_cache KEY_CACHE;
 
37
 
 
38
struct Session_TRANS
 
39
{
 
40
  /* true is not all entries in the ht[] support 2pc */
 
41
  bool        no_2pc;
 
42
  /* storage engines that registered in this transaction */
 
43
  Ha_trx_info *ha_list;
 
44
  /*
 
45
    The purpose of this flag is to keep track of non-transactional
 
46
    tables that were modified in scope of:
 
47
    - transaction, when the variable is a member of
 
48
    Session::transaction.all
 
49
    - top-level statement or sub-statement, when the variable is a
 
50
    member of Session::transaction.stmt
 
51
    This member has the following life cycle:
 
52
    * stmt.modified_non_trans_table is used to keep track of
 
53
    modified non-transactional tables of top-level statements. At
 
54
    the end of the previous statement and at the beginning of the session,
 
55
    it is reset to false.  If such functions
 
56
    as mysql_insert, mysql_update, mysql_delete etc modify a
 
57
    non-transactional table, they set this flag to true.  At the
 
58
    end of the statement, the value of stmt.modified_non_trans_table
 
59
    is merged with all.modified_non_trans_table and gets reset.
 
60
    * all.modified_non_trans_table is reset at the end of transaction
 
61
 
 
62
    * Since we do not have a dedicated context for execution of a
 
63
    sub-statement, to keep track of non-transactional changes in a
 
64
    sub-statement, we re-use stmt.modified_non_trans_table.
 
65
    At entrance into a sub-statement, a copy of the value of
 
66
    stmt.modified_non_trans_table (containing the changes of the
 
67
    outer statement) is saved on stack. Then
 
68
    stmt.modified_non_trans_table is reset to false and the
 
69
    substatement is executed. Then the new value is merged with the
 
70
    saved value.
 
71
  */
 
72
  bool modified_non_trans_table;
 
73
 
 
74
  void reset() { no_2pc= false; modified_non_trans_table= false; }
 
75
};
 
76
 
 
77
typedef struct {
 
78
  uint64_t data_file_length;
 
79
  uint64_t max_data_file_length;
 
80
  uint64_t index_file_length;
 
81
  uint64_t delete_length;
 
82
  ha_rows records;
 
83
  uint32_t mean_rec_length;
 
84
  time_t create_time;
 
85
  time_t check_time;
 
86
  time_t update_time;
 
87
  uint64_t check_sum;
 
88
} PARTITION_INFO;
47
89
 
48
90
typedef struct st_ha_create_information
49
91
{
50
92
  const CHARSET_INFO *table_charset, *default_table_charset;
 
93
  LEX_STRING connect_string;
 
94
  LEX_STRING comment;
 
95
  const char *data_file_name, *index_file_name;
51
96
  const char *alias;
 
97
  uint64_t max_rows,min_rows;
52
98
  uint64_t auto_increment_value;
53
99
  uint32_t table_options;
 
100
  uint32_t avg_row_length;
54
101
  uint32_t used_fields;
55
 
  plugin::StorageEngine *db_type;
 
102
  uint32_t key_block_size;
 
103
  uint32_t block_size;
 
104
  handlerton *db_type;
 
105
  enum row_type row_type;
 
106
  uint32_t null_bits;                       /* NULL bits at start of record */
 
107
  uint32_t options;                         /* OR of HA_CREATE_ options */
 
108
  uint32_t extra_size;                      /* length of extra data segment */
56
109
  bool table_existed;                   /* 1 in create if table existed */
57
 
 
58
 
  st_ha_create_information() :
59
 
    table_charset(0),
60
 
    default_table_charset(0),
61
 
    alias(0),
62
 
    auto_increment_value(0),
63
 
    table_options(0),
64
 
    used_fields(0),
65
 
    db_type(0),
66
 
    table_existed(0)
67
 
  { }
 
110
  bool varchar;                         /* 1 if table has a VARCHAR */
 
111
  enum ha_choice page_checksum;         /* If we have page_checksums */
68
112
} HA_CREATE_INFO;
69
113
 
70
114
typedef struct st_ha_alter_information
71
115
{
72
 
  KeyInfo  *key_info_buffer;
 
116
  KEY  *key_info_buffer;
73
117
  uint32_t key_count;
74
118
  uint32_t index_drop_count;
75
119
  uint32_t *index_drop_buffer;
76
120
  uint32_t index_add_count;
77
121
  uint32_t *index_add_buffer;
78
122
  void *data;
79
 
 
80
 
  st_ha_alter_information() :
81
 
    key_info_buffer(0),
82
 
    key_count(0),
83
 
    index_drop_count(0),
84
 
    index_drop_buffer(0),
85
 
    index_add_count(0),
86
 
    index_add_buffer(0),
87
 
    data(0)
88
 
  { }
89
 
 
90
123
} HA_ALTER_INFO;
91
124
 
92
125
 
94
127
{
95
128
  enum ha_key_alg algorithm;
96
129
  uint32_t block_size;
 
130
  LEX_STRING parser_name;
97
131
  LEX_STRING comment;
98
132
} KEY_CREATE_INFO;
99
133
 
101
135
typedef struct st_ha_check_opt
102
136
{
103
137
  st_ha_check_opt() {}                        /* Remove gcc warning */
 
138
  uint32_t sort_buffer_size;
 
139
  uint32_t flags;       /* isam layer flags (e.g. for myisamchk) */
 
140
  /* sql layer flags - for something myisamchk cannot do */
 
141
  uint32_t sql_flags;
 
142
  /* new key cache when changing key cache */
 
143
  KEY_CACHE *key_cache;
 
144
  void init();
104
145
} HA_CHECK_OPT;
105
146
 
106
147
 
136
177
  uint32_t (*next) (range_seq_t seq, KEY_MULTI_RANGE *range);
137
178
} RANGE_SEQ_IF;
138
179
 
139
 
} /* namespace drizzled */
 
180
/*
 
181
  This is a buffer area that the handler can use to store rows.
 
182
  'end_of_used_area' should be kept updated after calls to
 
183
  read-functions so that other parts of the code can use the
 
184
  remaining area (until next read calls is issued).
 
185
*/
 
186
 
 
187
typedef struct st_handler_buffer
 
188
{
 
189
  unsigned char *buffer;         /* Buffer one can start using */
 
190
  unsigned char *buffer_end;     /* End of buffer */
 
191
  unsigned char *end_of_used_area;     /* End of area that was used by handler */
 
192
} HANDLER_BUFFER;
140
193
 
141
194
#endif /* DRIZZLED_HANDLER_STRUCTS_H */