2001-12-06 13:10:51 +01:00
|
|
|
/* Copyright (C) 2000 MySQL AB
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2006-12-23 20:17:15 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
2001-12-06 13:10:51 +01:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
2000-07-31 21:29:14 +02:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2001-12-06 13:10:51 +01:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
/* 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 CHSIZE_USED
|
2001-09-14 01:54:33 +02:00
|
|
|
#include <my_global.h>
|
2000-07-31 21:29:14 +02:00
|
|
|
#include <my_dir.h> /* This includes types */
|
|
|
|
#include <my_sys.h>
|
|
|
|
#include <m_string.h>
|
|
|
|
#include <errno.h>
|
2004-03-16 16:35:47 +01:00
|
|
|
|
|
|
|
#ifndef EOVERFLOW
|
|
|
|
#define EOVERFLOW 84
|
|
|
|
#endif
|
|
|
|
|
2000-07-31 21:29:14 +02:00
|
|
|
#if !defined(USE_MY_FUNC) && !defined(THREAD)
|
|
|
|
#include <my_nosys.h> /* For faster code, after test */
|
|
|
|
#endif /* USE_MY_FUNC */
|
|
|
|
#endif /* stdin */
|
|
|
|
#include <my_list.h>
|
|
|
|
|
|
|
|
/* The following is bits in the flag parameter to ha_open() */
|
|
|
|
|
|
|
|
#define HA_OPEN_ABORT_IF_LOCKED 0 /* default */
|
|
|
|
#define HA_OPEN_WAIT_IF_LOCKED 1
|
|
|
|
#define HA_OPEN_IGNORE_IF_LOCKED 2
|
2000-09-25 23:33:25 +02:00
|
|
|
#define HA_OPEN_TMP_TABLE 4 /* Table is a temp table */
|
|
|
|
#define HA_OPEN_DELAY_KEY_WRITE 8 /* Don't update index */
|
|
|
|
#define HA_OPEN_ABORT_IF_CRASHED 16
|
2000-10-10 23:06:37 +02:00
|
|
|
#define HA_OPEN_FOR_REPAIR 32 /* open even if crashed */
|
2005-12-28 13:05:30 +01:00
|
|
|
#define HA_OPEN_FROM_SQL_LAYER 64
|
2007-02-13 16:33:32 +01:00
|
|
|
#define HA_OPEN_MMAP 128 /* open memory mapped */
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
/* The following is parameter to ha_rkey() how to use key */
|
|
|
|
|
2003-10-15 21:40:36 +02:00
|
|
|
/*
|
|
|
|
We define a complete-field prefix of a key value as a prefix where
|
|
|
|
the last included field in the prefix contains the full field, not
|
|
|
|
just some bytes from the start of the field. A partial-field prefix
|
|
|
|
is allowed to contain only a few first bytes from the last included
|
|
|
|
field.
|
2003-02-18 18:57:05 +01:00
|
|
|
|
2003-10-15 21:40:36 +02:00
|
|
|
Below HA_READ_KEY_EXACT, ..., HA_READ_BEFORE_KEY can take a
|
|
|
|
complete-field prefix of a key value as the search
|
|
|
|
key. HA_READ_PREFIX and HA_READ_PREFIX_LAST could also take a
|
|
|
|
partial-field prefix, but currently (4.0.10) they are only used with
|
|
|
|
complete-field prefixes. MySQL uses a padding trick to implement
|
|
|
|
LIKE 'abc%' queries.
|
2003-02-18 18:57:05 +01:00
|
|
|
|
2003-10-15 21:40:36 +02:00
|
|
|
NOTE that in InnoDB HA_READ_PREFIX_LAST will NOT work with a
|
|
|
|
partial-field prefix because InnoDB currently strips spaces from the
|
|
|
|
end of varchar fields!
|
|
|
|
*/
|
2003-02-18 18:57:05 +01:00
|
|
|
|
2000-07-31 21:29:14 +02:00
|
|
|
enum ha_rkey_function {
|
2002-10-25 16:09:47 +02:00
|
|
|
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 */
|
2002-01-05 21:51:42 +01:00
|
|
|
HA_READ_MBR_CONTAIN,
|
|
|
|
HA_READ_MBR_INTERSECT,
|
|
|
|
HA_READ_MBR_WITHIN,
|
|
|
|
HA_READ_MBR_DISJOINT,
|
|
|
|
HA_READ_MBR_EQUAL
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Key algorithm types */
|
|
|
|
|
2002-10-25 16:09:47 +02:00
|
|
|
enum ha_key_alg {
|
2002-04-12 20:35:46 +02:00
|
|
|
HA_KEY_ALG_UNDEF= 0, /* Not specified (old file) */
|
|
|
|
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 (MyISAM tables) */
|
2000-07-31 21:29:14 +02:00
|
|
|
};
|
|
|
|
|
2006-12-19 23:20:43 +01:00
|
|
|
/* 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 */
|
|
|
|
};
|
|
|
|
|
2000-07-31 21:29:14 +02:00
|
|
|
/* 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 */
|
This changeset is largely a handler cleanup changeset (WL#3281), but includes fixes and cleanups that was found necessary while testing the handler changes
Changes that requires code changes in other code of other storage engines.
(Note that all changes are very straightforward and one should find all issues
by compiling a --debug build and fixing all compiler errors and all
asserts in field.cc while running the test suite),
- New optional handler function introduced: reset()
This is called after every DML statement to make it easy for a handler to
statement specific cleanups.
(The only case it's not called is if force the file to be closed)
- handler::extra(HA_EXTRA_RESET) is removed. Code that was there before
should be moved to handler::reset()
- table->read_set contains a bitmap over all columns that are needed
in the query. read_row() and similar functions only needs to read these
columns
- table->write_set contains a bitmap over all columns that will be updated
in the query. write_row() and update_row() only needs to update these
columns.
The above bitmaps should now be up to date in all context
(including ALTER TABLE, filesort()).
The handler is informed of any changes to the bitmap after
fix_fields() by calling the virtual function
handler::column_bitmaps_signal(). If the handler does caching of
these bitmaps (instead of using table->read_set, table->write_set),
it should redo the caching in this code. as the signal() may be sent
several times, it's probably best to set a variable in the signal
and redo the caching on read_row() / write_row() if the variable was
set.
- Removed the read_set and write_set bitmap objects from the handler class
- Removed all column bit handling functions from the handler class.
(Now one instead uses the normal bitmap functions in my_bitmap.c instead
of handler dedicated bitmap functions)
- field->query_id is removed. One should instead instead check
table->read_set and table->write_set if a field is used in the query.
- handler::extra(HA_EXTRA_RETRIVE_ALL_COLS) and
handler::extra(HA_EXTRA_RETRIEVE_PRIMARY_KEY) are removed. One should now
instead use table->read_set to check for which columns to retrieve.
- If a handler needs to call Field->val() or Field->store() on columns
that are not used in the query, one should install a temporary
all-columns-used map while doing so. For this, we provide the following
functions:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->read_set);
field->val();
dbug_tmp_restore_column_map(table->read_set, old_map);
and similar for the write map:
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
field->val();
dbug_tmp_restore_column_map(table->write_set, old_map);
If this is not done, you will sooner or later hit a DBUG_ASSERT
in the field store() / val() functions.
(For not DBUG binaries, the dbug_tmp_restore_column_map() and
dbug_tmp_restore_column_map() are inline dummy functions and should
be optimized away be the compiler).
- If one needs to temporary set the column map for all binaries (and not
just to avoid the DBUG_ASSERT() in the Field::store() / Field::val()
methods) one should use the functions tmp_use_all_columns() and
tmp_restore_column_map() instead of the above dbug_ variants.
- All 'status' fields in the handler base class (like records,
data_file_length etc) are now stored in a 'stats' struct. This makes
it easier to know what status variables are provided by the base
handler. This requires some trivial variable names in the extra()
function.
- New virtual function handler::records(). This is called to optimize
COUNT(*) if (handler::table_flags() & HA_HAS_RECORDS()) is true.
(stats.records is not supposed to be an exact value. It's only has to
be 'reasonable enough' for the optimizer to be able to choose a good
optimization path).
- Non virtual handler::init() function added for caching of virtual
constants from engine.
- Removed has_transactions() virtual method. Now one should instead return
HA_NO_TRANSACTIONS in table_flags() if the table handler DOES NOT support
transactions.
- The 'xxxx_create_handler()' function now has a MEM_ROOT_root argument
that is to be used with 'new handler_name()' to allocate the handler
in the right area. The xxxx_create_handler() function is also
responsible for any initialization of the object before returning.
For example, one should change:
static handler *myisam_create_handler(TABLE_SHARE *table)
{
return new ha_myisam(table);
}
->
static handler *myisam_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
{
return new (mem_root) ha_myisam(table);
}
- New optional virtual function: use_hidden_primary_key().
This is called in case of an update/delete when
(table_flags() and HA_PRIMARY_KEY_REQUIRED_FOR_DELETE) is defined
but we don't have a primary key. This allows the handler to take precisions
in remembering any hidden primary key to able to update/delete any
found row. The default handler marks all columns to be read.
- handler::table_flags() now returns a ulonglong (to allow for more flags).
- New/changed table_flags()
- HA_HAS_RECORDS Set if ::records() is supported
- HA_NO_TRANSACTIONS Set if engine doesn't support transactions
- HA_PRIMARY_KEY_REQUIRED_FOR_DELETE
Set if we should mark all primary key columns for
read when reading rows as part of a DELETE
statement. If there is no primary key,
all columns are marked for read.
- HA_PARTIAL_COLUMN_READ Set if engine will not read all columns in some
cases (based on table->read_set)
- HA_PRIMARY_KEY_ALLOW_RANDOM_ACCESS
Renamed to HA_PRIMARY_KEY_REQUIRED_FOR_POSITION.
- HA_DUPP_POS Renamed to HA_DUPLICATE_POS
- HA_REQUIRES_KEY_COLUMNS_FOR_DELETE
Set this if we should mark ALL key columns for
read when when reading rows as part of a DELETE
statement. In case of an update we will mark
all keys for read for which key part changed
value.
- HA_STATS_RECORDS_IS_EXACT
Set this if stats.records is exact.
(This saves us some extra records() calls
when optimizing COUNT(*))
- Removed table_flags()
- HA_NOT_EXACT_COUNT Now one should instead use HA_HAS_RECORDS if
handler::records() gives an exact count() and
HA_STATS_RECORDS_IS_EXACT if stats.records is exact.
- HA_READ_RND_SAME Removed (no one supported this one)
- Removed not needed functions ha_retrieve_all_cols() and ha_retrieve_all_pk()
- Renamed handler::dupp_pos to handler::dup_pos
- Removed not used variable handler::sortkey
Upper level handler changes:
- ha_reset() now does some overall checks and calls ::reset()
- ha_table_flags() added. This is a cached version of table_flags(). The
cache is updated on engine creation time and updated on open.
MySQL level changes (not obvious from the above):
- DBUG_ASSERT() added to check that column usage matches what is set
in the column usage bit maps. (This found a LOT of bugs in current
column marking code).
- In 5.1 before, all used columns was marked in read_set and only updated
columns was marked in write_set. Now we only mark columns for which we
need a value in read_set.
- Column bitmaps are created in open_binary_frm() and open_table_from_share().
(Before this was in table.cc)
- handler::table_flags() calls are replaced with handler::ha_table_flags()
- For calling field->val() you must have the corresponding bit set in
table->read_set. For calling field->store() you must have the
corresponding bit set in table->write_set. (There are asserts in
all store()/val() functions to catch wrong usage)
- thd->set_query_id is renamed to thd->mark_used_columns and instead
of setting this to an integer value, this has now the values:
MARK_COLUMNS_NONE, MARK_COLUMNS_READ, MARK_COLUMNS_WRITE
Changed also all variables named 'set_query_id' to mark_used_columns.
- In filesort() we now inform the handler of exactly which columns are needed
doing the sort and choosing the rows.
- The TABLE_SHARE object has a 'all_set' column bitmap one can use
when one needs a column bitmap with all columns set.
(This is used for table->use_all_columns() and other places)
- The TABLE object has 3 column bitmaps:
- def_read_set Default bitmap for columns to be read
- def_write_set Default bitmap for columns to be written
- tmp_set Can be used as a temporary bitmap when needed.
The table object has also two pointer to bitmaps read_set and write_set
that the handler should use to find out which columns are used in which way.
- count() optimization now calls handler::records() instead of using
handler->stats.records (if (table_flags() & HA_HAS_RECORDS) is true).
- Added extra argument to Item::walk() to indicate if we should also
traverse sub queries.
- Added TABLE parameter to cp_buffer_from_ref()
- Don't close tables created with CREATE ... SELECT but keep them in
the table cache. (Faster usage of newly created tables).
New interfaces:
- table->clear_column_bitmaps() to initialize the bitmaps for tables
at start of new statements.
- table->column_bitmaps_set() to set up new column bitmaps and signal
the handler about this.
- table->column_bitmaps_set_no_signal() for some few cases where we need
to setup new column bitmaps but don't signal the handler (as the handler
has already been signaled about these before). Used for the momement
only in opt_range.cc when doing ROR scans.
- table->use_all_columns() to install a bitmap where all columns are marked
as use in the read and the write set.
- table->default_column_bitmaps() to install the normal read and write
column bitmaps, but not signaling the handler about this.
This is mainly used when creating TABLE instances.
- table->mark_columns_needed_for_delete(),
table->mark_columns_needed_for_delete() and
table->mark_columns_needed_for_insert() to allow us to put additional
columns in column usage maps if handler so requires.
(The handler indicates what it neads in handler->table_flags())
- table->prepare_for_position() to allow us to tell handler that it
needs to read primary key parts to be able to store them in
future table->position() calls.
(This replaces the table->file->ha_retrieve_all_pk function)
- table->mark_auto_increment_column() to tell handler are going to update
columns part of any auto_increment key.
- table->mark_columns_used_by_index() to mark all columns that is part of
an index. It will also send extra(HA_EXTRA_KEYREAD) to handler to allow
it to quickly know that it only needs to read colums that are part
of the key. (The handler can also use the column map for detecting this,
but simpler/faster handler can just monitor the extra() call).
- table->mark_columns_used_by_index_no_reset() to in addition to other columns,
also mark all columns that is used by the given key.
- table->restore_column_maps_after_mark_index() to restore to default
column maps after a call to table->mark_columns_used_by_index().
- New item function register_field_in_read_map(), for marking used columns
in table->read_map. Used by filesort() to mark all used columns
- Maintain in TABLE->merge_keys set of all keys that are used in query.
(Simplices some optimization loops)
- Maintain Field->part_of_key_not_clustered which is like Field->part_of_key
but the field in the clustered key is not assumed to be part of all index.
(used in opt_range.cc for faster loops)
- dbug_tmp_use_all_columns(), dbug_tmp_restore_column_map()
tmp_use_all_columns() and tmp_restore_column_map() functions to temporally
mark all columns as usable. The 'dbug_' version is primarily intended
inside a handler when it wants to just call Field:store() & Field::val()
functions, but don't need the column maps set for any other usage.
(ie:: bitmap_is_set() is never called)
- We can't use compare_records() to skip updates for handlers that returns
a partial column set and the read_set doesn't cover all columns in the
write set. The reason for this is that if we have a column marked only for
write we can't in the MySQL level know if the value changed or not.
The reason this worked before was that MySQL marked all to be written
columns as also to be read. The new 'optimal' bitmaps exposed this 'hidden
bug'.
- open_table_from_share() does not anymore setup temporary MEM_ROOT
object as a thread specific variable for the handler. Instead we
send the to-be-used MEMROOT to get_new_handler().
(Simpler, faster code)
Bugs fixed:
- Column marking was not done correctly in a lot of cases.
(ALTER TABLE, when using triggers, auto_increment fields etc)
(Could potentially result in wrong values inserted in table handlers
relying on that the old column maps or field->set_query_id was correct)
Especially when it comes to triggers, there may be cases where the
old code would cause lost/wrong values for NDB and/or InnoDB tables.
- Split thd->options flag OPTION_STATUS_NO_TRANS_UPDATE to two flags:
OPTION_STATUS_NO_TRANS_UPDATE and OPTION_KEEP_LOG.
This allowed me to remove some wrong warnings about:
"Some non-transactional changed tables couldn't be rolled back"
- Fixed handling of INSERT .. SELECT and CREATE ... SELECT that wrongly reset
(thd->options & OPTION_STATUS_NO_TRANS_UPDATE) which caused us to loose
some warnings about
"Some non-transactional changed tables couldn't be rolled back")
- Fixed use of uninitialized memory in ha_ndbcluster.cc::delete_table()
which could cause delete_table to report random failures.
- Fixed core dumps for some tests when running with --debug
- Added missing FN_LIBCHAR in mysql_rm_tmp_tables()
(This has probably caused us to not properly remove temporary files after
crash)
- slow_logs was not properly initialized, which could maybe cause
extra/lost entries in slow log.
- If we get an duplicate row on insert, change column map to read and
write all columns while retrying the operation. This is required by
the definition of REPLACE and also ensures that fields that are only
part of UPDATE are properly handled. This fixed a bug in NDB and
REPLACE where REPLACE wrongly copied some column values from the replaced
row.
- For table handler that doesn't support NULL in keys, we would give an error
when creating a primary key with NULL fields, even after the fields has been
automaticly converted to NOT NULL.
- Creating a primary key on a SPATIAL key, would fail if field was not
declared as NOT NULL.
Cleanups:
- Removed not used condition argument to setup_tables
- Removed not needed item function reset_query_id_processor().
- Field->add_index is removed. Now this is instead maintained in
(field->flags & FIELD_IN_ADD_INDEX)
- Field->fieldnr is removed (use field->field_index instead)
- New argument to filesort() to indicate that it should return a set of
row pointers (not used columns). This allowed me to remove some references
to sql_command in filesort and should also enable us to return column
results in some cases where we couldn't before.
- Changed column bitmap handling in opt_range.cc to be aligned with TABLE
bitmap, which allowed me to use bitmap functions instead of looping over
all fields to create some needed bitmaps. (Faster and smaller code)
- Broke up found too long lines
- Moved some variable declaration at start of function for better code
readability.
- Removed some not used arguments from functions.
(setup_fields(), mysql_prepare_insert_check_table())
- setup_fields() now takes an enum instead of an int for marking columns
usage.
- For internal temporary tables, use handler::write_row(),
handler::delete_row() and handler::update_row() instead of
handler::ha_xxxx() for faster execution.
- Changed some constants to enum's and define's.
- Using separate column read and write sets allows for easier checking
of timestamp field was set by statement.
- Remove calls to free_io_cache() as this is now done automaticly in ha_reset()
- Don't build table->normalized_path as this is now identical to table->path
(after bar's fixes to convert filenames)
- Fixed some missed DBUG_PRINT(.."%lx") to use "0x%lx" to make it easier to
do comparision with the 'convert-dbug-for-diff' tool.
Things left to do in 5.1:
- We wrongly log failed CREATE TABLE ... SELECT in some cases when using
row based logging (as shown by testcase binlog_row_mix_innodb_myisam.result)
Mats has promised to look into this.
- Test that my fix for CREATE TABLE ... SELECT is indeed correct.
(I added several test cases for this, but in this case it's better that
someone else also tests this throughly).
Lars has promosed to do this.
2006-06-04 17:52:22 +02:00
|
|
|
HA_EXTRA_NOT_USED=2,
|
2004-04-06 21:35:26 +02:00
|
|
|
HA_EXTRA_CACHE=3, /* Cache record in HA_rrnd() */
|
|
|
|
HA_EXTRA_NO_CACHE=4, /* End caching of records (def) */
|
2000-07-31 21:29:14 +02:00
|
|
|
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 avalably (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 */
|
2000-10-15 17:45:53 +02:00
|
|
|
HA_EXTRA_NO_ROWS, /* Don't write rows */
|
2000-12-24 14:19:00 +01:00
|
|
|
HA_EXTRA_RESET_STATE, /* Reset positions */
|
|
|
|
HA_EXTRA_IGNORE_DUP_KEY, /* Dup keys don't rollback everything*/
|
2001-02-17 13:19:19 +01:00
|
|
|
HA_EXTRA_NO_IGNORE_DUP_KEY,
|
2002-11-29 15:40:18 +01:00
|
|
|
HA_EXTRA_PREPARE_FOR_DELETE,
|
2003-06-12 13:29:02 +02:00
|
|
|
HA_EXTRA_PREPARE_FOR_UPDATE, /* Remove read cache if problems */
|
2004-03-18 16:47:16 +01:00
|
|
|
HA_EXTRA_PRELOAD_BUFFER_SIZE, /* Set buffer size for preloading */
|
|
|
|
/*
|
|
|
|
On-the-fly switching between unique and non-unique key inserting.
|
|
|
|
*/
|
|
|
|
HA_EXTRA_CHANGE_KEY_TO_UNIQUE,
|
2004-05-13 02:50:54 +02:00
|
|
|
HA_EXTRA_CHANGE_KEY_TO_DUP,
|
2004-05-12 23:38:40 +02:00
|
|
|
/*
|
|
|
|
When using HA_EXTRA_KEYREAD, overwrite only key member fields and keep
|
|
|
|
other fields intact. When this is off (by default) InnoDB will use memcpy
|
|
|
|
to overwrite entire row.
|
|
|
|
*/
|
2005-12-01 13:34:48 +01:00
|
|
|
HA_EXTRA_KEYREAD_PRESERVE_FIELDS,
|
2006-01-12 19:51:02 +01:00
|
|
|
HA_EXTRA_MMAP,
|
2006-01-19 03:56:06 +01:00
|
|
|
/*
|
2006-01-12 19:51:02 +01:00
|
|
|
Ignore if the a tuple is not found, continue processing the
|
|
|
|
transaction and ignore that 'row'. Needed for idempotency
|
|
|
|
handling on the slave
|
2006-03-22 15:56:53 +01:00
|
|
|
|
|
|
|
Currently only used by NDB storage engine. Partition handler ignores flag.
|
2006-01-12 19:51:02 +01:00
|
|
|
*/
|
|
|
|
HA_EXTRA_IGNORE_NO_KEY,
|
2006-01-19 03:56:06 +01:00
|
|
|
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.
|
|
|
|
*/
|
2006-07-02 00:12:53 +02:00
|
|
|
HA_EXTRA_MARK_AS_LOG_TABLE,
|
2006-07-01 23:51:10 +02:00
|
|
|
/*
|
|
|
|
Informs handler that write_row() which tries to insert new row into the
|
|
|
|
table and encounters some already existing row with same primary/unique
|
|
|
|
key can replace old row with new row instead of reporting error (basically
|
|
|
|
it informs handler that we do REPLACE instead of simple INSERT).
|
|
|
|
Off by default.
|
|
|
|
*/
|
|
|
|
HA_EXTRA_WRITE_CAN_REPLACE,
|
|
|
|
HA_EXTRA_WRITE_CANNOT_REPLACE
|
2000-07-31 21:29:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
/* 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,
|
2004-12-18 04:19:21 +01:00
|
|
|
/* 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 */
|
2004-12-18 05:05:16 +01:00
|
|
|
HA_KEYTYPE_VARBINARY2=18, /* Key is sorted as unsigned chars */
|
2004-12-19 19:25:19 +01:00
|
|
|
HA_KEYTYPE_BIT=19
|
2000-07-31 21:29:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#define HA_MAX_KEYTYPE 31 /* Must be log2-1 */
|
|
|
|
|
|
|
|
/* These flags kan be OR:ed to key-flag */
|
|
|
|
|
|
|
|
#define HA_NOSAME 1 /* Set if not dupplicated records */
|
|
|
|
#define HA_PACK_KEY 2 /* Pack string key to previous key */
|
|
|
|
#define HA_AUTO_KEY 16
|
|
|
|
#define HA_BINARY_PACK_KEY 32 /* Packing of all keys to prev key */
|
2002-05-22 17:51:21 +02:00
|
|
|
#define HA_FULLTEXT 128 /* For full-text search */
|
2000-07-31 21:29:14 +02:00
|
|
|
#define HA_UNIQUE_CHECK 256 /* Check the key for uniqueness */
|
2002-05-22 17:51:21 +02:00
|
|
|
#define HA_SPATIAL 1024 /* For spatial search */
|
2002-01-15 23:42:52 +01:00
|
|
|
#define HA_NULL_ARE_EQUAL 2048 /* NULL in key are cmp as equal */
|
2004-05-11 23:29:52 +02:00
|
|
|
#define HA_GENERATED_KEY 8192 /* Automaticly generated key */
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2006-01-12 10:05:07 +01:00
|
|
|
/* 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)
|
|
|
|
|
2000-07-31 21:29:14 +02:00
|
|
|
/* 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
|
2005-11-05 12:20:35 +01:00
|
|
|
#define HA_USES_PARSER 16384 /* Fulltext index uses [pre]parser */
|
2006-05-03 14:59:17 +02:00
|
|
|
#define HA_USES_BLOCK_SIZE ((uint) 32768)
|
2000-07-31 21:29:14 +02:00
|
|
|
#define HA_SORT_ALLOWS_SAME 512 /* Intern bit when sorting records */
|
2006-10-16 17:09:58 +02:00
|
|
|
#if MYSQL_VERSION_ID < 0x50200
|
2003-12-12 21:26:58 +01:00
|
|
|
/*
|
|
|
|
Key has a part that can have end space. If this is an unique key
|
|
|
|
we have to handle it differently from other unique keys as we can find
|
2004-12-06 01:00:37 +01:00
|
|
|
many matching rows for one key (because end space are not compared)
|
2003-12-12 21:26:58 +01:00
|
|
|
*/
|
2006-10-16 17:09:58 +02:00
|
|
|
#define HA_END_SPACE_KEY 0 /* was: 4096 */
|
|
|
|
#else
|
|
|
|
#error HA_END_SPACE_KEY is obsolete, please remove it
|
|
|
|
#endif
|
|
|
|
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2003-12-12 21:26:58 +01:00
|
|
|
/* These flags can be added to key-seg-flag */
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
#define HA_SPACE_PACK 1 /* Pack space in key-seg */
|
2003-12-12 21:26:58 +01:00
|
|
|
#define HA_PART_KEY_SEG 4 /* Used by MySQL for part-key-cols */
|
2004-12-06 01:00:37 +01:00
|
|
|
#define HA_VAR_LENGTH_PART 8
|
2000-07-31 21:29:14 +02:00
|
|
|
#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 */
|
2001-10-09 14:53:54 +02:00
|
|
|
#define HA_NO_SORT 256 /* do not bother sorting on this keyseg */
|
2004-12-06 01:00:37 +01:00
|
|
|
/*
|
|
|
|
End space in unique/varchar are considered equal. (Like 'a' and 'a ')
|
|
|
|
Only needed for internal temporary tables.
|
|
|
|
*/
|
|
|
|
#define HA_END_SPACE_ARE_EQUAL 512
|
2004-12-19 19:25:19 +01:00
|
|
|
#define HA_BIT_PART 1024
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
/* optionbits for database */
|
|
|
|
#define HA_OPTION_PACK_RECORD 1
|
|
|
|
#define HA_OPTION_PACK_KEYS 2
|
|
|
|
#define HA_OPTION_COMPRESS_RECORD 4
|
|
|
|
#define HA_OPTION_LONG_BLOB_PTR 8 /* new ISAM format */
|
|
|
|
#define HA_OPTION_TMP_TABLE 16
|
|
|
|
#define HA_OPTION_CHECKSUM 32
|
|
|
|
#define HA_OPTION_DELAY_KEY_WRITE 64
|
|
|
|
#define HA_OPTION_NO_PACK_KEYS 128 /* Reserved for MySQL */
|
2005-11-25 11:57:13 +01:00
|
|
|
#define HA_OPTION_CREATE_FROM_ENGINE 256
|
2005-12-28 13:05:30 +01:00
|
|
|
#define HA_OPTION_RELIES_ON_SQL_LAYER 512
|
2000-07-31 21:29:14 +02:00
|
|
|
#define HA_OPTION_TEMP_COMPRESS_RECORD ((uint) 16384) /* set by isamchk */
|
|
|
|
#define HA_OPTION_READ_ONLY_DATA ((uint) 32768) /* Set by isamchk */
|
|
|
|
|
2000-09-25 23:33:25 +02:00
|
|
|
/* Bits in flag to create() */
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
#define HA_DONT_TOUCH_DATA 1 /* Don't empty datafile (isamchk) */
|
|
|
|
#define HA_PACK_RECORD 2 /* Request packed record format */
|
|
|
|
#define HA_CREATE_TMP_TABLE 4
|
|
|
|
#define HA_CREATE_CHECKSUM 8
|
|
|
|
#define HA_CREATE_DELAY_KEY_WRITE 64
|
2005-12-28 13:05:30 +01:00
|
|
|
#define HA_CREATE_RELIES_ON_SQL_LAYER 128
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2005-11-26 08:54:13 +01:00
|
|
|
/*
|
|
|
|
The following flags (OR-ed) are passed to handler::info() method.
|
|
|
|
The method copies misc handler information out of the storage engine
|
|
|
|
to data structures accessible from MySQL
|
|
|
|
|
|
|
|
Same flags are also passed down to mi_status, myrg_status, etc.
|
|
|
|
*/
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2005-11-26 08:54:13 +01:00
|
|
|
/* this one is not used */
|
|
|
|
#define HA_STATUS_POS 1
|
|
|
|
/*
|
|
|
|
assuming the table keeps shared actual copy of the 'info' and
|
|
|
|
local, possibly outdated copy, the following flag means that
|
|
|
|
it should not try to get the actual data (locking the shared structure)
|
|
|
|
slightly outdated version will suffice
|
|
|
|
*/
|
|
|
|
#define HA_STATUS_NO_LOCK 2
|
|
|
|
/* update the time of the last modification (in handler::update_time) */
|
|
|
|
#define HA_STATUS_TIME 4
|
|
|
|
/*
|
|
|
|
update the 'constant' part of the info:
|
|
|
|
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 8
|
|
|
|
/*
|
|
|
|
update the 'variable' part of the info:
|
|
|
|
handler::records, deleted, data_file_length, index_file_length,
|
|
|
|
delete_length, check_time, mean_rec_length
|
|
|
|
*/
|
|
|
|
#define HA_STATUS_VARIABLE 16
|
|
|
|
/*
|
|
|
|
get the information about the key that caused last duplicate value error
|
|
|
|
update handler::errkey and handler::dupp_ref
|
|
|
|
see handler::get_dup_key()
|
|
|
|
*/
|
|
|
|
#define HA_STATUS_ERRKEY 32
|
|
|
|
/*
|
|
|
|
update handler::auto_increment_value
|
|
|
|
*/
|
|
|
|
#define HA_STATUS_AUTO 64
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
/* Errorcodes given by functions */
|
|
|
|
|
2003-05-07 18:13:56 +02:00
|
|
|
/* opt_sum_query() assumes these codes are > 1 */
|
2004-12-23 20:11:38 +01:00
|
|
|
/* 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.*/
|
2000-07-31 21:29:14 +02:00
|
|
|
#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_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 */
|
|
|
|
#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */
|
|
|
|
#define HA_ERR_OUT_OF_MEM 128 /* Record-file is crashed */
|
2003-01-28 17:42:08 +01:00
|
|
|
#define HA_ERR_NOT_A_TABLE 130 /* not a MYI file - no signature */
|
2000-07-31 21:29:14 +02:00
|
|
|
#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() */
|
2006-05-09 21:14:29 +02:00
|
|
|
#define HA_ERR_RECORD_DELETED 134 /* A record is not there */
|
2000-07-31 21:29:14 +02:00
|
|
|
#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 /* Dupplicate unique on write */
|
|
|
|
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
|
2003-01-28 17:42:08 +01:00
|
|
|
#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting MyISAM tables in MERGE */
|
2000-09-25 23:33:25 +02:00
|
|
|
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
|
2000-11-21 02:43:34 +01:00
|
|
|
#define HA_ERR_CRASHED_ON_USAGE 145 /* Table must be repaired */
|
2002-10-25 16:09:47 +02:00
|
|
|
#define HA_ERR_LOCK_WAIT_TIMEOUT 146
|
2001-03-21 21:34:16 +01:00
|
|
|
#define HA_ERR_LOCK_TABLE_FULL 147
|
2001-05-29 15:29:08 +02:00
|
|
|
#define HA_ERR_READ_ONLY_TRANSACTION 148 /* Updates not allowed */
|
2001-09-17 22:43:53 +02:00
|
|
|
#define HA_ERR_LOCK_DEADLOCK 149
|
2001-10-30 16:38:44 +01:00
|
|
|
#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 */
|
2003-06-15 00:04:28 +02:00
|
|
|
#define HA_ERR_NO_SAVEPOINT 153 /* No savepoint with that name */
|
2003-08-11 21:44:43 +02:00
|
|
|
#define HA_ERR_NON_UNIQUE_BLOCK_SIZE 154 /* Non unique key block size */
|
2004-09-13 14:46:38 +02:00
|
|
|
#define HA_ERR_NO_SUCH_TABLE 155 /* The table does not exist in engine */
|
2004-04-15 09:14:14 +02:00
|
|
|
#define HA_ERR_TABLE_EXIST 156 /* The table existed in storage engine */
|
|
|
|
#define HA_ERR_NO_CONNECTION 157 /* Could not connect to storage engine */
|
2004-12-10 13:06:49 +01:00
|
|
|
#define HA_ERR_NULL_IN_SPATIAL 158 /* NULLs are not supported in spatial index */
|
2005-04-07 20:17:37 +02:00
|
|
|
#define HA_ERR_TABLE_DEF_CHANGED 159 /* The table changed in storage engine */
|
2005-12-22 06:39:02 +01:00
|
|
|
#define HA_ERR_NO_PARTITION_FOUND 160 /* There's no partition in table for
|
|
|
|
given value */
|
|
|
|
#define HA_ERR_RBR_LOGGING_FAILED 161 /* Row-based binlogging of row failed */
|
2006-01-12 10:05:07 +01:00
|
|
|
#define HA_ERR_DROP_INDEX_FK 162 /* Index needed in foreign key constr. */
|
2006-02-09 18:43:10 +01:00
|
|
|
#define HA_ERR_FOREIGN_DUPLICATE_KEY 163 /* Upholding foreign key constraints
|
|
|
|
would lead to a duplicate key
|
|
|
|
error in some other table. */
|
2006-02-17 08:26:03 +01:00
|
|
|
#define HA_ERR_TABLE_NEEDS_UPGRADE 164 /* The table changed in storage engine */
|
2006-08-08 18:01:32 +02:00
|
|
|
#define HA_ERR_TABLE_READONLY 165 /* The table is not writable */
|
2005-12-22 06:39:02 +01:00
|
|
|
|
2007-01-29 10:40:26 +01:00
|
|
|
#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 */
|
|
|
|
#define HA_ERR_LAST 168 /*Copy last error nr.*/
|
2004-12-23 20:11:38 +01:00
|
|
|
/* Add error numbers before HA_ERR_LAST and change it accordingly. */
|
|
|
|
#define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1)
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
/* Other constants */
|
|
|
|
|
|
|
|
#define HA_NAMELEN 64 /* Max length of saved filename */
|
2007-03-17 00:13:25 +01:00
|
|
|
#define NO_SUCH_KEY (~(uint)0) /* used as a key no. */
|
|
|
|
|
|
|
|
typedef ulong key_part_map;
|
|
|
|
#define HA_WHOLE_KEY (~(key_part_map)0)
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
/* Intern constants in databases */
|
|
|
|
|
|
|
|
/* bits in _search */
|
|
|
|
#define SEARCH_FIND 1
|
|
|
|
#define SEARCH_NO_FIND 2
|
|
|
|
#define SEARCH_SAME 4
|
|
|
|
#define SEARCH_BIGGER 8
|
|
|
|
#define SEARCH_SMALLER 16
|
|
|
|
#define SEARCH_SAVE_BUFF 32
|
|
|
|
#define SEARCH_UPDATE 64
|
|
|
|
#define SEARCH_PREFIX 128
|
|
|
|
#define SEARCH_LAST 256
|
2002-01-05 21:51:42 +01:00
|
|
|
#define MBR_CONTAIN 512
|
|
|
|
#define MBR_INTERSECT 1024
|
|
|
|
#define MBR_WITHIN 2048
|
|
|
|
#define MBR_DISJOINT 4096
|
|
|
|
#define MBR_EQUAL 8192
|
|
|
|
#define MBR_DATA 16384
|
2002-01-15 23:42:52 +01:00
|
|
|
#define SEARCH_NULL_ARE_EQUAL 32768 /* NULL in keys are equal */
|
2003-01-09 01:19:14 +01:00
|
|
|
#define SEARCH_NULL_ARE_NOT_EQUAL 65536 /* NULL in keys are not equal */
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
/* bits in opt_flag */
|
|
|
|
#define QUICK_USED 1
|
|
|
|
#define READ_CACHE_USED 2
|
|
|
|
#define READ_CHECK_USED 4
|
|
|
|
#define KEY_READ_USED 8
|
|
|
|
#define WRITE_CACHE_USED 16
|
2002-10-25 16:09:47 +02:00
|
|
|
#define OPT_NO_ROWS 32
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
/* bits in update */
|
|
|
|
#define HA_STATE_CHANGED 1 /* Database has changed */
|
|
|
|
#define HA_STATE_AKTIV 2 /* Has a current record */
|
|
|
|
#define HA_STATE_WRITTEN 4 /* Record is written */
|
|
|
|
#define HA_STATE_DELETED 8
|
|
|
|
#define HA_STATE_NEXT_FOUND 16 /* Next found record (record before) */
|
|
|
|
#define HA_STATE_PREV_FOUND 32 /* Prev found record (record after) */
|
|
|
|
#define HA_STATE_NO_KEY 64 /* Last read didn't find record */
|
|
|
|
#define HA_STATE_KEY_CHANGED 128
|
|
|
|
#define HA_STATE_WRITE_AT_END 256 /* set in _ps_find_writepos */
|
|
|
|
#define HA_STATE_BUFF_SAVED 512 /* If current keybuff is info->buff */
|
|
|
|
#define HA_STATE_ROW_CHANGED 1024 /* To invalide ROW cache */
|
|
|
|
#define HA_STATE_EXTEND_BLOCK 2048
|
2006-03-10 15:03:04 +01:00
|
|
|
#define HA_STATE_RNEXT_SAME 4096 /* rnext_same occupied lastkey2 */
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2005-06-24 19:34:55 +02:00
|
|
|
/* myisampack expects no more than 32 field types. */
|
2000-07-31 21:29:14 +02:00
|
|
|
enum en_fieldtype {
|
2001-11-06 23:13:29 +01:00
|
|
|
FIELD_LAST=-1,FIELD_NORMAL,FIELD_SKIP_ENDSPACE,FIELD_SKIP_PRESPACE,
|
|
|
|
FIELD_SKIP_ZERO,FIELD_BLOB,FIELD_CONSTANT,FIELD_INTERVALL,FIELD_ZERO,
|
2006-01-03 17:54:54 +01:00
|
|
|
FIELD_VARCHAR,FIELD_CHECK,
|
|
|
|
FIELD_enum_val_count
|
2000-07-31 21:29:14 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
enum data_file_type {
|
|
|
|
STATIC_RECORD,DYNAMIC_RECORD,COMPRESSED_RECORD
|
|
|
|
};
|
|
|
|
|
2004-05-16 13:48:32 +02:00
|
|
|
/* For key ranges */
|
|
|
|
|
2004-12-23 21:45:10 +01:00
|
|
|
#define NO_MIN_RANGE 1
|
|
|
|
#define NO_MAX_RANGE 2
|
|
|
|
#define NEAR_MIN 4
|
|
|
|
#define NEAR_MAX 8
|
|
|
|
#define UNIQUE_RANGE 16
|
|
|
|
#define EQ_RANGE 32
|
|
|
|
#define NULL_RANGE 64
|
|
|
|
#define GEOM_FLAG 128
|
2005-07-18 13:31:02 +02:00
|
|
|
#define SKIP_RANGE 256
|
2004-12-23 21:45:10 +01:00
|
|
|
|
2004-05-16 13:48:32 +02:00
|
|
|
typedef struct st_key_range
|
|
|
|
{
|
|
|
|
const byte *key;
|
|
|
|
uint length;
|
2007-03-17 00:13:25 +01:00
|
|
|
key_part_map keypart_map;
|
2004-05-16 13:48:32 +02:00
|
|
|
enum ha_rkey_function flag;
|
|
|
|
} key_range;
|
|
|
|
|
2004-12-23 21:45:10 +01:00
|
|
|
typedef struct st_key_multi_range
|
|
|
|
{
|
|
|
|
key_range start_key;
|
|
|
|
key_range end_key;
|
|
|
|
char *ptr; /* Free to use by caller (ptr to row etc) */
|
|
|
|
uint range_flag; /* key range flags see above */
|
|
|
|
} KEY_MULTI_RANGE;
|
|
|
|
|
2004-05-16 13:48:32 +02:00
|
|
|
|
2000-07-31 21:29:14 +02:00
|
|
|
/* For number of records */
|
|
|
|
#ifdef BIG_TABLES
|
2002-11-14 11:21:36 +01:00
|
|
|
#define rows2double(A) ulonglong2double(A)
|
2000-07-31 21:29:14 +02:00
|
|
|
typedef my_off_t ha_rows;
|
|
|
|
#else
|
2002-11-14 11:21:36 +01:00
|
|
|
#define rows2double(A) (double) (A)
|
2002-10-25 16:09:47 +02:00
|
|
|
typedef ulong ha_rows;
|
2000-07-31 21:29:14 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define HA_POS_ERROR (~ (ha_rows) 0)
|
|
|
|
#define HA_OFFSET_ERROR (~ (my_off_t) 0)
|
2000-08-15 19:09:37 +02:00
|
|
|
|
|
|
|
#if SYSTEM_SIZEOF_OFF_T == 4
|
|
|
|
#define MAX_FILE_SIZE INT_MAX32
|
|
|
|
#else
|
|
|
|
#define MAX_FILE_SIZE LONGLONG_MAX
|
|
|
|
#endif
|
|
|
|
|
2004-12-18 04:19:21 +01:00
|
|
|
#define HA_VARCHAR_PACKLENGTH(field_length) ((field_length) < 256 ? 1 :2)
|
|
|
|
|
2000-07-31 21:29:14 +02:00
|
|
|
#endif /* _my_base_h */
|