2011-10-19 21:45:18 +02:00
|
|
|
/* Copyright (c) 2011, Oracle and/or its affiliates.
|
2021-04-21 08:01:01 +02:00
|
|
|
Copyright (c) 1991, 2021, MariaDB Corporation.
|
2003-01-21 19:24:34 +01:00
|
|
|
|
2011-03-29 14:43:49 +02:00
|
|
|
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
|
|
|
|
the Free Software Foundation; version 2 of the License.
|
2003-01-21 19:24:34 +01:00
|
|
|
|
2010-12-28 19:57:23 +01:00
|
|
|
This program is distributed in the hope that it will be useful,
|
2002-04-25 10:36:55 +02:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-03-29 14:43:49 +02:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2003-01-21 19:24:34 +01:00
|
|
|
|
2011-03-29 14:43:49 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2019-05-11 20:29:06 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
|
2002-04-25 10:36:55 +02:00
|
|
|
|
2011-03-29 14:43:49 +02:00
|
|
|
#ifndef _my_compare_h
|
|
|
|
#define _my_compare_h
|
2002-04-25 10:36:55 +02:00
|
|
|
|
|
|
|
#include "myisampack.h"
|
2008-03-28 17:45:03 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2002-04-25 10:36:55 +02:00
|
|
|
|
2010-03-31 16:05:33 +02:00
|
|
|
#include "m_ctype.h" /* CHARSET_INFO */
|
|
|
|
|
2007-10-11 17:07:40 +02:00
|
|
|
/*
|
|
|
|
There is a hard limit for the maximum number of keys as there are only
|
|
|
|
8 bits in the index file header for the number of keys in a table.
|
|
|
|
This means that 0..255 keys can exist for a table. The idea of
|
|
|
|
HA_MAX_POSSIBLE_KEY is to ensure that one can use myisamchk & tools on
|
|
|
|
a MyISAM table for which one has more keys than MyISAM is normally
|
|
|
|
compiled for. If you don't have this, you will get a core dump when
|
|
|
|
running myisamchk compiled for 128 keys on a table with 255 keys.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define HA_MAX_POSSIBLE_KEY 255 /* For myisamchk */
|
|
|
|
/*
|
|
|
|
The following defines can be increased if necessary.
|
|
|
|
But beware the dependency of MI_MAX_POSSIBLE_KEY_BUFF and HA_MAX_KEY_LENGTH.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define HA_MAX_KEY_LENGTH 1000 /* Max length in bytes */
|
2011-07-02 22:12:12 +02:00
|
|
|
#define HA_MAX_KEY_SEG 32 /* Max segments for key */
|
2007-10-11 17:07:40 +02:00
|
|
|
|
|
|
|
#define HA_MAX_POSSIBLE_KEY_BUFF (HA_MAX_KEY_LENGTH + 24+ 6+6)
|
|
|
|
#define HA_MAX_KEY_BUFF (HA_MAX_KEY_LENGTH+HA_MAX_KEY_SEG*6+8+8)
|
|
|
|
|
2002-04-25 12:10:29 +02:00
|
|
|
typedef struct st_HA_KEYSEG /* Key-portion */
|
2002-04-25 10:36:55 +02:00
|
|
|
{
|
2004-12-30 23:44:00 +01:00
|
|
|
CHARSET_INFO *charset;
|
|
|
|
uint32 start; /* Start of key in record */
|
|
|
|
uint32 null_pos; /* position to NULL indicator */
|
|
|
|
uint16 bit_pos; /* Position to bit part */
|
|
|
|
uint16 flag;
|
|
|
|
uint16 length; /* Keylength */
|
2009-10-15 12:17:32 +02:00
|
|
|
uint16 language;
|
2002-04-25 10:36:55 +02:00
|
|
|
uint8 type; /* Type of key (for sort) */
|
|
|
|
uint8 null_bit; /* bitmask to test for NULL */
|
2016-12-02 13:02:30 +01:00
|
|
|
uint8 bit_start;
|
2004-12-30 23:44:00 +01:00
|
|
|
uint8 bit_length; /* Length of bit part */
|
2002-04-25 12:10:29 +02:00
|
|
|
} HA_KEYSEG;
|
2002-04-25 10:36:55 +02:00
|
|
|
|
|
|
|
#define get_key_length(length,key) \
|
2011-05-02 19:58:45 +02:00
|
|
|
{ if (*(const uchar*) (key) != 255) \
|
|
|
|
length= (uint) *(const uchar*) ((key)++); \
|
2002-04-25 10:36:55 +02:00
|
|
|
else \
|
2007-10-11 17:07:40 +02:00
|
|
|
{ length= mi_uint2korr((key)+1); (key)+=3; } \
|
2002-04-25 10:36:55 +02:00
|
|
|
}
|
|
|
|
|
2003-01-21 19:24:34 +01:00
|
|
|
#define get_key_length_rdonly(length,key) \
|
2011-05-02 19:58:45 +02:00
|
|
|
{ if (*(const uchar*) (key) != 255) \
|
|
|
|
length= ((uint) *(const uchar*) ((key))); \
|
2003-01-21 19:24:34 +01:00
|
|
|
else \
|
2007-10-11 17:07:40 +02:00
|
|
|
{ length= mi_uint2korr((key)+1); } \
|
2003-01-21 19:24:34 +01:00
|
|
|
}
|
|
|
|
|
2002-04-25 10:36:55 +02:00
|
|
|
#define get_key_pack_length(length,length_pack,key) \
|
2011-05-02 19:58:45 +02:00
|
|
|
{ if (*(const uchar*) (key) != 255) \
|
|
|
|
{ length= (uint) *(const uchar*) ((key)++); length_pack= 1; }\
|
2002-04-25 10:36:55 +02:00
|
|
|
else \
|
2007-10-11 17:07:40 +02:00
|
|
|
{ length=mi_uint2korr((key)+1); (key)+= 3; length_pack= 3; } \
|
2002-04-25 10:36:55 +02:00
|
|
|
}
|
|
|
|
|
2004-12-06 01:00:37 +01:00
|
|
|
#define store_key_length_inc(key,length) \
|
|
|
|
{ if ((length) < 255) \
|
2018-02-06 13:55:58 +01:00
|
|
|
{ *(key)++= (uchar)(length); } \
|
2004-12-06 01:00:37 +01:00
|
|
|
else \
|
|
|
|
{ *(key)=255; mi_int2store((key)+1,(length)); (key)+=3; } \
|
|
|
|
}
|
|
|
|
|
2007-10-11 17:07:40 +02:00
|
|
|
#define size_to_store_key_length(length) ((length) < 255 ? 1 : 3)
|
|
|
|
|
2018-02-05 20:09:24 +01:00
|
|
|
static inline uchar get_rec_bits(const uchar *ptr, uchar ofs, uint len)
|
2018-01-16 23:00:21 +01:00
|
|
|
{
|
|
|
|
uint16 val= ptr[0];
|
|
|
|
if (ofs + len > 8)
|
Fix all warnings given by UBSAN
The easiest way to compile and test the server with UBSAN is to run:
./BUILD/compile-pentium64-ubsan
and then run mysql-test-run.
After this commit, one should be able to run this without any UBSAN
warnings. There is still a few compiler warnings that should be fixed
at some point, but these do not expose any real bugs.
The 'special' cases where we disable, suppress or circumvent UBSAN are:
- ref10 source (as here we intentionally do some shifts that UBSAN
complains about.
- x86 version of optimized int#korr() methods. UBSAN do not like unaligned
memory access of integers. Fixed by using byte_order_generic.h when
compiling with UBSAN
- We use smaller thread stack with ASAN and UBSAN, which forced me to
disable a few tests that prints the thread stack size.
- Verifying class types does not work for shared libraries. I added
suppression in mysql-test-run.pl for this case.
- Added '#ifdef WITH_UBSAN' when using integer arithmetic where it is
safe to have overflows (two cases, in item_func.cc).
Things fixed:
- Don't left shift signed values
(byte_order_generic.h, mysqltest.c, item_sum.cc and many more)
- Don't assign not non existing values to enum variables.
- Ensure that bool and enum values are properly initialized in
constructors. This was needed as UBSAN checks that these types has
correct values when one copies an object.
(gcalc_tools.h, ha_partition.cc, item_sum.cc, partition_element.h ...)
- Ensure we do not called handler functions on unallocated objects or
deleted objects.
(events.cc, sql_acl.cc).
- Fixed bugs in Item_sp::Item_sp() where we did not call constructor
on Query_arena object.
- Fixed several cast of objects to an incompatible class!
(Item.cc, Item_buff.cc, item_timefunc.cc, opt_subselect.cc, sql_acl.cc,
sql_select.cc ...)
- Ensure we do not do integer arithmetic that causes over or underflows.
This includes also ++ and -- of integers.
(Item_func.cc, Item_strfunc.cc, item_timefunc.cc, sql_base.cc ...)
- Added JSON_VALUE_UNITIALIZED to json_value_types and ensure that
value_type is initialized to this instead of to -1, which is not a valid
enum value for json_value_types.
- Ensure we do not call memcpy() when second argument could be null.
- Fixed that Item_func_str::make_empty_result() creates an empty string
instead of a null string (safer as it ensures we do not do arithmetic
on null strings).
Other things:
- Changed struct st_position to an OBJECT and added an initialization
function to it to ensure that we do not copy or use uninitialized
members. The change to a class was also motived that we used "struct
st_position" and POSITION randomly trough the code which was
confusing.
- Notably big rewrite in sql_acl.cc to avoid using deleted objects.
- Changed in sql_partition to use '^' instead of '-'. This is safe as
the operator is either 0 or 0x8000000000000000ULL.
- Added check for select_nr < INT_MAX in JOIN::build_explain() to
avoid bug when get_select() could return NULL.
- Reordered elements in POSITION for better alignment.
- Changed sql_test.cc::print_plan() to use pointers instead of objects.
- Fixed bug in find_set() where could could execute '1 << -1'.
- Added variable have_sanitizer, used by mtr. (This variable was before
only in 10.5 and up). It can now have one of two values:
ASAN or UBSAN.
- Moved ~Archive_share() from ha_archive.cc to ha_archive.h and marked
it virtual. This was an effort to get UBSAN to work with loaded storage
engines. I kept the change as the new place is better.
- Added in CONNECT engine COLBLK::SetName(), to get around a wrong cast
in tabutil.cpp.
- Added HAVE_REPLICATION around usage of rgi_slave, to get embedded
server to compile with UBSAN. (Patch from Marko).
- Added #ifdef for powerpc64 to avoid a bug in old gcc versions related
to integer arithmetic.
Changes that should not be needed but had to be done to suppress warnings
from UBSAN:
- Added static_cast<<uint16_t>> around shift to get rid of a LOT of
compiler warnings when using UBSAN.
- Had to change some '/' of 2 base integers to shift to get rid of
some compile time warnings.
Reviewed by:
- Json changes: Alexey Botchkov
- Charset changes in ctype-uca.c: Alexander Barkov
- InnoDB changes & Embedded server: Marko Mäkelä
- sql_acl.cc changes: Vicențiu Ciorbaru
- build_explain() changes: Sergey Petrunia
2021-04-18 14:29:13 +02:00
|
|
|
val|= (uint16)(((uint) ptr[1]) << 8);
|
2020-03-12 18:44:52 +01:00
|
|
|
return (uchar) ((val >> ofs) & ((1 << len) - 1));
|
2018-01-16 23:00:21 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void set_rec_bits(uint16 bits, uchar *ptr, uchar ofs, uint len)
|
|
|
|
{
|
2020-03-12 18:44:52 +01:00
|
|
|
ptr[0]= (uchar) ((ptr[0] & ~(((1 << len) - 1) << ofs)) | (bits << ofs));
|
2018-01-16 23:00:21 +01:00
|
|
|
if (ofs + len > 8)
|
2020-03-12 18:44:52 +01:00
|
|
|
ptr[1]= (uchar) ((ptr[1] & ~((1 << (len - 8 + ofs)) - 1)) |
|
|
|
|
bits >> (8 - ofs));
|
2004-12-17 15:06:05 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#define clr_rec_bits(bit_ptr, bit_ofs, bit_len) \
|
|
|
|
set_rec_bits(0, bit_ptr, bit_ofs, bit_len)
|
|
|
|
|
2023-04-07 10:15:41 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
Compare two VARCHAR values.
|
|
|
|
@param charset_info - The character set and collation
|
|
|
|
@param a - The pointer to the first string
|
|
|
|
@param a_length - The length of the first string
|
|
|
|
@param b - The pointer to the second string
|
|
|
|
@param b_length - The length of the second string
|
|
|
|
@param b_is_prefix - Whether "b" is a prefix of "a",
|
|
|
|
e.g. in a prefix key (partial length key).
|
|
|
|
@returns - The result of comparison
|
|
|
|
|
|
|
|
- If "b_is_prefix" is FALSE, then the two strings are compared
|
|
|
|
taking into account the PAD SPACE/NO PAD attribute of the collation.
|
|
|
|
|
|
|
|
- If "b_is_prefix" is TRUE, then trailing spaces are compared in NO PAD style.
|
|
|
|
This is done e.g. when we compare a column value to its prefix key value
|
|
|
|
(the value of "a" to the value of "key_a"):
|
|
|
|
CREATE TABLE t1 (a VARCHAR(10), KEY(key_a(5));
|
|
|
|
*/
|
|
|
|
static inline int ha_compare_char_varying(CHARSET_INFO *charset_info,
|
|
|
|
const uchar *a, size_t a_length,
|
|
|
|
const uchar *b, size_t b_length,
|
|
|
|
my_bool b_is_prefix)
|
|
|
|
{
|
|
|
|
if (!b_is_prefix)
|
|
|
|
return charset_info->coll->strnncollsp(charset_info, a, a_length,
|
|
|
|
b, b_length);
|
|
|
|
return charset_info->coll->strnncoll(charset_info,
|
|
|
|
a, a_length,
|
|
|
|
b, b_length, TRUE/*prefix*/);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Compare two CHAR values of the same declared character length,
|
|
|
|
e.g. CHAR(5) to CHAR(5).
|
|
|
|
|
|
|
|
@param charset_info - The character set and collation
|
|
|
|
@param a - The pointer to the first string
|
|
|
|
@param a_length - The length of the first string
|
|
|
|
@param b - The pointer to the second string
|
|
|
|
@param b_length - The length of the second string
|
|
|
|
@param nchars - The declared length (in characters)
|
|
|
|
@param b_is_prefix - Whether "b" is a prefix of "a",
|
|
|
|
e.g. in a prefix key (partial length key).
|
|
|
|
@returns - The result of comparison
|
|
|
|
|
|
|
|
- If "b_is_prefix" is FALSE, then the two strings are compared
|
|
|
|
taking into account the PAD SPACE/NO PAD attribute of the collation.
|
|
|
|
Additionally, this function assumes that the underlying storage could
|
|
|
|
optionally apply trailing space compression, so values can come into this
|
|
|
|
comparison function in different states:
|
|
|
|
- all trailing spaces removed
|
|
|
|
- some trailing spaced removed
|
|
|
|
- no trailing spaces removed (exactly "nchars" characters on the two sides)
|
|
|
|
This function virtually reconstructs trailing spaces up to the defined
|
|
|
|
length specified in "nchars".
|
|
|
|
If either of the sides have more than "nchar" characters,
|
|
|
|
then only leftmost "nchar" characters are compared.
|
|
|
|
|
|
|
|
- If "b_is_prefix" is TRUE, then trailing spaces are compared in NO PAD style.
|
|
|
|
This is done e.g. when we compare a column value to its prefix key value
|
|
|
|
(the value of "a" to the value of "key_a"):
|
|
|
|
CREATE TABLE t1 (a CHAR(10), KEY(key_a(5));
|
|
|
|
*/
|
|
|
|
static inline int ha_compare_char_fixed(CHARSET_INFO *charset_info,
|
|
|
|
const uchar *a, size_t a_length,
|
|
|
|
const uchar *b, size_t b_length,
|
|
|
|
size_t nchars,
|
|
|
|
my_bool b_is_prefix)
|
|
|
|
{
|
|
|
|
if (!b_is_prefix)
|
|
|
|
return charset_info->coll->strnncollsp_nchars(charset_info,
|
|
|
|
a, a_length,
|
|
|
|
b, b_length,
|
|
|
|
nchars,
|
|
|
|
MY_STRNNCOLLSP_NCHARS_EMULATE_TRIMMED_TRAILING_SPACES);
|
|
|
|
return charset_info->coll->strnncoll(charset_info,
|
|
|
|
a, a_length,
|
|
|
|
b, b_length, TRUE/*prefix*/);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
A function to compare words of a text.
|
|
|
|
This is a common operation in full-text search:
|
|
|
|
SELECT MATCH (title) AGAINST ('word') FROM t1;
|
|
|
|
*/
|
|
|
|
static inline int ha_compare_word(CHARSET_INFO *charset_info,
|
|
|
|
const uchar *a, size_t a_length,
|
|
|
|
const uchar *b, size_t b_length)
|
|
|
|
{
|
|
|
|
return charset_info->coll->strnncollsp(charset_info,
|
|
|
|
a, a_length,
|
|
|
|
b, b_length);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
A function to compare a word of a text to a word prefix.
|
|
|
|
This is a common operation in full-text search:
|
|
|
|
SELECT MATCH (title) AGAINST ('wor*' IN BOOLEAN MODE) FROM t1;
|
|
|
|
*/
|
|
|
|
static inline int ha_compare_word_prefix(CHARSET_INFO *charset_info,
|
|
|
|
const uchar *a, size_t a_length,
|
|
|
|
const uchar *b, size_t b_length)
|
|
|
|
{
|
|
|
|
return charset_info->coll->strnncoll(charset_info,
|
|
|
|
a, a_length,
|
|
|
|
b, b_length,
|
|
|
|
TRUE/*b_is_prefix*/);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
Compare words (full match or prefix match), e.g. for full-text search.
|
|
|
|
*/
|
|
|
|
static inline int ha_compare_word_or_prefix(CHARSET_INFO *charset_info,
|
|
|
|
const uchar *a, size_t a_length,
|
|
|
|
const uchar *b, size_t b_length,
|
|
|
|
my_bool b_is_prefix)
|
|
|
|
{
|
|
|
|
if (!b_is_prefix)
|
|
|
|
return ha_compare_word(charset_info, a, a_length, b, b_length);
|
|
|
|
return ha_compare_word_prefix(charset_info, a, a_length, b, b_length);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-07-02 22:12:12 +02:00
|
|
|
extern int ha_key_cmp(HA_KEYSEG *keyseg, const uchar *a,
|
|
|
|
const uchar *b, uint key_length, uint nextflag,
|
2002-05-21 18:54:08 +02:00
|
|
|
uint *diff_pos);
|
Injecting more "const" declarations into code which does not change
pointed data.
I ran gcc -Wcast-qual on storage/maria, this identified un-needed casts,
a couple of functions which said they had a const parameter though
they changed the pointed content! This is fixed here. Some suspicious
places receive a comment.
The original intention of running -Wcast-qual was to find what code
changes R-tree keys: I added const words, but hidden casts
like those of int2store (casts target to (uint16*)) removed const
checking; -Wcast-qual helped find those hidden casts.
Log handler does not change the content pointed by LEX_STRING::str it
receives, so we now use a struct which has a const inside, to emphasize
this and be able to pass "const uchar*" buffers to log handler
without fear of their content being changed by it.
One-line fix for a merge glitch (when merging from MyISAM).
include/m_string.h:
As Maria's log handler uses LEX_STRING but never changes the content
pointed by LEX_STRING::str, and assigns uchar* into this member most
of the time, we introduce a new struct LEX_CUSTRING
(C const U unsigned) for the log handler.
include/my_global.h:
In macros which read pointed content: use const pointers so that
gcc -Wcast-qual does not warn about casting a const pointer to non-const.
include/my_handler.h:
In macros which read pointed content: use const pointers so that
gcc -Wcast-qual does not warn about casting a const pointer to non-const.
ha_find_null() does not change *a.
include/my_sys.h:
insert_dynamic() does not change *element.
include/myisampack.h:
In macros which read pointed content: use const pointers so that
gcc -Wcast-qual does not warn about casting a const pointer to non-const.
mysys/array.c:
insert_dynamic() does not change *element
mysys/my_handler.c:
ha_find_null() does not change *a
storage/maria/ma_bitmap.c:
Log handler receives const strings now
storage/maria/ma_blockrec.c:
Log handler receives const strings now.
_ma_apply_undo_row_delete/update() do change *header.
storage/maria/ma_blockrec.h:
correct prototype
storage/maria/ma_check.c:
Log handler receives const strings now. Un-needed casts
storage/maria/ma_checkpoint.c:
Log handler receives const strings now
storage/maria/ma_checksum.c:
unneeded cast
storage/maria/ma_commit.c:
Log handler receives const strings now
storage/maria/ma_create.c:
Log handler receives const strings now
storage/maria/ma_dbug.c:
fixing warning of gcc -Wcast-qual
storage/maria/ma_delete.c:
Log handler receives const strings now
storage/maria/ma_delete_all.c:
Log handler receives const strings now
storage/maria/ma_delete_table.c:
Log handler receives const strings now
storage/maria/ma_dynrec.c:
fixing some warnings of gcc -Wcast-qual. Unneeded casts removed.
Comment about function which lies.
storage/maria/ma_ft_parser.c:
fix for warnings of gcc -Wcast-qual, removing unneeded casts
storage/maria/ma_ft_update.c:
less casts, comment
storage/maria/ma_key.c:
less casts, stay const (warnings of gcc -Wcast-qual)
storage/maria/ma_key_recover.c:
Log handler receives const strings now
storage/maria/ma_loghandler.c:
Log handler receives const strings now
storage/maria/ma_loghandler.h:
Log handler receives const strings now
storage/maria/ma_loghandler_lsn.h:
In macros which read pointed content: use const pointers so that
gcc -Wcast-qual does not warn about casting a const pointer to non-const.
storage/maria/ma_page.c:
Log handler receives const strings now; more const
storage/maria/ma_recovery.c:
Log handler receives const strings now
storage/maria/ma_rename.c:
Log handler receives const strings now
storage/maria/ma_rt_index.c:
more const, to emphasize that functions don't change pointed content.
best_key= NULL was forgotten during merge from MyISAM a few days ago,
was causing a Valgrind warning
storage/maria/ma_rt_index.h:
new proto
storage/maria/ma_rt_key.c:
more const
storage/maria/ma_rt_key.h:
new proto
storage/maria/ma_rt_mbr.c:
more const for functions which deserve it
storage/maria/ma_rt_mbr.h:
new prototype
storage/maria/ma_rt_split.c:
make const what is not changed.
storage/maria/ma_search.c:
un-needed casts, more const
storage/maria/ma_sp_key.c:
more const
storage/maria/ma_unique.c:
un-needed casts.
storage/maria/ma_write.c:
Log handler receives const strings now
storage/maria/maria_def.h:
some more const
storage/maria/unittest/ma_test_loghandler-t.c:
Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_first_lsn-t.c:
Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_max_lsn-t.c:
Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_multigroup-t.c:
Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_multithread-t.c:
Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_noflush-t.c:
Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_nologs-t.c:
Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_pagecache-t.c:
Log handler receives const strings now
storage/maria/unittest/ma_test_loghandler_purge-t.c:
Log handler receives const strings now
2008-04-03 15:40:25 +02:00
|
|
|
extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a);
|
2002-04-25 10:36:55 +02:00
|
|
|
|
2007-10-11 17:07:40 +02:00
|
|
|
/*
|
|
|
|
Inside an in-memory data record, memory pointers to pieces of the
|
|
|
|
record (like BLOBs) are stored in their native byte order and in
|
|
|
|
this amount of bytes.
|
|
|
|
*/
|
|
|
|
#define portable_sizeof_char_ptr 8
|
2008-03-28 17:45:03 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2005-10-21 04:29:17 +02:00
|
|
|
|
2011-07-02 22:12:12 +02:00
|
|
|
/**
|
2020-05-06 14:37:19 +02:00
|
|
|
Return values for pushed index condition or rowid filter check functions.
|
|
|
|
|
|
|
|
0=CHECK_NEG - The filter is not satisfied. The engine should discard this
|
|
|
|
index tuple and continue the scan.
|
2022-12-19 23:54:15 +01:00
|
|
|
1=CHECK_POS - The filter is satisfied. Current index tuple should be
|
2020-05-06 14:37:19 +02:00
|
|
|
returned to the SQL layer.
|
|
|
|
2=CHECK_OUT_OF_RANGE - the index tuple is outside of the range that we're
|
|
|
|
scanning. (Example: if we're scanning "t.key BETWEEN 10 AND
|
|
|
|
20" and got a "t.key=21" tuple) Tthe engine should stop
|
|
|
|
scanning and return HA_ERR_END_OF_FILE right away).
|
|
|
|
3=CHECK_ABORTED_BY_USER - the engine must stop scanning and should return
|
|
|
|
HA_ERR_ABORTED_BY_USER right away
|
|
|
|
-1=CHECK_ERROR - Reserved for internal errors in engines. Should not be
|
|
|
|
returned by ICP or rowid filter check functions.
|
2011-07-02 22:12:12 +02:00
|
|
|
*/
|
|
|
|
|
2020-05-06 14:37:19 +02:00
|
|
|
typedef enum check_result {
|
|
|
|
CHECK_ERROR=-1,
|
|
|
|
CHECK_NEG=0,
|
|
|
|
CHECK_POS=1,
|
|
|
|
CHECK_OUT_OF_RANGE=2,
|
|
|
|
CHECK_ABORTED_BY_USER=3
|
|
|
|
} check_result_t;
|
|
|
|
|
|
|
|
typedef check_result_t (*index_cond_func_t)(void *param);
|
|
|
|
typedef check_result_t (*rowid_filter_func_t)(void *param);
|
2011-07-02 22:12:12 +02:00
|
|
|
|
2011-03-29 14:43:49 +02:00
|
|
|
#endif /* _my_compare_h */
|