1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
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.
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.
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
1
/* Copyright (C) 2000 MySQL AB
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.
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.
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
20
16
/* This file includes constants used with all databases */
23
* @TODO Name this file something better and split it out if necessary.
24
* base.h isn't descriptive, especially compared to global.h
26
* @TODO Convert HA_XXX defines into enums and/or bitmaps
29
#ifndef DRIZZLE_SERVER_BASE_H
30
#define DRIZZLE_SERVER_BASE_H
32
21
#ifndef stdin /* Included first in handler */
33
22
#define CHSIZE_USED
34
#include <drizzled/global.h>
35
#include <mysys/my_dir.h> /* This includes types */
36
#include <mysys/my_sys.h>
37
#include <mystrings/m_string.h>
23
#include <my_global.h>
24
#include <my_dir.h> /* This includes types */
241
230
#define HA_PACK_KEY 2 /* Pack string key to previous key */
242
231
#define HA_AUTO_KEY 16
243
232
#define HA_BINARY_PACK_KEY 32 /* Packing of all keys to prev key */
233
#define HA_FULLTEXT 128 /* For full-text search */
244
234
#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */
235
#define HA_SPATIAL 1024 /* For spatial search */
245
236
#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */
246
237
#define HA_GENERATED_KEY 8192 /* Automaticly generated key */
248
239
/* The combination of the above can be used for key type comparison. */
249
240
#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \
250
HA_BINARY_PACK_KEY | HA_UNIQUE_CHECK | \
251
HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
241
HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \
242
HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
253
244
#define HA_KEY_HAS_PART_KEY_SEG 65536 /* Key contains partial segments */
258
249
#define HA_VAR_LENGTH_KEY 8
259
250
#define HA_NULL_PART_KEY 64
260
251
#define HA_USES_COMMENT 4096
252
#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */
261
253
#define HA_USES_BLOCK_SIZE ((uint) 32768)
262
254
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
420
412
#define HA_ERR_TABLESPACE_EXIST 171
421
413
#define HA_ERR_CORRUPT_EVENT 172 /* The event was corrupt, leading to
422
414
illegal data being read */
423
#define HA_ERR_NEW_FILE 173 /* New file format */
424
#define HA_ERR_ROWS_EVENT_APPLY 174 /* The event could not be processed
415
#define HA_ERR_NEW_FILE 172 /* New file format */
416
#define HA_ERR_ROWS_EVENT_APPLY 173 /* The event could not be processed
425
417
no other hanlder error happened */
426
#define HA_ERR_INITIALIZATION 175 /* Error during initialization */
427
#define HA_ERR_FILE_TOO_SHORT 176 /* File too short */
428
#define HA_ERR_WRONG_CRC 177 /* Wrong CRC on page */
429
#define HA_ERR_LOCK_OR_ACTIVE_TRANSACTION 178
430
#define HA_ERR_NO_SUCH_TABLESPACE 179
431
#define HA_ERR_TABLESPACE_NOT_EMPTY 180
432
#define HA_ERR_LAST 180 /* Copy of last error nr */
418
#define HA_ERR_INITIALIZATION 174 /* Error during initialization */
419
#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */
420
#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */
421
#define HA_ERR_LOCK_OR_ACTIVE_TRANSACTION 177
422
#define HA_ERR_NO_SUCH_TABLESPACE 178
423
#define HA_ERR_TABLESPACE_NOT_EMPTY 179
424
#define HA_ERR_LAST 179 /* Copy of last error nr */
434
426
/* Number of different errors */
435
427
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
544
541
key_range start_key;
545
542
key_range end_key;
546
543
char *ptr; /* Free to use by caller (ptr to row etc) */
547
uint32_t range_flag; /* key range flags see above */
544
uint range_flag; /* key range flags see above */
548
545
} KEY_MULTI_RANGE;
551
548
/* For number of records */
552
typedef uint64_t ha_rows;
553
550
#define rows2double(A) uint64_t2double(A)
551
typedef my_off_t ha_rows;
553
#define rows2double(A) (double) (A)
554
typedef ulong ha_rows;
555
557
#define HA_POS_ERROR (~ (ha_rows) 0)
556
558
#define HA_OFFSET_ERROR (~ (my_off_t) 0)