1
/* Copyright (C) 2000-2006 MySQL AB
2
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
3
4
This program is free software; you can redistribute it and/or modify
4
5
it under the terms of the GNU General Public License as published by
12
13
You should have received a copy of the GNU General Public License
13
14
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
15
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16
18
/* Describe, check and repair of MyISAM tables */
85
87
uint buffer_length);
86
88
static ha_checksum mi_byte_checksum(const uchar *buf, uint length);
87
89
static void set_data_file_type(SORT_INFO *sort_info, MYISAM_SHARE *share);
90
static HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a);
89
92
void myisamchk_init(MI_CHECK *param)
3908
3913
SORT_FT_BUF *ft_buf=sort_info->ft_buf;
3909
3914
SORT_KEY_BLOCKS *key_block=sort_info->key_block;
3911
val_len=HA_FT_WLEN+sort_info->info->s->base.rec_reflength;
3916
val_len= HA_FT_WLEN + sort_info->info->s->rec_reflength;
3912
3917
get_key_full_length_rdonly(a_len, (uchar *)a);
3918
3923
and row format is NOT static - for _mi_dpointer not to garble offsets
3920
3925
if ((sort_info->info->s->base.key_reflength <=
3921
sort_info->info->s->base.rec_reflength) &&
3926
sort_info->info->s->rec_reflength) &&
3922
3927
(sort_info->info->s->options &
3923
3928
(HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)))
3924
3929
ft_buf=(SORT_FT_BUF *)my_malloc(sort_param->keyinfo->block_length +
4737
4742
share->delete_record=tmp.delete_record;
4747
Find the first NULL value in index-suffix values tuple
4751
keyseg Array of keyparts for key suffix
4752
a Key suffix value tuple
4755
Find the first NULL value in index-suffix values tuple.
4756
TODO Consider optimizing this fuction or its use so we don't search for
4757
NULL values in completely NOT NULL index suffixes.
4760
First key part that has NULL as value in values tuple, or the last key part
4761
(with keyseg->type==HA_TYPE_END) if values tuple doesn't contain NULLs.
4764
static HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, uchar *a)
4766
for (; (enum ha_base_keytype) keyseg->type != HA_KEYTYPE_END; keyseg++)
4769
if (keyseg->null_bit)
4774
end= a+ keyseg->length;
4776
switch ((enum ha_base_keytype) keyseg->type) {
4777
case HA_KEYTYPE_TEXT:
4778
case HA_KEYTYPE_BINARY:
4779
case HA_KEYTYPE_BIT:
4780
if (keyseg->flag & HA_SPACE_PACK)
4783
get_key_length(a_length, a);
4790
case HA_KEYTYPE_VARTEXT1:
4791
case HA_KEYTYPE_VARTEXT2:
4792
case HA_KEYTYPE_VARBINARY1:
4793
case HA_KEYTYPE_VARBINARY2:
4796
get_key_length(a_length, a);
4800
case HA_KEYTYPE_NUM:
4801
if (keyseg->flag & HA_SPACE_PACK)
4808
case HA_KEYTYPE_INT8:
4809
case HA_KEYTYPE_SHORT_INT:
4810
case HA_KEYTYPE_USHORT_INT:
4811
case HA_KEYTYPE_LONG_INT:
4812
case HA_KEYTYPE_ULONG_INT:
4813
case HA_KEYTYPE_INT24:
4814
case HA_KEYTYPE_UINT24:
4815
#ifdef HAVE_LONG_LONG
4816
case HA_KEYTYPE_LONGLONG:
4817
case HA_KEYTYPE_ULONGLONG:
4819
case HA_KEYTYPE_FLOAT:
4820
case HA_KEYTYPE_DOUBLE:
4823
case HA_KEYTYPE_END: /* purecov: inspected */
4824
/* keep compiler happy */