MySQL 5.6.14 Source Code Document
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
ha_example.h
Go to the documentation of this file.
1
/* Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
15
34
#include "my_global.h"
/* ulonglong */
35
#include "thr_lock.h"
/* THR_LOCK, THR_LOCK_DATA */
36
#include "handler.h"
/* handler */
37
#include "my_base.h"
/* ha_rows */
38
43
class
Example_share
:
public
Handler_share
{
44
public
:
45
mysql_mutex_t
mutex;
46
THR_LOCK
lock;
47
Example_share
();
48
~
Example_share
()
49
{
50
thr_lock_delete(&lock);
51
mysql_mutex_destroy
(&mutex);
52
}
53
};
54
58
class
ha_example
:
public
handler
59
{
60
THR_LOCK_DATA
lock;
61
Example_share
*share;
62
Example_share
*get_share();
63
64
public
:
65
ha_example
(
handlerton
*hton,
TABLE_SHARE
*table_arg);
66
~
ha_example
()
67
{
68
}
69
73
const
char
*
table_type
()
const
{
return
"EXAMPLE"
; }
74
79
const
char
*
index_type
(uint inx) {
return
"HASH"
; }
80
84
const
char
**
bas_ext
()
const
;
85
90
ulonglong
table_flags
()
const
91
{
92
/*
93
We are saying that this engine is just statement capable to have
94
an engine that can only handle statement-based logging. This is
95
used in testing.
96
*/
97
return
HA_BINLOG_STMT_CAPABLE;
98
}
99
110
ulong
index_flags
(uint inx, uint part,
bool
all_parts)
const
111
{
112
return
0;
113
}
114
122
uint
max_supported_record_length
()
const
{
return
HA_MAX_REC_LENGTH; }
123
133
uint
max_supported_keys
()
const
{
return
0; }
134
144
uint
max_supported_key_parts
()
const
{
return
0; }
145
155
uint
max_supported_key_length
()
const
{
return
0; }
156
160
virtual
double
scan_time
() {
return
(
double
) (
stats
.records+
stats
.deleted) / 20.0+10; }
161
165
virtual
double
read_time
(uint, uint, ha_rows rows)
166
{
return
(
double
) rows / 20.0+1; }
167
168
/*
169
Everything below are methods that we implement in ha_example.cc.
170
171
Most of these methods are not obligatory, skip them and
172
MySQL will treat them as not implemented
173
*/
177
int
open
(
const
char
*
name
,
int
mode
, uint test_if_locked);
// required
178
182
int
close
(
void
);
// required
183
188
int
write_row
(uchar *
buf
);
189
194
int
update_row
(
const
uchar *old_data, uchar *new_data);
195
200
int
delete_row
(
const
uchar *
buf
);
201
206
int
index_read_map
(uchar *
buf
,
const
uchar *key,
207
key_part_map keypart_map,
enum
ha_rkey_function find_flag);
208
213
int
index_next
(uchar *
buf
);
214
219
int
index_prev
(uchar *
buf
);
220
225
int
index_first
(uchar *
buf
);
226
231
int
index_last
(uchar *
buf
);
232
241
int
rnd_init
(
bool
scan);
//required
242
int
rnd_end();
243
int
rnd_next
(uchar *
buf
);
244
int
rnd_pos
(uchar *
buf
, uchar *pos);
245
void
position
(
const
uchar *
record
);
246
int
info
(uint);
247
int
extra
(
enum
ha_extra_function operation);
248
int
external_lock
(THD *thd,
int
lock_type);
249
int
delete_all_rows
(
void
);
250
int
truncate
();
251
ha_rows
records_in_range
(uint inx,
key_range
*min_key,
252
key_range
*max_key);
253
int
delete_table
(
const
char
*from);
254
int
rename_table
(
const
char
* from,
const
char
*
to
);
255
int
create
(
const
char
*
name
,
TABLE
*
form
,
256
HA_CREATE_INFO
*create_info);
257
258
THR_LOCK_DATA
**
store_lock
(THD *thd,
THR_LOCK_DATA
**
to
,
259
enum
thr_lock_type lock_type);
260
};
storage
example
ha_example.h
Generated on Sat Nov 9 2013 01:26:25 for MySQL 5.6.14 Source Code Document by
1.8.1.2