YoushouldhavereceivedacopyoftheGNUGeneralPublicLicense alongwiththisprogram;ifnot,writetotheFreeSoftwareFoundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
/* This file includes constants used with all databases */
#ifndef _my_base_h #define _my_base_h
#include <my_dir.h> /* This includes types */ #include <my_sys.h> #include <m_string.h> #include <errno.h>
#ifndef EOVERFLOW #define EOVERFLOW 84 #endif
#include <my_list.h>
/* The following is bits in the flag parameter to ha_open() */
#define HA_OPEN_ABORT_IF_LOCKED 0U /* default */ #define HA_OPEN_WAIT_IF_LOCKED 1U #define HA_OPEN_IGNORE_IF_LOCKED 2U /* Ignore lock error */ #define HA_OPEN_TMP_TABLE 4U /* Table is a temp table */ #define HA_OPEN_DELAY_KEY_WRITE 8U /* Don't update index */ #define HA_OPEN_ABORT_IF_CRASHED 16U #define HA_OPEN_FOR_REPAIR 32U /* open even if crashed */ #define HA_OPEN_FROM_SQL_LAYER 64U #define HA_OPEN_MMAP 128U /* open memory mapped */ #define HA_OPEN_COPY 256U /* Open copy (for repair) */ /* Internal temp table, used for temporary results */ #define HA_OPEN_INTERNAL_TABLE 512U #define HA_OPEN_NO_PSI_CALL 1024U /* Don't call/connect PSI */ #define HA_OPEN_MERGE_TABLE 2048U #define HA_OPEN_FOR_CREATE 4096U #define HA_OPEN_FOR_DROP (1U << 13) /* Open part of drop */ #define HA_OPEN_GLOBAL_TMP_TABLE (1U << 14) /* TMP table used by repliction */ #define HA_OPEN_SIZE_TRACKING (1U << 15) /* Thisistosignalthatthetablewillnotbecachedbythecaller andthetableshouldbeopeninread-onlymodeifthetoolrequests that
*/ #define HA_OPEN_FORCE_MODE (1U << 16) /* Force open mode */ #define HA_OPEN_DATA_READONLY (1U << 17) /* Use readonly for data */
enum ha_rkey_function {
HA_READ_KEY_EXACT, /* Find first record else error */
HA_READ_KEY_OR_NEXT, /* Record or next record */
HA_READ_KEY_OR_PREV, /* Record or previous */
HA_READ_AFTER_KEY, /* Find next rec. after key-record */
HA_READ_BEFORE_KEY, /* Find next rec. before key-record */
HA_READ_PREFIX, /* Key which as same prefix */
HA_READ_PREFIX_LAST, /* Last key with the same prefix */
HA_READ_PREFIX_LAST_OR_PREV, /* Last or prev key with the same prefix */
HA_READ_MBR_CONTAIN,
HA_READ_MBR_INTERSECT,
HA_READ_MBR_WITHIN,
HA_READ_MBR_DISJOINT,
HA_READ_MBR_EQUAL
};
/* Key algorithm types (stored in .frm) */
enum ha_key_alg {
HA_KEY_ALG_UNDEF= 0, /* Not specified. Practically the
key will be B-tree or hash */
HA_KEY_ALG_BTREE= 1, /* B-tree, default one */
HA_KEY_ALG_RTREE= 2, /* R-tree, for spatial searches */
HA_KEY_ALG_HASH= 3, /* HASH keys (HEAP tables) */
HA_KEY_ALG_FULLTEXT= 4, /* FULLTEXT */
HA_KEY_ALG_LONG_HASH= 5, /* long BLOB keys */
HA_KEY_ALG_UNIQUE_HASH= 6, /* Internal UNIQUE hash (Aria) */
HA_KEY_ALG_VECTOR= 7/* Vector search index */
};
/* 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_NOT_USED=2, /* Should be ignored by handler */
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 */
HA_EXTRA_READCHECK=6, /* Use readcheck (def) */
HA_EXTRA_KEYREAD=7, /* Read only key to database */
HA_EXTRA_NO_KEYREAD=8, /* Normal read of records (def) */
HA_EXTRA_NO_USER_CHANGE=9, /* No user is allowed to write */
HA_EXTRA_KEY_CACHE=10,
HA_EXTRA_NO_KEY_CACHE=11,
HA_EXTRA_WAIT_LOCK=12, /* Wait until file is available (def) */
HA_EXTRA_NO_WAIT_LOCK=13, /* If file is locked, return quickly */
HA_EXTRA_WRITE_CACHE=14, /* Use write cache in ha_write() */
HA_EXTRA_FLUSH_CACHE=15, /* flush write_record_cache */
HA_EXTRA_NO_KEYS=16, /* Remove all update of keys */
HA_EXTRA_KEYREAD_CHANGE_POS=17, /* Keyread, but change pos */ /* xxxxchk -r must be used */
HA_EXTRA_REMEMBER_POS=18, /* Remember pos for next/prev */
HA_EXTRA_RESTORE_POS=19,
HA_EXTRA_REINIT_CACHE=20, /* init cache from current record */
HA_EXTRA_FORCE_REOPEN=21, /* Datafile have changed on disk */
HA_EXTRA_FLUSH, /* Flush tables to disk */
HA_EXTRA_NO_ROWS, /* Don't write rows */
HA_EXTRA_RESET_STATE, /* Reset positions */
HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/
HA_EXTRA_NO_IGNORE_DUP_KEY,
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 */ /* On-the-flyswitchingbetweenuniqueandnon-uniquekeyinserting.
*/
HA_EXTRA_CHANGE_KEY_TO_UNIQUE,
HA_EXTRA_CHANGE_KEY_TO_DUP, /* WhenusingHA_EXTRA_KEYREAD,overwriteonlykeymemberfieldsandkeep otherfieldsintact.Whenthisisoff(bydefault)InnoDBwillusememcpy tooverwriteentirerow.
*/
HA_EXTRA_KEYREAD_PRESERVE_FIELDS,
HA_EXTRA_MMAP, /* Ignoreiftheatupleisnotfound,continueprocessingthe transactionandignorethat'row'.Neededforidempotency handlingontheslave
*/
HA_EXTRA_IGNORE_NO_KEY,
HA_EXTRA_NO_IGNORE_NO_KEY, /* Markthetableasalogtable.Forsomehandlers(e.g.CSV)thisresults inaspeciallockingforthetable.
*/
HA_EXTRA_MARK_AS_LOG_TABLE, /* Informshandlerthatwrite_row()whichtriestoinsertnewrowintothe tableandencounterssomealreadyexistingrowwithsameprimary/unique keycanreplaceoldrowwithnewrowinsteadofreportingerror(basically itinformshandlerthatwedoREPLACEinsteadofsimpleINSERT). Offbydefault.
*/
HA_EXTRA_WRITE_CAN_REPLACE,
HA_EXTRA_WRITE_CANNOT_REPLACE, /* Informhandlerthatdelete_row()/update_row()cannotbatchdeletes/updates andshouldperformthemimmediately.Thismaybeneededwhentablehas AFTERDELETE/UPDATEtriggerswhichaccesstosubjecttable. Theseflagsareresetbythehandler::extra(HA_EXTRA_RESET)call.
*/
HA_EXTRA_DELETE_CANNOT_BATCH,
HA_EXTRA_UPDATE_CANNOT_BATCH, /* Informhandlerthatan"INSERT...ONDUPLICATEKEYUPDATE"willbe executed.ThisconditionisunsetbyHA_EXTRA_NO_IGNORE_DUP_KEY.
*/
HA_EXTRA_INSERT_WITH_UPDATE, /* Inform handler that we will do a rename */
HA_EXTRA_PREPARE_FOR_RENAME, /* SpecialactionsforMERGEtables.
*/
HA_EXTRA_ADD_CHILDREN_LIST,
HA_EXTRA_ATTACH_CHILDREN,
HA_EXTRA_IS_ATTACHED_CHILDREN,
HA_EXTRA_DETACH_CHILDREN,
HA_EXTRA_DETACH_CHILD, /* Inform handler we will force a close as part of flush */
HA_EXTRA_PREPARE_FOR_FORCED_CLOSE, /* Inform handler that we will do an alter table */
HA_EXTRA_PREPARE_FOR_ALTER_TABLE, /* Usedinha_partition::handle_ordered_index_scan()toinformengine thatwearestartinganorderedindexscan.NeededbySpider
*/
HA_EXTRA_STARTING_ORDERED_INDEX_SCAN, /** Start copying in ALTER TABLE...ALGORITHM=COPY or CREATE TABLE..SELECT */
HA_EXTRA_BEGIN_COPY, /** Start writing rows during ALTER IGNORE TABLE..ALGORITHM=COPY */
HA_EXTRA_BEGIN_ALTER_IGNORE_COPY, /** Finish HA_EXTRA_BEGIN_COPY or HA_EXTRA_BEGIN_ALTER_IGNORE_COPY */
HA_EXTRA_END_COPY, /** Abort HA_EXTRA_BEGIN_COPY or HA_EXTRA_BEGIN_ALTER_IGNORE_COPY */
HA_EXTRA_ABORT_COPY, /* Advisetheenginethatthenextoperationwillbeafulltableor fullindexscan
*/
HA_EXTRA_FULL_SCAN
};
/* 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 {
HA_PANIC_CLOSE, /* Close all databases */
HA_PANIC_WRITE, /* Unlock and write status */
HA_PANIC_READ /* Lock and read keyinfo */
};
/* The following is parameter to ha_create(); keytypes */
enum ha_base_keytype {
HA_KEYTYPE_END=0,
HA_KEYTYPE_TEXT=1, /* Key is sorted as letters */
HA_KEYTYPE_BINARY=2, /* Key is sorted as unsigned chars */
HA_KEYTYPE_SHORT_INT=3,
HA_KEYTYPE_LONG_INT=4,
HA_KEYTYPE_FLOAT=5,
HA_KEYTYPE_DOUBLE=6,
HA_KEYTYPE_NUM=7, /* Not packed num with pre-space */
HA_KEYTYPE_USHORT_INT=8,
HA_KEYTYPE_ULONG_INT=9,
HA_KEYTYPE_LONGLONG=10,
HA_KEYTYPE_ULONGLONG=11,
HA_KEYTYPE_INT24=12,
HA_KEYTYPE_UINT24=13,
HA_KEYTYPE_INT8=14, /* Varchar (0-255 bytes) with length packed with 1 byte */
HA_KEYTYPE_VARTEXT1=15, /* Key is sorted as letters */
HA_KEYTYPE_VARBINARY1=16, /* Key is sorted as unsigned chars */ /* Varchar (0-65535 bytes) with length packed with 2 bytes */
HA_KEYTYPE_VARTEXT2=17, /* Key is sorted as letters */
HA_KEYTYPE_VARBINARY2=18, /* Key is sorted as unsigned chars */
HA_KEYTYPE_BIT=19
};
/* Internal Flag Can be calculated */ #define HA_INVISIBLE_KEY (2<<18)
/* The combination of the above can be used for key type comparison. */ #define HA_KEYFLAG_MASK (HA_NOSAME | HA_AUTO_KEY | HA_NULL_ARE_EQUAL | \
HA_GENERATED_KEY | HA_UNIQUE_HASH)
/* These flags can be added to key-seg-flag */
#define HA_SPACE_PACK 1/* Pack space in key-seg */ #define HA_PART_KEY_SEG 4/* Used by MySQL for part-key-cols */ #define HA_VAR_LENGTH_PART 8 #define HA_NULL_PART 16 #define HA_BLOB_PART 32 #define HA_SWAP_KEY 64 #define HA_REVERSE_SORT 128/* Sort key in reverse order */ #define HA_NO_SORT 256/* do not bother sorting on this keyseg */
#define HA_BIT_PART 1024 #define HA_CAN_MEMCMP 2048/* internal, never stored in frm */
/* this one is not used */ #define HA_STATUS_POS 1U /* assumingthetablekeepssharedactualcopyofthe'info'and local,possiblyoutdatedcopy,thefollowingflagmeansthat itshouldnottrytogettheactualdata(lockingthesharedstructure) slightlyoutdatedversionwillsuffice
*/ #define HA_STATUS_NO_LOCK 2U /* update the time of the last modification (in handler::update_time) */ #define HA_STATUS_TIME 4U /* updatethe'constant'partoftheinfo: handler::max_data_file_length,max_index_file_length,create_time sortkey,ref_length,block_size,data_file_name,index_file_name. handler::table->s->keys_in_use,keys_for_keyread,rec_per_key
*/ #define HA_STATUS_CONST 8U /* updatethe'variable'partoftheinfo: handler::records,deleted,data_file_length,index_file_length, check_time,mean_rec_length
*/ #define HA_STATUS_VARIABLE 16U /* gettheinformationaboutthekeythatcausedlastduplicatevalueerror updatehandler::errkeyandhandler::dupp_ref seehandler::get_dup_key()
*/ #define HA_STATUS_ERRKEY 32U /* updatehandler::auto_increment_value
*/ #define HA_STATUS_AUTO 64U /* Getalsodelete_lengthwhenHA_STATUS_VARIABLEiscalled.It'soktosetitalso whenonlyHA_STATUS_VARIABLEbutitwon'tbeused.
*/ #define HA_STATUS_VARIABLE_EXTRA 128U /* Treatemptytableasempty(ignoreHA_STATUS_TIMEhack).
*/ #define HA_STATUS_OPEN 256U
/* Errorcodesgivenbyhandlerfunctions
opt_sum_query()assumesthesecodesare>1 DonotadderrornumbersbeforeHA_ERR_FIRST. Ifnecessarytoaddlowernumbers,changeHA_ERR_FIRSTaccordingly.
*/ #define HA_ERR_FIRST 120/* Copy of 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/* Duplicate key on write */ #define HA_ERR_INTERNAL_ERROR 122/* Internal error */ #define HA_ERR_RECORD_CHANGED 123/* Update with is recoverable */ #define HA_ERR_WRONG_INDEX 124/* Wrong index given to function */ #define HA_ERR_CRASHED 126/* Indexfile is crashed */ #define HA_ERR_WRONG_IN_RECORD 127/* Record-file is crashed */ #define HA_ERR_OUT_OF_MEM 128/* Out of memory */ #define HA_ERR_RETRY_INIT 129/* Initialization failed and should be retried */ #define HA_ERR_NOT_A_TABLE 130/* not a MYI file - no signature */ #define HA_ERR_WRONG_COMMAND 131/* Command not supported */ #define HA_ERR_OLD_FILE 132/* old database file */ #define HA_ERR_NO_ACTIVE_RECORD 133/* No record read in update() */ #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 */ #define HA_ERR_UNSUPPORTED 138/* unsupported extension used */ #define HA_ERR_TO_BIG_ROW 139/* Too big row */ #define HA_WRONG_CREATE_OPTION 140/* Wrong create option */ #define HA_ERR_FOUND_DUPP_UNIQUE 141/* Duplicate unique on write */ #define HA_ERR_UNKNOWN_CHARSET 142/* Can't open charset */ #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 #define HA_ERR_LOCK_TABLE_FULL 147 #define HA_ERR_READ_ONLY_TRANSACTION 148/* Updates not allowed */ #define HA_ERR_LOCK_DEADLOCK 149 #define HA_ERR_CANNOT_ADD_FOREIGN 150/* Cannot add a foreign key constr. */ #define HA_ERR_NO_REFERENCED_ROW 151/* Cannot add a child row */ #define HA_ERR_ROW_IS_REFERENCED 152/* Cannot delete a parent row */ #define HA_ERR_NO_SAVEPOINT 153/* No savepoint with that name */ #define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154/* Non unique key block size */ #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 */ /* 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 */ /* 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 */ /* Upholdingforeignkeyconstraintswouldleadtoaduplicatekeyerror insomeothertable.
*/ #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 #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 handler 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 */ /* There's no explicitly listed partition in table for the given value */ #define HA_ERR_NOT_IN_LOCK_PARTITIONS 178 #define HA_ERR_INDEX_COL_TOO_LONG 179/* Index column length exceeds limit */ #define HA_ERR_INDEX_CORRUPT 180/* Index corrupted */ #define HA_ERR_UNDO_REC_TOO_BIG 181/* Undo log record too big */ #define HA_FTS_INVALID_DOCID 182/* Invalid InnoDB Doc ID */ /* #define HA_ERR_TABLE_IN_FK_CHECK 183 */ /* Table being used in foreign key check */ #define HA_ERR_TABLESPACE_EXISTS 184/* The tablespace existed in storage engine */ #define HA_ERR_TOO_MANY_FIELDS 185/* Table has too many columns */ #define HA_ERR_ROW_IN_WRONG_PARTITION 186/* Row in wrong partition */ #define HA_ERR_ROW_NOT_VISIBLE 187 #define HA_ERR_ABORTED_BY_USER 188 #define HA_ERR_DISK_FULL 189 #define HA_ERR_INCOMPATIBLE_DEFINITION 190 #define HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE 191/* Too many words in a phrase */ #define HA_ERR_DECRYPTION_FAILED 192/* Table encrypted but decrypt failed */ #define HA_ERR_FK_DEPTH_EXCEEDED 193/* FK cascade depth exceeded */ #define HA_ERR_TABLESPACE_MISSING 194/* Missing Tablespace */ #define HA_ERR_SEQUENCE_INVALID_DATA 195 #define HA_ERR_SEQUENCE_RUN_OUT 196 #define HA_ERR_COMMIT_ERROR 197 #define HA_ERR_PARTITION_LIST 198 #define HA_ERR_NO_ENCRYPTION 199 #define HA_ERR_ROLLBACK 200/* Automatic rollback done */ #define HA_ERR_LOCAL_TMP_SPACE_FULL 201 #define HA_ERR_GLOBAL_TMP_SPACE_FULL 202 #define HA_ERR_LAST 202/* Copy of last error nr * */
/* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
/* bits in update */ #define HA_STATE_CHANGED 1U /* Database has changed */ #define HA_STATE_AKTIV 2U /* Has a current record */ #define HA_STATE_WRITTEN 4U /* Record is written */ #define HA_STATE_DELETED 8U #define HA_STATE_NEXT_FOUND 16U /* Next found record (record before) */ #define HA_STATE_PREV_FOUND 32U /* Prev found record (record after) */ #define HA_STATE_NO_KEY 64U /* Last read didn't find record */ #define HA_STATE_KEY_CHANGED 128U #define HA_STATE_WRITE_AT_END 256U /* set in _ps_find_writepos */ #define HA_STATE_BUFF_SAVED 512U /* If current keybuff is info->buff */ #define HA_STATE_ROW_CHANGED 1024U /* To invalidate ROW cache */ #define HA_STATE_EXTEND_BLOCK 2048U #define HA_STATE_RNEXT_SAME 4096U /* rnext_same occupied lastkey2 */
/* myisampack expects no more than 32 field types. */ enum en_fieldtype {
FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,
FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO,
FIELD_VARCHAR,FIELD_CHECK,
FIELD_enum_val_count
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.