120
98
session->ha_data[xxx_engine.slot]
122
100
slot number is initialized by MySQL after xxx_init() is called.
126
StorageEngine(const std::string name_arg,
127
const std::bitset<HTON_BIT_SIZE> &flags_arg= HTON_NO_FLAGS,
128
size_t savepoint_offset_arg= 0,
129
bool support_2pc= false);
131
virtual ~StorageEngine();
133
const std::vector<std::string>& getAliases()
138
void addAlias(std::string alias)
140
aliases.push_back(alias);
103
std::bitset<HTON_BIT_SIZE> flags; /* global handler flags */
105
to store per-savepoint data storage engine is provided with an area
106
of a requested size (0 is ok here).
107
savepoint_offset must be initialized statically to the size of
108
the needed memory to store per-savepoint information.
109
After xxx_init it is changed to be an offset to savepoint storage
110
area and need not be used by storage engine.
111
see binlog_engine and binlog_savepoint_set/rollback for an example.
113
uint32_t savepoint_offset;
114
uint32_t license; /* Flag for Engine License */
116
StorageEngine(const std::string &name_arg, bool support_2pc= false)
117
: name(name_arg), _2pc(support_2pc), savepoint_offset(0) {}
118
virtual ~StorageEngine() {}
145
return two_phase_commit;
149
bool is_enabled() const
154
bool is_user_selectable() const
156
return not flags.test(HTON_BIT_NOT_USER_SELECTABLE);
159
bool check_flag(const engine_flag_bits flag) const
161
return flags.test(flag);
164
void enable() { enabled= true; }
165
void disable() { enabled= false; }
167
std::string getName() const { return name; }
170
StorageEngine methods:
172
close_connection is only called if
173
session->ha_data[xxx_engine.slot] is non-zero, so even if you don't need
174
this storage area - set it to something, so that MySQL would know
175
this storage engine was accessed in this connection
177
virtual int close_connection(Session *)
182
'all' is true if it's a real commit, that makes persistent changes
183
'all' is false if it's not in fact a commit but an end of the
184
statement that is part of the transaction.
185
NOTE 'all' is also false in auto-commit mode where 'end of statement'
186
and 'real commit' mean the same event.
188
virtual int commit(Session *, bool)
193
virtual int rollback(Session *, bool)
199
The void * points to an uninitialized storage area of requested size
200
(see savepoint_offset description)
202
int savepoint_set(Session *session, void *sp)
204
return savepoint_set_hook(session, (unsigned char *)sp+savepoint_offset);
208
The void * points to a storage area, that was earlier passed
209
to the savepoint_set call
211
int savepoint_rollback(Session *session, void *sp)
213
return savepoint_rollback_hook(session,
214
(unsigned char *)sp+savepoint_offset);
217
int savepoint_release(Session *session, void *sp)
219
return savepoint_release_hook(session,
220
(unsigned char *)sp+savepoint_offset);
223
virtual int prepare(Session *, bool) { return 0; }
224
virtual int recover(XID *, uint32_t) { return 0; }
225
virtual int commit_by_xid(XID *) { return 0; }
226
virtual int rollback_by_xid(XID *) { return 0; }
227
virtual handler *create(TABLE_SHARE *, MEM_ROOT *)= 0;
229
virtual void drop_database(char*) { }
230
virtual int start_consistent_snapshot(Session *) { return 0; }
231
virtual bool flush_logs() { return false; }
232
virtual bool show_status(Session *, stat_print_fn *, enum ha_stat_type)
237
/* args: current_session, tables, cond */
238
virtual int fill_files_table(Session *, TableList *,
239
Item *) { return 0; }
240
virtual int release_temporary_latches(Session *) { return false; }
242
/* args: current_session, db, name */
243
virtual int table_exists_in_engine(Session*, const char *, const char *);
127
bool is_enabled() const
129
return (state == SHOW_OPTION_YES);
132
std::string get_name() { return name; }
135
StorageEngine methods:
137
close_connection is only called if
138
session->ha_data[xxx_engine.slot] is non-zero, so even if you don't need
139
this storage area - set it to something, so that MySQL would know
140
this storage engine was accessed in this connection
142
virtual int close_connection(Session *)
147
The void * points to an uninitialized storage area of requested size
148
(see savepoint_offset description)
150
virtual int savepoint_set(Session *, void *)
156
The void * points to a storage area, that was earlier passed
157
to the savepoint_set call
159
virtual int savepoint_rollback(Session *, void *)
164
virtual int savepoint_release(Session *, void *)
170
'all' is true if it's a real commit, that makes persistent changes
171
'all' is false if it's not in fact a commit but an end of the
172
statement that is part of the transaction.
173
NOTE 'all' is also false in auto-commit mode where 'end of statement'
174
and 'real commit' mean the same event.
176
virtual int commit(Session *, bool)
181
virtual int rollback(Session *, bool)
186
virtual int prepare(Session *, bool) { return 0; }
187
virtual int recover(XID *, uint32_t) { return 0; }
188
virtual int commit_by_xid(XID *) { return 0; }
189
virtual int rollback_by_xid(XID *) { return 0; }
190
virtual handler *create(TABLE_SHARE *, MEM_ROOT *)= 0;
192
virtual void drop_database(char*) { }
193
virtual int start_consistent_snapshot(Session *) { return 0; }
194
virtual bool flush_logs() { return false; }
195
virtual bool show_status(Session *, stat_print_fn *, enum ha_stat_type)
200
/* args: current_session, tables, cond */
201
virtual int fill_files_table(Session *, TableList *,
202
Item *) { return 0; }
203
virtual int release_temporary_latches(Session *) { return false; }
205
/* args: current_session, db, name */
206
virtual int table_exists_in_engine(Session*, const char *, const char *);
247
211
StorageEngine *ha_default_storage_engine(Session *session);
248
StorageEngine *ha_resolve_by_name(Session *session, const LEX_STRING *name);
212
plugin_ref ha_resolve_by_name(Session *session, const LEX_STRING *name);
213
plugin_ref ha_lock_engine(Session *session, StorageEngine *engine);
249
214
handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
250
215
StorageEngine *db_type);
251
const std::string ha_resolve_storage_engine_name(const StorageEngine *db_type);
216
const char *ha_resolve_storage_engine_name(const StorageEngine *db_type);
217
bool ha_check_storage_engine_flag(const StorageEngine *db_type, const engine_flag_bits flag);
218
LEX_STRING *ha_storage_engine_name(const StorageEngine *engine);
253
#endif /* DRIZZLED_PLUGIN_STORAGE_ENGINE_H */
220
#endif /* DRIZZLED_HANDLERTON_H */