summaryrefslogtreecommitdiff
path: root/include/my_base.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/my_base.h')
-rw-r--r--include/my_base.h157
1 files changed, 114 insertions, 43 deletions
diff --git a/include/my_base.h b/include/my_base.h
index 181824012d9..a01b2ec9b82 100644
--- a/include/my_base.h
+++ b/include/my_base.h
@@ -14,13 +14,11 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* This file includes constants used with all databases */
-/* Author: Michael Widenius */
#ifndef _my_base_h
#define _my_base_h
#ifndef stdin /* Included first in handler */
-#define USES_TYPES /* my_dir with sys/types is included */
#define CHSIZE_USED
#include <my_global.h>
#include <my_dir.h> /* This includes types */
@@ -32,9 +30,6 @@
#define EOVERFLOW 84
#endif
-#ifdef MSDOS
-#include <share.h> /* Neaded for sopen() */
-#endif
#if !defined(USE_MY_FUNC) && !defined(THREAD)
#include <my_nosys.h> /* For faster code, after test */
#endif /* USE_MY_FUNC */
@@ -50,8 +45,13 @@
#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */
#define HA_OPEN_ABORT_IF_CRASHED 16
#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */
+#define HA_OPEN_FROM_SQL_LAYER 64
+#define HA_OPEN_MMAP 128 /* open memory mapped */
+#define HA_OPEN_COPY 256 /* Open copy (for repair) */
+/* Internal temp table, used for temporary results */
+#define HA_OPEN_INTERNAL_TABLE 512
- /* The following is parameter to ha_rkey() how to use key */
+/* The following is parameter to ha_rkey() how to use key */
/*
We define a complete-field prefix of a key value as a prefix where
@@ -98,12 +98,20 @@ enum ha_key_alg {
HA_KEY_ALG_FULLTEXT= 4 /* FULLTEXT (MyISAM tables) */
};
+ /* Storage media types */
+
+enum ha_storage_media {
+ HA_SM_DEFAULT= 0, /* Not specified (engine default) */
+ HA_SM_DISK= 1, /* DISK storage */
+ HA_SM_MEMORY= 2 /* MAIN MEMORY storage */
+};
+
/* The following is parameter to ha_extra() */
enum ha_extra_function {
HA_EXTRA_NORMAL=0, /* Optimize for space (def) */
HA_EXTRA_QUICK=1, /* Optimize for speed */
- HA_EXTRA_RESET=2, /* Reset database to after open */
+ HA_EXTRA_NOT_USED=2,
HA_EXTRA_CACHE=3, /* Cache record in HA_rrnd() */
HA_EXTRA_NO_CACHE=4, /* End caching of records (def) */
HA_EXTRA_NO_READCHECK=5, /* No readcheck on update */
@@ -129,16 +137,7 @@ enum ha_extra_function {
HA_EXTRA_RESET_STATE, /* Reset positions */
HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/
HA_EXTRA_NO_IGNORE_DUP_KEY,
- /*
- Instructs InnoDB to retrieve all columns (except in key read), not just
- those where field->query_id is the same as the current query id
- */
- HA_EXTRA_RETRIEVE_ALL_COLS,
- /*
- Instructs InnoDB to retrieve at least all the primary key columns
- */
- HA_EXTRA_RETRIEVE_PRIMARY_KEY,
- HA_EXTRA_PREPARE_FOR_DELETE,
+ HA_EXTRA_PREPARE_FOR_DROP,
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */
HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */
/*
@@ -152,6 +151,21 @@ enum ha_extra_function {
to overwrite entire row.
*/
HA_EXTRA_KEYREAD_PRESERVE_FIELDS,
+ HA_EXTRA_MMAP,
+ /*
+ Ignore if the a tuple is not found, continue processing the
+ transaction and ignore that 'row'. Needed for idempotency
+ handling on the slave
+
+ Currently only used by NDB storage engine. Partition handler ignores flag.
+ */
+ HA_EXTRA_IGNORE_NO_KEY,
+ HA_EXTRA_NO_IGNORE_NO_KEY,
+ /*
+ Mark the table as a log table. For some handlers (e.g. CSV) this results
+ in a special locking for the table.
+ */
+ HA_EXTRA_MARK_AS_LOG_TABLE,
/*
Informs handler that write_row() which tries to insert new row into the
table and encounters some already existing row with same primary/unique
@@ -173,9 +187,20 @@ enum ha_extra_function {
Inform handler that an "INSERT...ON DUPLICATE KEY UPDATE" will be
executed. This condition is unset by HA_EXTRA_NO_IGNORE_DUP_KEY.
*/
- HA_EXTRA_INSERT_WITH_UPDATE
+ HA_EXTRA_INSERT_WITH_UPDATE,
+ /* Inform handler that we will do a rename */
+ HA_EXTRA_PREPARE_FOR_RENAME,
+ /*
+ Orders MERGE handler to attach or detach its child tables. Used at
+ begin and end of a statement.
+ */
+ HA_EXTRA_ATTACH_CHILDREN,
+ HA_EXTRA_DETACH_CHILDREN
};
+/* Compatible option, to be deleted in 6.0 */
+#define HA_EXTRA_PREPARE_FOR_DELETE HA_EXTRA_PREPARE_FOR_DROP
+
/* The following is parameter to ha_panic() */
enum ha_panic_function {
@@ -224,18 +249,22 @@ enum ha_base_keytype {
#define HA_SPATIAL 1024 /* For spatial search */
#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */
#define HA_GENERATED_KEY 8192 /* Automaticly generated key */
+
+ /* The combination of the above can be used for key type comparison. */
+#define HA_KEYFLAG_MASK (HA_NOSAME | HA_PACK_KEY | HA_AUTO_KEY | \
+ HA_BINARY_PACK_KEY | HA_FULLTEXT | HA_UNIQUE_CHECK | \
+ HA_SPATIAL | HA_NULL_ARE_EQUAL | HA_GENERATED_KEY)
+
#define HA_KEY_HAS_PART_KEY_SEG 65536 /* Key contains partial segments */
+
/* Automatic bits in key-flag */
#define HA_SPACE_PACK_USED 4 /* Test for if SPACE_PACK used */
#define HA_VAR_LENGTH_KEY 8
#define HA_NULL_PART_KEY 64
-#ifndef ISAM_LIBRARY
+#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */
+#define HA_USES_BLOCK_SIZE ((uint) 32768)
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
-#else
-/* poor old NISAM has 8-bit flags :-( */
-#define HA_SORT_ALLOWS_SAME 128 /* Intern bit when sorting records */
-#endif
#if MYSQL_VERSION_ID < 0x50200
/*
Key has a part that can have end space. If this is an unique key
@@ -275,6 +304,9 @@ enum ha_base_keytype {
#define HA_OPTION_DELAY_KEY_WRITE 64
#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */
#define HA_OPTION_CREATE_FROM_ENGINE 256
+#define HA_OPTION_RELIES_ON_SQL_LAYER 512
+#define HA_OPTION_NULL_FIELDS 1024
+#define HA_OPTION_PAGE_CHECKSUM 2048
#define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */
#define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */
@@ -285,7 +317,9 @@ enum ha_base_keytype {
#define HA_CREATE_TMP_TABLE 4
#define HA_CREATE_CHECKSUM 8
#define HA_CREATE_KEEP_FILES 16 /* don't overwrite .MYD and MYI */
+#define HA_CREATE_PAGE_CHECKSUM 32
#define HA_CREATE_DELAY_KEY_WRITE 64
+#define HA_CREATE_RELIES_ON_SQL_LAYER 128
/*
The following flags (OR-ed) are passed to handler::info() method.
@@ -330,14 +364,18 @@ enum ha_base_keytype {
*/
#define HA_STATUS_AUTO 64
- /* Errorcodes given by functions */
+/*
+ Errorcodes given by handler functions
+
+ opt_sum_query() assumes these codes are > 1
+ Do not add error numbers before HA_ERR_FIRST.
+ If necessary to add lower numbers, change HA_ERR_FIRST accordingly.
+*/
+#define HA_ERR_FIRST 120 /* Copy of first error nr.*/
-/* opt_sum_query() assumes these codes are > 1 */
-/* Do not add error numbers before HA_ERR_FIRST. */
-/* If necessary to add lower numbers, change HA_ERR_FIRST accordingly. */
-#define HA_ERR_FIRST 120 /*Copy first error nr.*/
#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */
#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */
+#define HA_ERR_INTERNAL_ERROR 122 /* Internal error */
#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */
#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */
#define HA_ERR_CRASHED 126 /* Indexfile is crashed */
@@ -347,7 +385,7 @@ enum ha_base_keytype {
#define HA_ERR_WRONG_COMMAND 131 /* Command not supported */
#define HA_ERR_OLD_FILE 132 /* old databasfile */
#define HA_ERR_NO_ACTIVE_RECORD 133 /* No record read in update() */
-#define HA_ERR_RECORD_DELETED 134 /* Intern error-code */
+#define HA_ERR_RECORD_DELETED 134 /* A record is not there */
#define HA_ERR_RECORD_FILE_FULL 135 /* No more room in file */
#define HA_ERR_INDEX_FILE_FULL 136 /* No more room in file */
#define HA_ERR_END_OF_FILE 137 /* end in next/prev/first/last */
@@ -356,7 +394,7 @@ enum ha_base_keytype {
#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */
#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
-#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting MyISAM tables in MERGE */
+#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */
#define HA_ERR_LOCK_WAIT_TIMEOUT 146
@@ -371,23 +409,51 @@ enum ha_base_keytype {
#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
-#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
+/* NULLs are not supported in spatial index */
+#define HA_ERR_NULL_IN_SPATIAL 158
#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */
-#define HA_ERR_TABLE_NEEDS_UPGRADE 160 /* The table changed in storage engine */
-#define HA_ERR_TABLE_READONLY 161 /* The table is not writable */
-#define HA_ERR_AUTOINC_READ_FAILED 162/* Failed to get the next autoinc value */
-#define HA_ERR_AUTOINC_ERANGE 163 /* Failed to set the row autoinc value */
-#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 164 /*Too many active concurrent transactions */
-/* You must also add numbers and description to extra/perror.c ! */
-
-#define HA_ERR_LAST 164 /*Copy last error nr.*/
-/* Add error numbers before HA_ERR_LAST and change it accordingly. */
+/* There's no partition in table for given value */
+#define HA_ERR_NO_PARTITION_FOUND 160
+#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */
+#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr */
+/*
+ Upholding foreign key constraints would lead to a duplicate key error
+ in some other table.
+*/
+#define HA_ERR_FOREIGN_DUPLICATE_KEY 163
+/* The table changed in storage engine */
+#define HA_ERR_TABLE_NEEDS_UPGRADE 164
+#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */
+
+#define HA_ERR_AUTOINC_READ_FAILED 166 /* Failed to get next autoinc value */
+#define HA_ERR_AUTOINC_ERANGE 167 /* Failed to set row autoinc value */
+#define HA_ERR_GENERIC 168 /* Generic error */
+/* row not actually updated: new values same as the old values */
+#define HA_ERR_RECORD_IS_THE_SAME 169
+/* It is not possible to log this statement */
+#define HA_ERR_LOGGING_IMPOSSIBLE 170 /* It is not possible to log this
+ statement */
+#define HA_ERR_CORRUPT_EVENT 171 /* The event was corrupt, leading to
+ illegal data being read */
+#define HA_ERR_NEW_FILE 172 /* New file format */
+#define HA_ERR_ROWS_EVENT_APPLY 173 /* The event could not be processed
+ no other hanlder error happened */
+#define HA_ERR_INITIALIZATION 174 /* Error during initialization */
+#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */
+#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */
+#define HA_ERR_TOO_MANY_CONCURRENT_TRXS 177 /*Too many active concurrent transactions */
+#define HA_ERR_LAST 177 /* Copy of last error nr */
+
+/* Number of different errors */
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
/* Other constants */
#define HA_NAMELEN 64 /* Max length of saved filename */
-#define NO_SUCH_KEY ((uint)~0) /* used as a key no. */
+#define NO_SUCH_KEY (~(uint)0) /* used as a key no. */
+
+typedef ulong key_part_map;
+#define HA_WHOLE_KEY (~(key_part_map)0)
/* Intern constants in databases */
@@ -442,7 +508,7 @@ enum en_fieldtype {
};
enum data_file_type {
- STATIC_RECORD,DYNAMIC_RECORD,COMPRESSED_RECORD
+ STATIC_RECORD, DYNAMIC_RECORD, COMPRESSED_RECORD, BLOCK_RECORD
};
/* For key ranges */
@@ -455,11 +521,13 @@ enum data_file_type {
#define EQ_RANGE 32
#define NULL_RANGE 64
#define GEOM_FLAG 128
+#define SKIP_RANGE 256
typedef struct st_key_range
{
- const byte *key;
+ const uchar *key;
uint length;
+ key_part_map keypart_map;
enum ha_rkey_function flag;
} key_range;
@@ -492,4 +560,7 @@ typedef ulong ha_rows;
#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
+/* invalidator function reference for Query Cache */
+typedef void (* invalidator_by_filename)(const char * filename);
+
#endif /* _my_base_h */