575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
5 |
*
|
|
6 |
* This program is free software; you can redistribute it and/or modify
|
|
7 |
* it under the terms of the GNU General Public License as published by
|
|
8 |
* the Free Software Foundation; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
20 |
#ifndef DRIZZLED_HANDLER_STRUCTS_H
|
|
21 |
#define DRIZZLED_HANDLER_STRUCTS_H
|
|
22 |
||
575.4.7
by Monty Taylor
More header cleanup. |
23 |
#include <stdint.h> |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
24 |
#include <time.h> |
25 |
||
26 |
#include <drizzled/base.h> |
|
27 |
#include <drizzled/structs.h> |
|
28 |
#include <drizzled/definitions.h> |
|
29 |
#include <drizzled/lex_string.h> |
|
30 |
||
31 |
class Ha_trx_info; |
|
32 |
struct st_key; |
|
33 |
typedef struct st_key KEY; |
|
34 |
struct st_key_cache; |
|
35 |
typedef struct st_key_cache KEY_CACHE; |
|
36 |
||
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
37 |
namespace drizzled |
38 |
{
|
|
39 |
namespace plugin |
|
40 |
{
|
|
41 |
class StorageEngine; |
|
42 |
}
|
|
43 |
}
|
|
44 |
||
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
45 |
struct Session_TRANS |
46 |
{
|
|
896.1.4
by Monty Taylor
Fixed compiler warnings. |
47 |
Session_TRANS() {}; |
48 |
||
960.2.37
by Monty Taylor
More naming fixes. |
49 |
/* true is not all entries in the engines[] support 2pc */
|
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
50 |
bool no_2pc; |
51 |
/* storage engines that registered in this transaction */
|
|
52 |
Ha_trx_info *ha_list; |
|
53 |
/*
|
|
54 |
The purpose of this flag is to keep track of non-transactional
|
|
55 |
tables that were modified in scope of:
|
|
56 |
- transaction, when the variable is a member of
|
|
57 |
Session::transaction.all
|
|
58 |
- top-level statement or sub-statement, when the variable is a
|
|
59 |
member of Session::transaction.stmt
|
|
60 |
This member has the following life cycle:
|
|
61 |
* stmt.modified_non_trans_table is used to keep track of
|
|
62 |
modified non-transactional tables of top-level statements. At
|
|
63 |
the end of the previous statement and at the beginning of the session,
|
|
64 |
it is reset to false. If such functions
|
|
65 |
as mysql_insert, mysql_update, mysql_delete etc modify a
|
|
66 |
non-transactional table, they set this flag to true. At the
|
|
67 |
end of the statement, the value of stmt.modified_non_trans_table
|
|
68 |
is merged with all.modified_non_trans_table and gets reset.
|
|
69 |
* all.modified_non_trans_table is reset at the end of transaction
|
|
70 |
||
71 |
* Since we do not have a dedicated context for execution of a
|
|
72 |
sub-statement, to keep track of non-transactional changes in a
|
|
73 |
sub-statement, we re-use stmt.modified_non_trans_table.
|
|
74 |
At entrance into a sub-statement, a copy of the value of
|
|
75 |
stmt.modified_non_trans_table (containing the changes of the
|
|
76 |
outer statement) is saved on stack. Then
|
|
77 |
stmt.modified_non_trans_table is reset to false and the
|
|
78 |
substatement is executed. Then the new value is merged with the
|
|
79 |
saved value.
|
|
80 |
*/
|
|
81 |
bool modified_non_trans_table; |
|
82 |
||
83 |
void reset() { no_2pc= false; modified_non_trans_table= false; } |
|
84 |
};
|
|
85 |
||
86 |
typedef struct st_ha_create_information |
|
87 |
{
|
|
88 |
const CHARSET_INFO *table_charset, *default_table_charset; |
|
89 |
const char *alias; |
|
90 |
uint64_t auto_increment_value; |
|
91 |
uint32_t table_options; |
|
92 |
uint32_t used_fields; |
|
1030.1.2
by Brian Aker
More alignment for structures |
93 |
enum row_type row_type; |
1130.1.4
by Monty Taylor
Moved StorageEngine into plugin namespace. |
94 |
drizzled::plugin::StorageEngine *db_type; |
575.1.3
by Monty Taylor
Moved some stuff out of handler.h. |
95 |
bool table_existed; /* 1 in create if table existed */ |
96 |
} HA_CREATE_INFO; |
|
97 |
||
98 |
typedef struct st_ha_alter_information |
|
99 |
{
|
|
100 |
KEY *key_info_buffer; |
|
101 |
uint32_t key_count; |
|
102 |
uint32_t index_drop_count; |
|
103 |
uint32_t *index_drop_buffer; |
|
104 |
uint32_t index_add_count; |
|
105 |
uint32_t *index_add_buffer; |
|
106 |
void *data; |
|
107 |
} HA_ALTER_INFO; |
|
108 |
||
109 |
||
110 |
typedef struct st_key_create_information |
|
111 |
{
|
|
112 |
enum ha_key_alg algorithm; |
|
113 |
uint32_t block_size; |
|
114 |
LEX_STRING comment; |
|
115 |
} KEY_CREATE_INFO; |
|
116 |
||
117 |
||
118 |
typedef struct st_ha_check_opt |
|
119 |
{
|
|
120 |
st_ha_check_opt() {} /* Remove gcc warning */ |
|
121 |
} HA_CHECK_OPT; |
|
122 |
||
123 |
||
124 |
typedef struct st_range_seq_if |
|
125 |
{
|
|
126 |
/*
|
|
127 |
Initialize the traversal of range sequence
|
|
128 |
||
129 |
SYNOPSIS
|
|
130 |
init()
|
|
131 |
init_params The seq_init_param parameter
|
|
132 |
n_ranges The number of ranges obtained
|
|
133 |
flags A combination of HA_MRR_SINGLE_POINT, HA_MRR_FIXED_KEY
|
|
134 |
||
135 |
RETURN
|
|
136 |
An opaque value to be used as RANGE_SEQ_IF::next() parameter
|
|
137 |
*/
|
|
138 |
range_seq_t (*init)(void *init_params, uint32_t n_ranges, uint32_t flags); |
|
139 |
||
140 |
||
141 |
/*
|
|
142 |
Get the next range in the range sequence
|
|
143 |
||
144 |
SYNOPSIS
|
|
145 |
next()
|
|
146 |
seq The value returned by RANGE_SEQ_IF::init()
|
|
147 |
range OUT Information about the next range
|
|
148 |
||
149 |
RETURN
|
|
150 |
0 - Ok, the range structure filled with info about the next range
|
|
151 |
1 - No more ranges
|
|
152 |
*/
|
|
153 |
uint32_t (*next) (range_seq_t seq, KEY_MULTI_RANGE *range); |
|
154 |
} RANGE_SEQ_IF; |
|
155 |
||
156 |
/*
|
|
157 |
This is a buffer area that the handler can use to store rows.
|
|
158 |
'end_of_used_area' should be kept updated after calls to
|
|
159 |
read-functions so that other parts of the code can use the
|
|
160 |
remaining area (until next read calls is issued).
|
|
161 |
*/
|
|
162 |
||
163 |
typedef struct st_handler_buffer |
|
164 |
{
|
|
165 |
unsigned char *buffer; /* Buffer one can start using */ |
|
166 |
unsigned char *buffer_end; /* End of buffer */ |
|
167 |
unsigned char *end_of_used_area; /* End of area that was used by handler */ |
|
168 |
} HANDLER_BUFFER; |
|
169 |
||
170 |
#endif /* DRIZZLED_HANDLER_STRUCTS_H */ |