Commit 20c60d7e authored by unknown's avatar unknown

Merge sgluhov@work.mysql.com:/home/bk/mysql-4.1

into gluh.mysql.r18.ru:/home/gluh/mysql-4.1.uvar
parents 932f065e c4184e59
This diff is collapsed.
......@@ -124,13 +124,9 @@ int main(int argc,char *argv[])
{
keylen=*(info->lastkey);
#if HA_FT_WTYPE == HA_KEYTYPE_FLOAT
subkeys=mi_sint4korr(info->lastkey+keylen+1);
subkeys=ft_sintXkorr(info->lastkey+keylen+1);
if (subkeys >= 0)
weight=*(float*)&subkeys;
#else
#error
#endif
snprintf(buf,MAX_LEN,"%.*s",(int) keylen,info->lastkey+1);
my_casedn_str(default_charset_info,buf);
......
......@@ -1893,6 +1893,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
{
sort_param.read_cache=param->read_cache;
sort_param.keyinfo=share->keyinfo+sort_param.key;
sort_param.seg=sort_param.keyinfo->seg;
if (!(((ulonglong) 1 << sort_param.key) & key_map))
{
/* Remember old statistics for key */
......@@ -1906,7 +1907,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
if ((!(param->testflag & T_SILENT)))
printf ("- Fixing index %d\n",sort_param.key+1);
sort_param.max_pos=sort_param.pos=share->pack.header_length;
keyseg=sort_param.keyinfo->seg;
keyseg=sort_param.seg;
bzero((char*) sort_param.unique,sizeof(sort_param.unique));
sort_param.key_length=share->rec_reflength;
for (i=0 ; keyseg[i].type != HA_KEYTYPE_END; i++)
......@@ -2255,6 +2256,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
{
sort_param[i].key=key;
sort_param[i].keyinfo=share->keyinfo+key;
sort_param[i].seg=sort_param[i].keyinfo->seg;
if (!(((ulonglong) 1 << key) & key_map))
{
/* Remember old statistics for key */
......@@ -2292,7 +2294,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
(share->base.pack_reclength * i));
sort_param[i].key_length=share->rec_reflength;
for (keyseg=sort_param[i].keyinfo->seg; keyseg->type != HA_KEYTYPE_END;
for (keyseg=sort_param[i].seg; keyseg->type != HA_KEYTYPE_END;
keyseg++)
{
sort_param[i].key_length+=keyseg->length;
......@@ -3051,7 +3053,7 @@ static int sort_key_cmp(MI_SORT_PARAM *sort_param, const void *a,
const void *b)
{
uint not_used;
return (ha_key_cmp(sort_param->keyinfo->seg, *((uchar**) a), *((uchar**) b),
return (ha_key_cmp(sort_param->seg, *((uchar**) a), *((uchar**) b),
USE_WHOLE_KEY, SEARCH_SAME,&not_used));
} /* sort_key_cmp */
......@@ -3066,7 +3068,7 @@ static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a)
if (sort_info->key_block->inited)
{
cmp=ha_key_cmp(sort_param->keyinfo->seg,sort_info->key_block->lastkey,
cmp=ha_key_cmp(sort_param->seg,sort_info->key_block->lastkey,
(uchar*) a, USE_WHOLE_KEY,SEARCH_FIND | SEARCH_UPDATE,
&diff_pos);
sort_param->unique[diff_pos-1]++;
......@@ -3091,7 +3093,7 @@ static int sort_key_write(MI_SORT_PARAM *sort_param, const void *a)
llbuff2));
param->testflag|=T_RETRY_WITHOUT_QUICK;
if (sort_info->param->testflag & T_VERBOSE)
_mi_print_key(stdout,sort_param->keyinfo->seg,(uchar*) a, USE_WHOLE_KEY);
_mi_print_key(stdout,sort_param->seg,(uchar*) a, USE_WHOLE_KEY);
return (sort_delete_record(sort_param));
}
#ifndef DBUG_OFF
......@@ -3182,7 +3184,7 @@ static int sort_ft_key_write(MI_SORT_PARAM *sort_param, const void *a)
get_key_full_length_rdonly(val_off, ft_buf->lastkey);
if (val_off == a_len &&
mi_compare_text(sort_param->keyinfo->seg->charset,
mi_compare_text(sort_param->seg->charset,
((uchar *)a)+1,a_len-1,
ft_buf->lastkey+1,val_off-1, 0)==0)
{
......
......@@ -295,6 +295,7 @@ typedef struct st_mi_sort_param
uint maxbuffers, keys, find_length, sort_keys_length;
my_bool fix_datafile, master;
MI_KEYDEF *keyinfo;
HA_KEYSEG *seg;
SORT_INFO *sort_info;
uchar **sort_keys;
byte *rec_buff;
......
......@@ -785,7 +785,7 @@ int rtree_delete(MI_INFO *info, uint keynr, uchar *key, uint key_length)
goto err1;
}
if (ReinsertList.pages)
free(ReinsertList.pages);
my_free((byte*) ReinsertList.pages, MYF(0));
/* check for redundant root (not leaf, 1 child) and eliminate */
if ((old_root = info->s->state.key_root[keynr]) == HA_OFFSET_ERROR)
......
......@@ -56,7 +56,7 @@ int rtree_add_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *key,
}
return (rtree_split_page(info, keyinfo, page_buf, key, key_length,
new_page) ? -1 : 0);
new_page) ? -1 : 1);
}
/*
......@@ -69,7 +69,7 @@ int rtree_delete_key(MI_INFO *info, uchar *page_buf, uchar *key,
uchar *key_start;
key_start= key - nod_flag;
if (nod_flag)
if (!nod_flag)
key_length += info->s->base.rec_reflength;
memmove(key_start, key + key_length, page_size - key_length -
......
......@@ -263,7 +263,7 @@ int rtree_split_page(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page, uchar *key,
int max_keys = (mi_getint(page)-2) / (full_length);
n_dim = (keyinfo->keysegs-1) / 2;
n_dim = keyinfo->keysegs / 2;
{
int coord_buf_size = n_dim * 2 * sizeof(double) * (max_keys + 1 + 4);
......
......@@ -55,7 +55,7 @@ int run_test(const char *filename)
int key_type=HA_KEYTYPE_DOUBLE;
int key_length=8;
int null_fields=0;
int nrecords=30;
int nrecords=300;
int rec_length=0;
int uniques=0;
int i;
......
......@@ -111,7 +111,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
DBUG_ENTER("_create_index_by_sort");
DBUG_PRINT("enter",("sort_length: %d", info->key_length));
if (info->keyinfo->flag && HA_VAR_LENGTH_KEY)
if (info->keyinfo->flag & HA_VAR_LENGTH_KEY)
{
info->write_keys=write_keys_varlen;
info->read_to_buffer=read_to_buffer_varlen;
......@@ -622,7 +622,7 @@ inline int my_var_write(MI_SORT_PARAM *info,IO_CACHE *to_file,char *bufs)
{
int err;
uint16 len = _mi_keylength(info->keyinfo,bufs);
if ((err= my_b_write(to_file,(byte*)&len,sizeof(len))))
return (err);
if ((err= my_b_write(to_file,(byte*)bufs,(uint) len)))
......@@ -641,7 +641,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, register uchar **sort_k
qsort2((byte*) sort_keys,count,sizeof(byte*),(qsort2_cmp) info->key_cmp,
info);
if (!my_b_inited(tempfile) &&
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
open_cached_file(tempfile, my_tmpdir(info->tmpdir), "ST",
DISK_BUFFER_SIZE, info->sort_info->param->myf_rw))
DBUG_RETURN(1); /* purecov: inspected */
......@@ -650,7 +650,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, register uchar **sort_k
for (end=sort_keys+count ; sort_keys != end ; sort_keys++)
{
if ((err= my_var_write(info,tempfile,*sort_keys)))
DBUG_RETURN(err);
DBUG_RETURN(err);
}
DBUG_RETURN(0);
} /* write_keys_varlen */
......@@ -777,7 +777,7 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
uint16 length_of_key = 0;
uint idx;
uchar *buffp;
if ((count=(uint) min((ha_rows) buffpek->max_keys,buffpek->count)))
{
buffp = buffpek->base;
......@@ -786,11 +786,11 @@ static uint NEAR_F read_to_buffer_varlen(IO_CACHE *fromfile, BUFFPEK *buffpek,
{
if (my_pread(fromfile->file,(byte*)&length_of_key,sizeof(length_of_key),
buffpek->file_pos,MYF_RW))
return((uint) -1);
return((uint) -1);
buffpek->file_pos+=sizeof(length_of_key);
if (my_pread(fromfile->file,(byte*) buffp,length_of_key,
buffpek->file_pos,MYF_RW))
return((uint) -1);
return((uint) -1);
buffpek->file_pos+=length_of_key;
buffp = buffp + sort_length;
}
......
......@@ -4530,7 +4530,6 @@ void Field_geom::get_key_image(char *buff,uint length,CHARSET_INFO *cs,
ulong blob_length=get_length(ptr);
char *blob;
get_ptr(&blob);
memcpy(buff+2,blob,length);
MBR mbr;
Geometry gobj;
......
......@@ -2293,6 +2293,7 @@ convert_search_mode_to_innobase(
case HA_READ_BEFORE_KEY: return(PAGE_CUR_L);
case HA_READ_PREFIX: return(PAGE_CUR_GE);
case HA_READ_PREFIX_LAST: return(PAGE_CUR_LE);
case HA_READ_PREFIX_LAST_OR_PREV:return(PAGE_CUR_LE);
/* In MySQL HA_READ_PREFIX and HA_READ_PREFIX_LAST always
use a complete-field-prefix of a kay value as the search
tuple. I.e., it is not allowed that the last field would
......
......@@ -1260,7 +1260,8 @@ void yyerror(const char *s)
{
THD *thd=current_thd;
char *yytext=(char*) thd->lex.tok_start;
if (!strcmp(s,"parse error"))
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
s=ER(ER_SYNTAX_ERROR);
net_printf(thd,ER_PARSE_ERROR, s, yytext ? (char*) yytext : "",
thd->lex.yylineno);
......
......@@ -2153,7 +2153,7 @@ check_quick_keys(PARAM *param,uint idx,SEL_ARG *key_tree,
if (tmp_min_flag & GEOM_FLAG)
{
tmp= param->table->file->
records_in_range((int) keynr, (byte*)(param->min_key + 1),
records_in_range((int) keynr, (byte*)(param->min_key),
min_key_length,
(ha_rkey_function)(tmp_min_flag ^ GEOM_FLAG),
(byte *)NullS, 0, HA_READ_KEY_EXACT);
......
......@@ -705,14 +705,6 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
{
if (key->type == Key::FULLTEXT)
column->length=1; /* ft-code ignores it anyway :-) */
else if (key->type == Key::SPATIAL)
{
/*
BAR: 4 is: (Xmin,Xmax,Ymin,Ymax), this is for 2D case
Lately we'll extend this code to support more dimensions
*/
column->length=4*sizeof(double);
}
else
{
my_printf_error(ER_BLOB_KEY_WITHOUT_LENGTH,
......@@ -722,6 +714,17 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
}
}
if (key->type == Key::SPATIAL)
{
if (!column->length )
{
/*
BAR: 4 is: (Xmin,Xmax,Ymin,Ymax), this is for 2D case
Lately we'll extend this code to support more dimensions
*/
column->length=4*sizeof(double);
}
}
if (!(sql_field->flags & NOT_NULL_FLAG))
{
if (key->type == Key::PRIMARY)
......@@ -757,6 +760,9 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
DBUG_RETURN(-1);
}
}
else if (f_is_geom(sql_field->pack_flag))
{
}
else if (column->length > length ||
((f_is_packed(sql_field->pack_flag) ||
((file->table_flags() & HA_NO_PREFIX_CHAR_KEYS) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment