390.1.2
by Monty Taylor
Fixed copyright headers in drizzled/ |
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 |
*/
|
|
1
by brian
clean slate |
19 |
|
20 |
/* This file includes constants used with all databases */
|
|
21 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
22 |
/**
|
23 |
* @TODO Name this file something better and split it out if necessary.
|
|
243.1.11
by Jay Pipes
* Added include guards in a couple places, and removed unecessary |
24 |
*
|
25 |
* @TODO Convert HA_XXX defines into enums and/or bitmaps
|
|
26 |
*/
|
|
27 |
||
1122.2.10
by Monty Taylor
Fixed all of the include guards. |
28 |
#ifndef DRIZZLED_BASE_H
|
29 |
#define DRIZZLED_BASE_H
|
|
1
by brian
clean slate |
30 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
31 |
namespace drizzled |
32 |
{
|
|
33 |
||
1
by brian
clean slate |
34 |
/* The following is bits in the flag parameter to ha_open() */
|
35 |
||
36 |
#define HA_OPEN_ABORT_IF_LOCKED 0 /* default */ |
|
37 |
#define HA_OPEN_WAIT_IF_LOCKED 1
|
|
38 |
#define HA_OPEN_IGNORE_IF_LOCKED 2
|
|
39 |
#define HA_OPEN_TMP_TABLE 4 /* Table is a temp table */ |
|
40 |
/* Internal temp table, used for temporary results */
|
|
41 |
#define HA_OPEN_INTERNAL_TABLE 512
|
|
42 |
||
43 |
/* The following is parameter to ha_rkey() how to use key */
|
|
44 |
||
45 |
/*
|
|
46 |
We define a complete-field prefix of a key value as a prefix where
|
|
47 |
the last included field in the prefix contains the full field, not
|
|
48 |
just some bytes from the start of the field. A partial-field prefix
|
|
49 |
is allowed to contain only a few first bytes from the last included
|
|
50 |
field.
|
|
51 |
||
52 |
Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a
|
|
53 |
complete-field prefix of a key value as the search
|
|
54 |
key. HA_READ_PREFIX and HA_READ_PREFIX_LAST could also take a
|
|
55 |
partial-field prefix, but currently (4.0.10) they are only used with
|
|
56 |
complete-field prefixes. MySQL uses a padding trick to implement
|
|
57 |
LIKE 'abc%' queries.
|
|
58 |
||
59 |
NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a
|
|
60 |
partial-field prefix because InnoDB currently strips spaces from the
|
|
61 |
end of varchar fields!
|
|
62 |
*/
|
|
63 |
||
64 |
enum ha_rkey_function { |
|
65 |
HA_READ_KEY_EXACT, /* Find first record else error */ |
|
66 |
HA_READ_KEY_OR_NEXT, /* Record or next record */ |
|
67 |
HA_READ_KEY_OR_PREV, /* Record or previous */ |
|
68 |
HA_READ_AFTER_KEY, /* Find next rec. after key-record */ |
|
69 |
HA_READ_BEFORE_KEY, /* Find next rec. before key-record */ |
|
70 |
HA_READ_PREFIX, /* Key which as same prefix */ |
|
71 |
HA_READ_PREFIX_LAST, /* Last key with the same prefix */ |
|
72 |
HA_READ_PREFIX_LAST_OR_PREV, /* Last or prev key with the same prefix */ |
|
73 |
HA_READ_MBR_CONTAIN, |
|
74 |
HA_READ_MBR_INTERSECT, |
|
75 |
HA_READ_MBR_WITHIN, |
|
76 |
HA_READ_MBR_DISJOINT, |
|
77 |
HA_READ_MBR_EQUAL
|
|
78 |
};
|
|
79 |
||
80 |
/* Key algorithm types */
|
|
81 |
||
82 |
enum ha_key_alg { |
|
83 |
HA_KEY_ALG_UNDEF= 0, /* Not specified (old file) */ |
|
84 |
HA_KEY_ALG_BTREE= 1, /* B-tree, default one */ |
|
1235.1.12
by Brian Aker
Clean up index interface before moving to SE. |
85 |
HA_KEY_ALG_HASH= 3 /* HASH keys (HEAP tables) */ |
1
by brian
clean slate |
86 |
};
|
87 |
||
88 |
/* Index and table build methods */
|
|
89 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
90 |
enum ha_build_method { |
91 |
HA_BUILD_DEFAULT, |
|
1
by brian
clean slate |
92 |
HA_BUILD_ONLINE, |
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
93 |
HA_BUILD_OFFLINE
|
1
by brian
clean slate |
94 |
};
|
95 |
||
96 |
/* The following is parameter to ha_extra() */
|
|
97 |
||
98 |
enum ha_extra_function { |
|
99 |
HA_EXTRA_NORMAL=0, /* Optimize for space (def) */ |
|
100 |
HA_EXTRA_QUICK=1, /* Optimize for speed */ |
|
101 |
HA_EXTRA_NOT_USED=2, |
|
102 |
HA_EXTRA_CACHE=3, /* Cache record in HA_rrnd() */ |
|
103 |
HA_EXTRA_NO_CACHE=4, /* End caching of records (def) */ |
|
104 |
HA_EXTRA_NO_READCHECK=5, /* No readcheck on update */ |
|
105 |
HA_EXTRA_READCHECK=6, /* Use readcheck (def) */ |
|
106 |
HA_EXTRA_KEYREAD=7, /* Read only key to database */ |
|
107 |
HA_EXTRA_NO_KEYREAD=8, /* Normal read of records (def) */ |
|
108 |
HA_EXTRA_NO_USER_CHANGE=9, /* No user is allowed to write */ |
|
109 |
HA_EXTRA_KEY_CACHE=10, |
|
110 |
HA_EXTRA_NO_KEY_CACHE=11, |
|
111 |
HA_EXTRA_WAIT_LOCK=12, /* Wait until file is avalably (def) */ |
|
112 |
HA_EXTRA_NO_WAIT_LOCK=13, /* If file is locked, return quickly */ |
|
113 |
HA_EXTRA_WRITE_CACHE=14, /* Use write cache in ha_write() */ |
|
114 |
HA_EXTRA_FLUSH_CACHE=15, /* flush write_record_cache */ |
|
115 |
HA_EXTRA_NO_KEYS=16, /* Remove all update of keys */ |
|
116 |
HA_EXTRA_KEYREAD_CHANGE_POS=17, /* Keyread, but change pos */ |
|
117 |
/* xxxxchk -r must be used */
|
|
118 |
HA_EXTRA_REMEMBER_POS=18, /* Remember pos for next/prev */ |
|
119 |
HA_EXTRA_RESTORE_POS=19, |
|
120 |
HA_EXTRA_REINIT_CACHE=20, /* init cache from current record */ |
|
121 |
HA_EXTRA_FORCE_REOPEN=21, /* Datafile have changed on disk */ |
|
122 |
HA_EXTRA_FLUSH, /* Flush tables to disk */ |
|
123 |
HA_EXTRA_NO_ROWS, /* Don't write rows */ |
|
124 |
HA_EXTRA_RESET_STATE, /* Reset positions */ |
|
125 |
HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/ |
|
126 |
HA_EXTRA_NO_IGNORE_DUP_KEY, |
|
127 |
HA_EXTRA_PREPARE_FOR_DROP, |
|
128 |
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */ |
|
129 |
HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */ |
|
130 |
/*
|
|
131 |
On-the-fly switching between unique and non-unique key inserting.
|
|
132 |
*/
|
|
133 |
HA_EXTRA_CHANGE_KEY_TO_UNIQUE, |
|
134 |
HA_EXTRA_CHANGE_KEY_TO_DUP, |
|
135 |
/*
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
136 |
When using HA_EXTRA_KEYREAD, overwrite only key member fields and keep
|
1
by brian
clean slate |
137 |
other fields intact. When this is off (by default) InnoDB will use memcpy
|
138 |
to overwrite entire row.
|
|
139 |
*/
|
|
140 |
HA_EXTRA_KEYREAD_PRESERVE_FIELDS, |
|
141 |
/*
|
|
142 |
Ignore if the a tuple is not found, continue processing the
|
|
143 |
transaction and ignore that 'row'. Needed for idempotency
|
|
144 |
handling on the slave
|
|
145 |
||
146 |
Currently only used by NDB storage engine. Partition handler ignores flag.
|
|
147 |
*/
|
|
148 |
HA_EXTRA_IGNORE_NO_KEY, |
|
149 |
HA_EXTRA_NO_IGNORE_NO_KEY, |
|
150 |
/*
|
|
151 |
Informs handler that write_row() which tries to insert new row into the
|
|
152 |
table and encounters some already existing row with same primary/unique
|
|
153 |
key can replace old row with new row instead of reporting error (basically
|
|
154 |
it informs handler that we do REPLACE instead of simple INSERT).
|
|
155 |
Off by default.
|
|
156 |
*/
|
|
157 |
HA_EXTRA_WRITE_CAN_REPLACE, |
|
158 |
HA_EXTRA_WRITE_CANNOT_REPLACE, |
|
159 |
/*
|
|
160 |
Inform handler that delete_row()/update_row() cannot batch deletes/updates
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
161 |
and should perform them immediately. This may be needed when table has
|
1
by brian
clean slate |
162 |
AFTER DELETE/UPDATE triggers which access to subject table.
|
163 |
These flags are reset by the handler::extra(HA_EXTRA_RESET) call.
|
|
164 |
*/
|
|
165 |
HA_EXTRA_DELETE_CANNOT_BATCH, |
|
166 |
HA_EXTRA_UPDATE_CANNOT_BATCH, |
|
167 |
/*
|
|
168 |
Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be
|
|
169 |
executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY.
|
|
170 |
*/
|
|
171 |
HA_EXTRA_INSERT_WITH_UPDATE, |
|
172 |
/* Inform handler that we will do a rename */
|
|
102
by Brian Aker
Final cleanup on enum for MEMORY/DISK |
173 |
HA_EXTRA_PREPARE_FOR_RENAME
|
1
by brian
clean slate |
174 |
};
|
175 |
||
176 |
/* The following is parameter to ha_panic() */
|
|
177 |
||
178 |
enum ha_panic_function { |
|
179 |
HA_PANIC_CLOSE, /* Close all databases */ |
|
180 |
HA_PANIC_WRITE, /* Unlock and write status */ |
|
181 |
HA_PANIC_READ /* Lock and read keyinfo */ |
|
182 |
};
|
|
183 |
||
184 |
/* The following is parameter to ha_create(); keytypes */
|
|
185 |
||
186 |
enum ha_base_keytype { |
|
187 |
HA_KEYTYPE_END=0, |
|
188 |
HA_KEYTYPE_TEXT=1, /* Key is sorted as letters */ |
|
189 |
HA_KEYTYPE_BINARY=2, /* Key is sorted as unsigned chars */ |
|
190 |
HA_KEYTYPE_LONG_INT=4, |
|
191 |
HA_KEYTYPE_DOUBLE=6, |
|
192 |
HA_KEYTYPE_ULONG_INT=9, |
|
193 |
HA_KEYTYPE_LONGLONG=10, |
|
194 |
HA_KEYTYPE_ULONGLONG=11, |
|
195 |
HA_KEYTYPE_UINT24=13, |
|
196 |
/* Varchar (0-255 bytes) with length packed with 1 byte */
|
|
197 |
HA_KEYTYPE_VARTEXT1=15, /* Key is sorted as letters */ |
|
198 |
HA_KEYTYPE_VARBINARY1=16, /* Key is sorted as unsigned chars */ |
|
199 |
/* Varchar (0-65535 bytes) with length packed with 2 bytes */
|
|
200 |
HA_KEYTYPE_VARTEXT2=17, /* Key is sorted as letters */ |
|
1161.1.7
by Stewart Smith
remove unused HA_KEYTYPE_BIT |
201 |
HA_KEYTYPE_VARBINARY2=18 /* Key is sorted as unsigned chars */ |
1
by brian
clean slate |
202 |
};
|
203 |
||
204 |
/* These flags kan be OR:ed to key-flag */
|
|
205 |
||
206 |
#define HA_NOSAME 1 /* Set if not dupplicated records */ |
|
207 |
#define HA_PACK_KEY 2 /* Pack string key to previous key */ |
|
208 |
#define HA_AUTO_KEY 16
|
|
209 |
#define HA_BINARY_PACK_KEY 32 /* Packing of all keys to prev key */ |
|
210 |
#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */ |
|
211 |
#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */ |
|
212 |
#define HA_GENERATED_KEY 8192 /* Automaticly generated key */ |
|
213 |
||
214 |
#define HA_KEY_HAS_PART_KEY_SEG 65536 /* Key contains partial segments */ |
|
215 |
||
216 |
/* Automatic bits in key-flag */
|
|
217 |
||
218 |
#define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */ |
|
219 |
#define HA_VAR_LENGTH_KEY 8
|
|
220 |
#define HA_NULL_PART_KEY 64
|
|
221 |
#define HA_USES_COMMENT 4096
|
|
895
by Brian Aker
Completion (?) of uint conversion. |
222 |
#define HA_USES_BLOCK_SIZE ((uint32_t) 32768)
|
1
by brian
clean slate |
223 |
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */ |
224 |
||
225 |
/* These flags can be added to key-seg-flag */
|
|
226 |
||
227 |
#define HA_SPACE_PACK 1 /* Pack space in key-seg */ |
|
228 |
#define HA_PART_KEY_SEG 4 /* Used by MySQL for part-key-cols */ |
|
229 |
#define HA_VAR_LENGTH_PART 8
|
|
230 |
#define HA_NULL_PART 16
|
|
231 |
#define HA_BLOB_PART 32
|
|
232 |
#define HA_SWAP_KEY 64
|
|
233 |
#define HA_REVERSE_SORT 128 /* Sort key in reverse order */ |
|
234 |
#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */ |
|
235 |
/*
|
|
236 |
End space in unique/varchar are considered equal. (Like 'a' and 'a ')
|
|
237 |
Only needed for internal temporary tables.
|
|
238 |
*/
|
|
239 |
#define HA_END_SPACE_ARE_EQUAL 512
|
|
240 |
#define HA_BIT_PART 1024
|
|
241 |
||
242 |
/* optionbits for database */
|
|
243 |
#define HA_OPTION_PACK_RECORD 1
|
|
244 |
#define HA_OPTION_PACK_KEYS 2
|
|
245 |
#define HA_OPTION_COMPRESS_RECORD 4
|
|
246 |
#define HA_OPTION_TMP_TABLE 16
|
|
247 |
#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */ |
|
895
by Brian Aker
Completion (?) of uint conversion. |
248 |
#define HA_OPTION_TEMP_COMPRESS_RECORD ((uint32_t) 16384) /* set by isamchk */ |
249 |
#define HA_OPTION_READ_ONLY_DATA ((uint32_t) 32768) /* Set by isamchk */ |
|
1
by brian
clean slate |
250 |
|
251 |
/* Bits in flag to create() */
|
|
252 |
||
253 |
#define HA_DONT_TOUCH_DATA 1 /* Don't empty datafile (isamchk) */ |
|
254 |
#define HA_PACK_RECORD 2 /* Request packed record format */ |
|
255 |
#define HA_CREATE_TMP_TABLE 4
|
|
256 |
#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */ |
|
257 |
||
258 |
/*
|
|
259 |
The following flags (OR-ed) are passed to handler::info() method.
|
|
260 |
The method copies misc handler information out of the storage engine
|
|
261 |
to data structures accessible from MySQL
|
|
262 |
||
263 |
Same flags are also passed down to mi_status, myrg_status, etc.
|
|
264 |
*/
|
|
265 |
||
266 |
/* this one is not used */
|
|
267 |
#define HA_STATUS_POS 1
|
|
268 |
/*
|
|
269 |
assuming the table keeps shared actual copy of the 'info' and
|
|
270 |
local, possibly outdated copy, the following flag means that
|
|
271 |
it should not try to get the actual data (locking the shared structure)
|
|
272 |
slightly outdated version will suffice
|
|
273 |
*/
|
|
274 |
#define HA_STATUS_NO_LOCK 2
|
|
275 |
/* update the time of the last modification (in handler::update_time) */
|
|
276 |
#define HA_STATUS_TIME 4
|
|
277 |
/*
|
|
278 |
update the 'constant' part of the info:
|
|
279 |
handler::max_data_file_length, max_index_file_length, create_time
|
|
280 |
sortkey, ref_length, block_size, data_file_name, index_file_name.
|
|
281 |
handler::table->s->keys_in_use, keys_for_keyread, rec_per_key
|
|
282 |
*/
|
|
283 |
#define HA_STATUS_CONST 8
|
|
284 |
/*
|
|
285 |
update the 'variable' part of the info:
|
|
286 |
handler::records, deleted, data_file_length, index_file_length,
|
|
287 |
delete_length, check_time, mean_rec_length
|
|
288 |
*/
|
|
289 |
#define HA_STATUS_VARIABLE 16
|
|
290 |
/*
|
|
291 |
get the information about the key that caused last duplicate value error
|
|
292 |
update handler::errkey and handler::dupp_ref
|
|
293 |
see handler::get_dup_key()
|
|
294 |
*/
|
|
295 |
#define HA_STATUS_ERRKEY 32
|
|
296 |
/*
|
|
297 |
update handler::auto_increment_value
|
|
298 |
*/
|
|
299 |
#define HA_STATUS_AUTO 64
|
|
300 |
||
301 |
/*
|
|
302 |
Errorcodes given by handler functions
|
|
303 |
||
1237.9.1
by Padraig O'Sullivan
Moved the opt_sum.cc file into the optimizer directory and renamed it to sum.cc. Added a header file |
304 |
optimizer::sum_query() assumes these codes are > 1
|
1
by brian
clean slate |
305 |
Do not add error numbers before HA_ERR_FIRST.
|
306 |
If necessary to add lower numbers, change HA_ERR_FIRST accordingly.
|
|
307 |
*/
|
|
308 |
#define HA_ERR_FIRST 120 /* Copy of first error nr.*/ |
|
309 |
||
310 |
#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */ |
|
311 |
#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */ |
|
312 |
#define HA_ERR_INTERNAL_ERROR 122 /* Internal error */ |
|
313 |
#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */ |
|
314 |
#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */ |
|
315 |
#define HA_ERR_CRASHED 126 /* Indexfile is crashed */ |
|
316 |
#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */ |
|
317 |
#define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */ |
|
318 |
#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */ |
|
319 |
#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */ |
|
320 |
#define HA_ERR_OLD_FILE 132 /* old databasfile */ |
|
321 |
#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */ |
|
322 |
#define HA_ERR_RECORD_DELETED 134 /* A record is not there */ |
|
323 |
#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */ |
|
324 |
#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */ |
|
325 |
#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */ |
|
326 |
#define HA_ERR_UNSUPPORTED 138 /* unsupported extension used */ |
|
327 |
#define HA_ERR_TO_BIG_ROW 139 /* Too big row */ |
|
328 |
#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */ |
|
329 |
#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */ |
|
330 |
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */ |
|
331 |
#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */ |
|
332 |
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */ |
|
333 |
#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */ |
|
334 |
#define HA_ERR_LOCK_WAIT_TIMEOUT 146
|
|
335 |
#define HA_ERR_LOCK_TABLE_FULL 147
|
|
336 |
#define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */ |
|
337 |
#define HA_ERR_LOCK_DEADLOCK 149
|
|
338 |
#define HA_ERR_CANNOT_ADD_FOREIGN 150 /* Cannot add a foreign key constr. */ |
|
339 |
#define HA_ERR_NO_REFERENCED_ROW 151 /* Cannot add a child row */ |
|
340 |
#define HA_ERR_ROW_IS_REFERENCED 152 /* Cannot delete a parent row */ |
|
341 |
#define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */ |
|
342 |
#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */ |
|
343 |
#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */ |
|
344 |
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */ |
|
345 |
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */ |
|
346 |
/* NULLs are not supported in spatial index */
|
|
347 |
#define HA_ERR_NULL_IN_SPATIAL 158
|
|
348 |
#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */ |
|
349 |
/* There's no partition in table for given value */
|
|
350 |
#define HA_ERR_NO_PARTITION_FOUND 160
|
|
351 |
#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */ |
|
352 |
#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr */ |
|
353 |
/*
|
|
354 |
Upholding foreign key constraints would lead to a duplicate key error
|
|
355 |
in some other table.
|
|
356 |
*/
|
|
357 |
#define HA_ERR_FOREIGN_DUPLICATE_KEY 163
|
|
358 |
/* The table changed in storage engine */
|
|
359 |
#define HA_ERR_TABLE_NEEDS_UPGRADE 164
|
|
360 |
#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */ |
|
361 |
||
362 |
#define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */ |
|
363 |
#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */ |
|
364 |
#define HA_ERR_GENERIC 168 /* Generic error */ |
|
365 |
/* row not actually updated: new values same as the old values */
|
|
366 |
#define HA_ERR_RECORD_IS_THE_SAME 169
|
|
367 |
/* It is not possible to log this statement */
|
|
368 |
#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this |
|
369 |
statement */
|
|
370 |
#define HA_ERR_TABLESPACE_EXIST 171
|
|
371 |
#define HA_ERR_CORRUPT_EVENT 172 /* The event was corrupt, leading to |
|
372 |
illegal data being read */
|
|
202.3.6
by Monty Taylor
First pass at gettexizing the error messages. |
373 |
#define HA_ERR_NEW_FILE 173 /* New file format */ |
374 |
#define HA_ERR_ROWS_EVENT_APPLY 174 /* The event could not be processed |
|
1
by brian
clean slate |
375 |
no other hanlder error happened */
|
202.3.6
by Monty Taylor
First pass at gettexizing the error messages. |
376 |
#define HA_ERR_INITIALIZATION 175 /* Error during initialization */ |
377 |
#define HA_ERR_FILE_TOO_SHORT 176 /* File too short */ |
|
378 |
#define HA_ERR_WRONG_CRC 177 /* Wrong CRC on page */ |
|
379 |
#define HA_ERR_LOCK_OR_ACTIVE_TRANSACTION 178
|
|
380 |
#define HA_ERR_NO_SUCH_TABLESPACE 179
|
|
381 |
#define HA_ERR_TABLESPACE_NOT_EMPTY 180
|
|
382 |
#define HA_ERR_LAST 180 /* Copy of last error nr */ |
|
1
by brian
clean slate |
383 |
|
384 |
/* Number of different errors */
|
|
385 |
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
|
|
386 |
||
387 |
/* Other constants */
|
|
388 |
||
1241.9.1
by Monty Taylor
Removed global.h. Fixed all the headers. |
389 |
typedef unsigned long key_part_map; |
1
by brian
clean slate |
390 |
#define HA_WHOLE_KEY (~(key_part_map)0)
|
391 |
||
392 |
/* Intern constants in databases */
|
|
393 |
||
394 |
/* bits in _search */
|
|
395 |
#define SEARCH_FIND 1
|
|
396 |
#define SEARCH_NO_FIND 2
|
|
397 |
#define SEARCH_SAME 4
|
|
398 |
#define SEARCH_BIGGER 8
|
|
399 |
#define SEARCH_SMALLER 16
|
|
400 |
#define SEARCH_SAVE_BUFF 32
|
|
401 |
#define SEARCH_UPDATE 64
|
|
402 |
#define SEARCH_PREFIX 128
|
|
403 |
#define SEARCH_LAST 256
|
|
404 |
#define MBR_CONTAIN 512
|
|
405 |
#define MBR_INTERSECT 1024
|
|
406 |
#define MBR_WITHIN 2048
|
|
407 |
#define MBR_DISJOINT 4096
|
|
408 |
#define MBR_EQUAL 8192
|
|
409 |
#define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */ |
|
410 |
#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */ |
|
411 |
||
412 |
/* bits in opt_flag */
|
|
413 |
#define READ_CACHE_USED 2
|
|
414 |
#define READ_CHECK_USED 4
|
|
415 |
#define KEY_READ_USED 8
|
|
416 |
#define WRITE_CACHE_USED 16
|
|
417 |
#define OPT_NO_ROWS 32
|
|
418 |
||
419 |
/* bits in update */
|
|
420 |
#define HA_STATE_CHANGED 1 /* Database has changed */ |
|
421 |
#define HA_STATE_AKTIV 2 /* Has a current record */ |
|
422 |
#define HA_STATE_WRITTEN 4 /* Record is written */ |
|
423 |
#define HA_STATE_DELETED 8
|
|
424 |
#define HA_STATE_NEXT_FOUND 16 /* Next found record (record before) */ |
|
425 |
#define HA_STATE_PREV_FOUND 32 /* Prev found record (record after) */ |
|
426 |
#define HA_STATE_KEY_CHANGED 128
|
|
427 |
#define HA_STATE_WRITE_AT_END 256 /* set in _ps_find_writepos */ |
|
428 |
#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */ |
|
429 |
#define HA_STATE_EXTEND_BLOCK 2048
|
|
430 |
#define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */ |
|
431 |
||
432 |
/* myisampack expects no more than 32 field types. */
|
|
433 |
enum en_fieldtype { |
|
434 |
FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE, |
|
435 |
FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO, |
|
436 |
FIELD_VARCHAR,FIELD_CHECK, |
|
437 |
FIELD_enum_val_count
|
|
438 |
};
|
|
439 |
||
440 |
enum data_file_type { |
|
441 |
STATIC_RECORD, DYNAMIC_RECORD, COMPRESSED_RECORD, BLOCK_RECORD |
|
442 |
};
|
|
443 |
||
444 |
/* For key ranges */
|
|
445 |
||
446 |
/* from -inf */
|
|
447 |
#define NO_MIN_RANGE 1
|
|
448 |
||
449 |
/* to +inf */
|
|
450 |
#define NO_MAX_RANGE 2
|
|
451 |
||
452 |
/* X < key, i.e. not including the left endpoint */
|
|
453 |
#define NEAR_MIN 4
|
|
454 |
||
455 |
/* X > key, i.e. not including the right endpoint */
|
|
456 |
#define NEAR_MAX 8
|
|
457 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
458 |
/*
|
459 |
This flag means that index is a unique index, and the interval is
|
|
1
by brian
clean slate |
460 |
equivalent to "AND(keypart_i = const_i)", where all of const_i are not NULLs.
|
461 |
*/
|
|
462 |
#define UNIQUE_RANGE 16
|
|
463 |
||
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
464 |
/*
|
465 |
This flag means that the interval is equivalent to
|
|
466 |
"AND(keypart_i = const_i)", where not all key parts may be used but all of
|
|
1
by brian
clean slate |
467 |
const_i are not NULLs.
|
468 |
*/
|
|
469 |
#define EQ_RANGE 32
|
|
470 |
||
471 |
/*
|
|
472 |
This flag has the same meaning as UNIQUE_RANGE, except that for at least
|
|
660.1.3
by Eric Herman
removed trailing whitespace with simple script: |
473 |
one keypart the condition is "keypart IS NULL".
|
1
by brian
clean slate |
474 |
*/
|
475 |
#define NULL_RANGE 64
|
|
476 |
||
477 |
typedef struct st_key_range |
|
478 |
{
|
|
481
by Brian Aker
Remove all of uchar. |
479 |
const unsigned char *key; |
482
by Brian Aker
Remove uint. |
480 |
uint32_t length; |
1030.1.1
by Brian Aker
Straighten out structures (remove some some dead bits). |
481 |
enum ha_rkey_function flag; |
1
by brian
clean slate |
482 |
key_part_map keypart_map; |
483 |
} key_range; |
|
484 |
||
485 |
typedef struct st_key_multi_range |
|
486 |
{
|
|
487 |
key_range start_key; |
|
488 |
key_range end_key; |
|
489 |
char *ptr; /* Free to use by caller (ptr to row etc) */ |
|
482
by Brian Aker
Remove uint. |
490 |
uint32_t range_flag; /* key range flags see above */ |
1
by brian
clean slate |
491 |
} KEY_MULTI_RANGE; |
492 |
||
493 |
||
494 |
/* For number of records */
|
|
248
by Brian Aker
Random cleanup in base.h |
495 |
typedef uint64_t ha_rows; |
151
by Brian Aker
Ulonglong to uint64_t |
496 |
#define rows2double(A) uint64_t2double(A)
|
1
by brian
clean slate |
497 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
498 |
#define HA_POS_ERROR (~ (::drizzled::ha_rows) 0)
|
499 |
#define HA_OFFSET_ERROR (~ (::drizzled::internal::my_off_t) 0)
|
|
1
by brian
clean slate |
500 |
|
77.1.3
by Monty Taylor
MyISAM cleanups. |
501 |
#if SIZEOF_OFF_T == 4
|
163
by Brian Aker
Merge Monty's code. |
502 |
#define MAX_FILE_SIZE INT32_MAX
|
1
by brian
clean slate |
503 |
#else
|
163
by Brian Aker
Merge Monty's code. |
504 |
#define MAX_FILE_SIZE INT64_MAX
|
1
by brian
clean slate |
505 |
#endif
|
506 |
||
507 |
#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
|
|
508 |
||
1377.6.3
by pawel
changed function-like defines into functions in some files |
509 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
510 |
} /* namespace drizzled */ |
511 |
||
1122.2.10
by Monty Taylor
Fixed all of the include guards. |
512 |
#endif /* DRIZZLED_BASE_H */ |