~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/handler_structs.h

  • Committer: Padraig O'Sullivan
  • Date: 2010-02-10 16:26:01 UTC
  • mto: This revision was merged to the branch mainline in revision 1294.
  • Revision ID: osullivan.padraig@gmail.com-20100210162601-itx2ndl397pc1wr6
Corrected an order of initialization in a few optimizer classes

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
namespace drizzled
41
41
{
42
42
 
 
43
class Ha_trx_info;
 
44
struct st_key;
 
45
typedef struct st_key KEY;
 
46
typedef struct st_key_cache KEY_CACHE;
 
47
 
 
48
 
43
49
namespace plugin
44
50
{
45
51
class StorageEngine;
46
52
}
47
53
 
 
54
struct Session_TRANS
 
55
{
 
56
  Session_TRANS() :
 
57
    no_2pc(false),
 
58
    ha_list(NULL),
 
59
    modified_non_trans_table(false)
 
60
  {}
 
61
 
 
62
  /* true is not all entries in the engines[] support 2pc */
 
63
  bool        no_2pc;
 
64
  /* storage engines that registered in this transaction */
 
65
  Ha_trx_info *ha_list;
 
66
  /*
 
67
    The purpose of this flag is to keep track of non-transactional
 
68
    tables that were modified in scope of:
 
69
    - transaction, when the variable is a member of
 
70
    Session::transaction.all
 
71
    - top-level statement or sub-statement, when the variable is a
 
72
    member of Session::transaction.stmt
 
73
    This member has the following life cycle:
 
74
    * stmt.modified_non_trans_table is used to keep track of
 
75
    modified non-transactional tables of top-level statements. At
 
76
    the end of the previous statement and at the beginning of the session,
 
77
    it is reset to false.  If such functions
 
78
    as mysql_insert, mysql_update, mysql_delete etc modify a
 
79
    non-transactional table, they set this flag to true.  At the
 
80
    end of the statement, the value of stmt.modified_non_trans_table
 
81
    is merged with all.modified_non_trans_table and gets reset.
 
82
    * all.modified_non_trans_table is reset at the end of transaction
 
83
 
 
84
    * Since we do not have a dedicated context for execution of a
 
85
    sub-statement, to keep track of non-transactional changes in a
 
86
    sub-statement, we re-use stmt.modified_non_trans_table.
 
87
    At entrance into a sub-statement, a copy of the value of
 
88
    stmt.modified_non_trans_table (containing the changes of the
 
89
    outer statement) is saved on stack. Then
 
90
    stmt.modified_non_trans_table is reset to false and the
 
91
    substatement is executed. Then the new value is merged with the
 
92
    saved value.
 
93
  */
 
94
  bool modified_non_trans_table;
 
95
 
 
96
  void reset() { no_2pc= false; modified_non_trans_table= false; }
 
97
};
 
98
 
48
99
typedef struct st_ha_create_information
49
100
{
50
101
  const CHARSET_INFO *table_charset, *default_table_charset;
52
103
  uint64_t auto_increment_value;
53
104
  uint32_t table_options;
54
105
  uint32_t used_fields;
 
106
  enum row_type row_type;
55
107
  plugin::StorageEngine *db_type;
56
108
  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
 
  { }
68
109
} HA_CREATE_INFO;
69
110
 
70
111
typedef struct st_ha_alter_information
71
112
{
72
 
  KeyInfo  *key_info_buffer;
 
113
  KEY  *key_info_buffer;
73
114
  uint32_t key_count;
74
115
  uint32_t index_drop_count;
75
116
  uint32_t *index_drop_buffer;
76
117
  uint32_t index_add_count;
77
118
  uint32_t *index_add_buffer;
78
119
  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
120
} HA_ALTER_INFO;
91
121
 
92
122
 
136
166
  uint32_t (*next) (range_seq_t seq, KEY_MULTI_RANGE *range);
137
167
} RANGE_SEQ_IF;
138
168
 
 
169
/*
 
170
  This is a buffer area that the handler can use to store rows.
 
171
  'end_of_used_area' should be kept updated after calls to
 
172
  read-functions so that other parts of the code can use the
 
173
  remaining area (until next read calls is issued).
 
174
*/
 
175
 
 
176
typedef struct st_handler_buffer
 
177
{
 
178
  unsigned char *buffer;         /* Buffer one can start using */
 
179
  unsigned char *buffer_end;     /* End of buffer */
 
180
  unsigned char *end_of_used_area;     /* End of area that was used by handler */
 
181
} HANDLER_BUFFER;
 
182
 
139
183
} /* namespace drizzled */
140
184
 
141
185
#endif /* DRIZZLED_HANDLER_STRUCTS_H */