Commit c33289a3 authored by unknown's avatar unknown

Fixed indention, removed compiler varnings and fixed a bug

in FULLTEXT indexes.


Docs/manual.texi:
  Removed some @ifset nushere tags which crashed the manual
  when using emacs
client/mysql-test.c:
  ***MISSING WEAVE***
heap/hp_test2.c:
  Removed compiler warnings
isam/pack_isam.c:
  Removed compiler warnings
isam/update.c:
  Removed compiler warnings
myisam/ft_parser.c:
  cleanup
myisam/ft_update.c:
  Fixed crash when inserting a blob which was NULL
myisam/mi_check.c:
  -e continues checking of other keys on error
myisam/mi_rkey.c:
  cleanup
myisam/myisamchk.c:
  cleanup
myisam/myisamlog.c:
  Added use of rnd to make things more predictable
myisammrg/myrg_rkey.c:
  Removed compiler warnings
mysys/mf_pack.c:
  cleanup
mysys/my_fstream.c:
  cleanup
sql/ha_berkeley.cc:
  cleanup
sql/handler.cc:
  cleanup
sql/item_func.cc:
  cleanup
sql/item_func.h:
  cleanup
sql/net_serv.cc:
  cleanup
sql/slave.cc:
  cleanup
sql/sql_class.cc:
  cleanup
sql/sql_show.cc:
  cleanup
parent 3a5ab655
This diff is collapsed.
...@@ -62,6 +62,7 @@ char *argv[]; ...@@ -62,6 +62,7 @@ char *argv[];
HP_KEYSEG keyseg[MAX_KEYS*5]; HP_KEYSEG keyseg[MAX_KEYS*5];
HEAP_PTR position; HEAP_PTR position;
MY_INIT(argv[0]); /* init my_sys library & pthreads */ MY_INIT(argv[0]); /* init my_sys library & pthreads */
LINT_INIT(position);
filename= "test2"; filename= "test2";
filename2= "test2_2"; filename2= "test2_2";
......
...@@ -574,9 +574,9 @@ static int compress(MRG_INFO *mrg,char *result_table) ...@@ -574,9 +574,9 @@ static int compress(MRG_INFO *mrg,char *result_table)
end_file_buffer(); end_file_buffer();
if (verbose && mrg->records) if (verbose && mrg->records)
printf("Min record length: %6d Max length: %6d Mean total length: %6d\n", printf("Min record length: %6d Max length: %6d Mean total length: %6lu\n",
mrg->min_pack_length,mrg->max_pack_length, mrg->min_pack_length,mrg->max_pack_length,
(long) new_length/mrg->records); (ulong) new_length/mrg->records);
if (!test_only) if (!test_only)
{ {
...@@ -763,11 +763,11 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts) ...@@ -763,11 +763,11 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
{ {
global_count=count; global_count=count;
if (!(element=tree_insert(&count->int_tree,pos,0)) || if (!(element=tree_insert(&count->int_tree,pos,0)) ||
element->count == 1 && (element->count == 1 &&
count->tree_buff + tree_buff_length < count->tree_buff + tree_buff_length <
count->tree_pos + count->field_length || count->tree_pos + count->field_length ||
count->field_length == 1 && count->field_length == 1 &&
count->int_tree.elements_in_tree > 1) count->int_tree.elements_in_tree > 1))
{ {
delete_tree(&count->int_tree); delete_tree(&count->int_tree);
my_free(count->tree_buff,MYF(0)); my_free(count->tree_buff,MYF(0));
...@@ -1760,8 +1760,8 @@ static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts) ...@@ -1760,8 +1760,8 @@ static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
if (max_record_length >= max_allowed_length) if (max_record_length >= max_allowed_length)
{ {
fprintf(stderr, fprintf(stderr,
"Error: Found record with packed-length: %d, max is: %d\n", "Error: Found record with packed-length: %d, max is: %lu\n",
max_record_length,max_allowed_length); max_record_length, (ulong) max_allowed_length);
error=1; error=1;
break; break;
} }
......
...@@ -31,6 +31,7 @@ int nisam_update(register N_INFO *info, const byte *oldrec, const byte *newrec) ...@@ -31,6 +31,7 @@ int nisam_update(register N_INFO *info, const byte *oldrec, const byte *newrec)
uchar old_key[N_MAX_KEY_BUFF],*new_key; uchar old_key[N_MAX_KEY_BUFF],*new_key;
DBUG_ENTER("nisam_update"); DBUG_ENTER("nisam_update");
LINT_INIT(save_errno);
if (!(info->update & HA_STATE_AKTIV)) if (!(info->update & HA_STATE_AKTIV))
{ {
my_errno=HA_ERR_KEY_NOT_FOUND; my_errno=HA_ERR_KEY_NOT_FOUND;
...@@ -54,7 +55,7 @@ int nisam_update(register N_INFO *info, const byte *oldrec, const byte *newrec) ...@@ -54,7 +55,7 @@ int nisam_update(register N_INFO *info, const byte *oldrec, const byte *newrec)
info->s->base.max_key_file_length - info->s->base.max_key_file_length -
info->s->blocksize* INDEX_BLOCK_MARGIN *info->s->state.keys) info->s->blocksize* INDEX_BLOCK_MARGIN *info->s->state.keys)
{ {
my_errno=HA_ERR_INDEX_FILE_FULL; save_errno=HA_ERR_INDEX_FILE_FULL;
goto err_end; goto err_end;
} }
...@@ -108,12 +109,9 @@ err: ...@@ -108,12 +109,9 @@ err:
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | HA_STATE_AKTIV | info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | HA_STATE_AKTIV |
key_changed); key_changed);
err_end: err_end:
nisam_log_record(LOG_UPDATE,info,newrec,info->lastpos,my_errno); nisam_log_record(LOG_UPDATE,info,newrec,info->lastpos,save_errno);
VOID(_nisam_writeinfo(info,1)); VOID(_nisam_writeinfo(info,1));
allow_break(); /* Allow SIGHUP & SIGINT */ allow_break(); /* Allow SIGHUP & SIGINT */
if (save_errno == HA_ERR_KEY_NOT_FOUND) my_errno=(save_errno == HA_ERR_KEY_NOT_FOUND) ? HA_ERR_CRASHED : save_errno;
my_errno=HA_ERR_CRASHED;
else
my_errno=save_errno;
DBUG_RETURN(-1); DBUG_RETURN(-1);
} /* nisam_update */ } /* nisam_update */
...@@ -87,7 +87,7 @@ FT_WORD * ft_linearize(MI_INFO *info, uint keynr, byte *keybuf, TREE *wtree) ...@@ -87,7 +87,7 @@ FT_WORD * ft_linearize(MI_INFO *info, uint keynr, byte *keybuf, TREE *wtree)
} }
delete_tree(wtree); delete_tree(wtree);
my_free((char*) wtree,MYF(0)); my_free((char*) wtree,MYF(0));
if (wlist==NULL) if (!wlist)
return NULL; return NULL;
docstat.list->pos=NULL; docstat.list->pos=NULL;
......
...@@ -37,9 +37,8 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf, ...@@ -37,9 +37,8 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf,
byte *pos; byte *pos;
uint i; uint i;
i=info->s->keyinfo[keynr].keysegs-FT_SEGS;
keyseg=info->s->keyinfo[keynr].seg; keyseg=info->s->keyinfo[keynr].seg;
while(i--) for (i=info->s->keyinfo[keynr].keysegs-FT_SEGS ; i-- ; )
{ {
uint len; uint len;
...@@ -61,10 +60,12 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf, ...@@ -61,10 +60,12 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf,
} }
else else
len=keyseg->length; len=keyseg->length;
if (!(parsed=ft_parse(parsed, pos, len)))
parsed=ft_parse(parsed, pos, len); return NULL;
if (parsed==NULL) return NULL;
} }
/* Handle the case where all columns are NULL */
if (!parsed && !(parsed=ft_parse(0, "", 0)))
return NULL;
return ft_linearize(info, keynr, keybuf, parsed); return ft_linearize(info, keynr, keybuf, parsed);
} }
......
...@@ -314,7 +314,7 @@ int chk_size(MI_CHECK *param, register MI_INFO *info) ...@@ -314,7 +314,7 @@ int chk_size(MI_CHECK *param, register MI_INFO *info)
int chk_key(MI_CHECK *param, register MI_INFO *info) int chk_key(MI_CHECK *param, register MI_INFO *info)
{ {
uint key,found_keys=0,full_text_keys=0; uint key,found_keys=0,full_text_keys=0,result=0;
ha_rows keys; ha_rows keys;
ha_checksum old_record_checksum,init_checksum; ha_checksum old_record_checksum,init_checksum;
my_off_t all_keydata,all_totaldata,key_totlength,length; my_off_t all_keydata,all_totaldata,key_totlength,length;
...@@ -361,7 +361,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) ...@@ -361,7 +361,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
{ {
mi_check_print_error(param,"Can't read indexpage from filepos: %s", mi_check_print_error(param,"Can't read indexpage from filepos: %s",
llstr(share->state.key_root[key],buff)); llstr(share->state.key_root[key],buff));
if (!(param->testflag & T_INFO))
DBUG_RETURN(-1); DBUG_RETURN(-1);
result= -1;
continue;
} }
param->key_file_blocks+=keyinfo->block_length; param->key_file_blocks+=keyinfo->block_length;
keys=0; keys=0;
...@@ -377,7 +380,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) ...@@ -377,7 +380,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
{ {
mi_check_print_error(param,"Found %s keys of %s",llstr(keys,buff), mi_check_print_error(param,"Found %s keys of %s",llstr(keys,buff),
llstr(info->state->records,buff2)); llstr(info->state->records,buff2));
if (!(param->testflag & T_INFO))
DBUG_RETURN(-1); DBUG_RETURN(-1);
result= -1;
continue;
} }
if (found_keys - full_text_keys == 1 && if (found_keys - full_text_keys == 1 &&
((share->options & ((share->options &
...@@ -391,7 +397,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info) ...@@ -391,7 +397,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
key+1); key+1);
else else
mi_check_print_error(param,"Key 1 doesn't point at all records"); mi_check_print_error(param,"Key 1 doesn't point at all records");
if (!(param->testflag & T_INFO))
DBUG_RETURN(-1); DBUG_RETURN(-1);
result= -1;
continue;
} }
} }
else else
......
...@@ -193,7 +193,7 @@ static struct option long_options[] = ...@@ -193,7 +193,7 @@ static struct option long_options[] =
static void print_version(void) static void print_version(void)
{ {
printf("%s Ver 1.31 for %s at %s\n",my_progname,SYSTEM_TYPE, printf("%s Ver 1.32 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE); MACHINE_TYPE);
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
struct file_info { struct file_info {
long process; long process;
int filenr,id; int filenr,id;
uint rnd;
my_string name,show_name,record; my_string name,show_name,record;
MI_INFO *isam; MI_INFO *isam;
bool closed,used; bool closed,used;
...@@ -70,13 +71,14 @@ static void printf_log(const char *str,...); ...@@ -70,13 +71,14 @@ static void printf_log(const char *str,...);
static bool cmp_filename(struct file_info *file_info,my_string name); static bool cmp_filename(struct file_info *file_info,my_string name);
static uint verbose=0,update=0,test_info=0,max_files=0,re_open_count=0, static uint verbose=0,update=0,test_info=0,max_files=0,re_open_count=0,
recover=0,prefix_remove=0,opt_processes=0; recover=0,prefix_remove=0,opt_processes=0,opt_myisam_with_debug=0;
static my_string log_filename=0,filepath=0,write_filename=0,record_pos_file=0; static my_string log_filename=0,filepath=0,write_filename=0,record_pos_file=0;
static ulong com_count[10][3],number_of_commands=(ulong) ~0L, static ulong com_count[10][3],number_of_commands=(ulong) ~0L,
isamlog_process; isamlog_process;
static my_off_t isamlog_filepos,start_offset=0,record_pos= HA_OFFSET_ERROR; static my_off_t isamlog_filepos,start_offset=0,record_pos= HA_OFFSET_ERROR;
static const char *command_name[]= static const char *command_name[]=
{"open","write","update","delete","close","extra","lock","re-open","delete-all", NullS}; {"open","write","update","delete","close","extra","lock","re-open",
"delete-all", NullS};
int main(int argc, char **argv) int main(int argc, char **argv)
...@@ -91,11 +93,11 @@ int main(int argc, char **argv) ...@@ -91,11 +93,11 @@ int main(int argc, char **argv)
max_files=(set_maximum_open_files(min(max_files,8))-6)/2; max_files=(set_maximum_open_files(min(max_files,8))-6)/2;
if (update) if (update)
printf("Trying to %s isamfiles according to log '%s'\n", printf("Trying to %s MyISAM files according to log '%s'\n",
(recover ? "recover" : "update"),log_filename); (recover ? "recover" : "update"),log_filename);
error= examine_log(log_filename,argv); error= examine_log(log_filename,argv);
if (update && ! error) if (update && ! error)
puts("isamfile:s updated successfully"); puts("Tables updated successfully");
total_count=total_error=total_recover=0; total_count=total_error=total_recover=0;
for (i=first=0 ; command_name[i] ; i++) for (i=first=0 ; command_name[i] ; i++)
{ {
...@@ -134,7 +136,7 @@ static void get_options(register int *argc, register char ***argv) ...@@ -134,7 +136,7 @@ static void get_options(register int *argc, register char ***argv)
char option; char option;
help=0; help=0;
usage="Usage: %s [-?iruvIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n"; usage="Usage: %s [-?iruvDIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n";
pos=""; pos="";
while (--*argc > 0 && *(pos = *(++*argv)) == '-' ) { while (--*argc > 0 && *(pos = *(++*argv)) == '-' ) {
...@@ -199,6 +201,9 @@ static void get_options(register int *argc, register char ***argv) ...@@ -199,6 +201,9 @@ static void get_options(register int *argc, register char ***argv)
update=1; update=1;
recover++; recover++;
break; break;
case 'D':
opt_myisam_with_debug=1;
break;
case 'P': case 'P':
opt_processes=1; opt_processes=1;
break; break;
...@@ -246,7 +251,7 @@ static void get_options(register int *argc, register char ***argv) ...@@ -246,7 +251,7 @@ static void get_options(register int *argc, register char ***argv)
/* Fall through */ /* Fall through */
case 'I': case 'I':
case '?': case '?':
printf("%s Ver 1.2 for %s at %s\n",my_progname,SYSTEM_TYPE, printf("%s Ver 1.3 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE); MACHINE_TYPE);
puts("By Monty, for your professional use\n"); puts("By Monty, for your professional use\n");
if (version) if (version)
...@@ -261,7 +266,7 @@ static void get_options(register int *argc, register char ***argv) ...@@ -261,7 +266,7 @@ static void get_options(register int *argc, register char ***argv)
puts(" -o \"offset\" -p # \"remove # components from path\""); puts(" -o \"offset\" -p # \"remove # components from path\"");
puts(" -r \"recover\" -R \"file recordposition\""); puts(" -r \"recover\" -R \"file recordposition\"");
puts(" -u \"update\" -v \"verbose\" -w \"write file\""); puts(" -u \"update\" -v \"verbose\" -w \"write file\"");
puts(" -P \"processes\""); puts(" -D \"myisam compileled with DBUG\" -P \"processes\"");
puts("\nOne can give a second and a third '-v' for more verbose."); puts("\nOne can give a second and a third '-v' for more verbose.");
puts("Normaly one does a update (-u)."); puts("Normaly one does a update (-u).");
puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted."); puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted.");
...@@ -371,8 +376,10 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -371,8 +376,10 @@ static int examine_log(my_string file_name, char **table_names)
} }
if (curr_file_info) if (curr_file_info)
printf("\nWarning: %s is opened twice with same process and filenumber\n", {
printf("\nWarning: %s is opened with same process and filenumber\nMaybe you should use the -P option ?\n",
curr_file_info->show_name); curr_file_info->show_name);
}
if (my_b_read(&cache,(byte*) head,2)) if (my_b_read(&cache,(byte*) head,2))
goto err; goto err;
file_info.name=0; file_info.name=0;
...@@ -446,6 +453,10 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -446,6 +453,10 @@ static int examine_log(my_string file_name, char **table_names)
goto end; goto end;
files_open++; files_open++;
file_info.closed=0; file_info.closed=0;
if (opt_myisam_with_debug)
file_info.isam->s->rnd= 0;
else
file_info.isam->s->rnd= isamlog_process;
} }
VOID(tree_insert(&tree,(gptr) &file_info,0)); VOID(tree_insert(&tree,(gptr) &file_info,0));
if (file_info.used) if (file_info.used)
...@@ -482,10 +493,12 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -482,10 +493,12 @@ static int examine_log(my_string file_name, char **table_names)
if (mi_extra(curr_file_info->isam, if (mi_extra(curr_file_info->isam,
(int) extra_command) != (int) result) (int) extra_command) != (int) result)
{ {
fflush(stdout);
VOID(fprintf(stderr, VOID(fprintf(stderr,
"Warning: error %d, expected %d on command %s at %s\n", "Warning: error %d, expected %d on command %s at %s\n",
my_errno,result,command_name[command], my_errno,result,command_name[command],
llstr(isamlog_filepos,llbuff))); llstr(isamlog_filepos,llbuff)));
fflush(stderr);
} }
} }
break; break;
...@@ -628,9 +641,11 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -628,9 +641,11 @@ static int examine_log(my_string file_name, char **table_names)
command_name[command],result); command_name[command],result);
break; break;
default: default:
fflush(stdout);
VOID(fprintf(stderr, VOID(fprintf(stderr,
"Error: found unknown command %d in logfile, aborted\n", "Error: found unknown command %d in logfile, aborted\n",
command)); command));
fflush(stderr);
goto end; goto end;
} }
} }
...@@ -643,12 +658,16 @@ static int examine_log(my_string file_name, char **table_names) ...@@ -643,12 +658,16 @@ static int examine_log(my_string file_name, char **table_names)
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
fflush(stdout);
VOID(fprintf(stderr,"Got error %d when reading from logfile\n",my_errno)); VOID(fprintf(stderr,"Got error %d when reading from logfile\n",my_errno));
fflush(stderr);
goto end; goto end;
com_err: com_err:
fflush(stdout);
VOID(fprintf(stderr,"Got error %d, expected %d on command %s at %s\n", VOID(fprintf(stderr,"Got error %d, expected %d on command %s at %s\n",
my_errno,result,command_name[command], my_errno,result,command_name[command],
llstr(isamlog_filepos,llbuff))); llstr(isamlog_filepos,llbuff)));
fflush(stderr);
end: end:
end_key_cache(); end_key_cache();
delete_tree(&tree); delete_tree(&tree);
...@@ -792,6 +811,7 @@ static int close_some_file(TREE *tree) ...@@ -792,6 +811,7 @@ static int close_some_file(TREE *tree)
(void*) &access_param,left_root_right)); (void*) &access_param,left_root_right));
if (!access_param.found) if (!access_param.found)
return 1; /* No open file that is possibly to close */ return 1; /* No open file that is possibly to close */
access_param.found->rnd=access_param.found->isam->s->rnd;
if (mi_close(access_param.found->isam)) if (mi_close(access_param.found->isam))
return 1; return 1;
access_param.found->closed=1; access_param.found->closed=1;
...@@ -811,6 +831,7 @@ static int reopen_closed_file(TREE *tree, struct file_info *fileinfo) ...@@ -811,6 +831,7 @@ static int reopen_closed_file(TREE *tree, struct file_info *fileinfo)
if (!(fileinfo->isam= mi_open(name,O_RDWR,HA_OPEN_WAIT_IF_LOCKED))) if (!(fileinfo->isam= mi_open(name,O_RDWR,HA_OPEN_WAIT_IF_LOCKED)))
return 1; return 1;
fileinfo->closed=0; fileinfo->closed=0;
fileinfo->isam->s->rnd=fileinfo->rnd;
re_open_count++; re_open_count++;
return 0; return 0;
} }
......
...@@ -45,6 +45,7 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key, ...@@ -45,6 +45,7 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
MI_INFO *mi; MI_INFO *mi;
int err; int err;
byte *buf=((search_flag == HA_READ_KEY_EXACT) ? record: 0); byte *buf=((search_flag == HA_READ_KEY_EXACT) ? record: 0);
LINT_INIT(key_buff);
if (_myrg_init_queue(info,inx,search_flag)) if (_myrg_init_queue(info,inx,search_flag))
return my_errno; return my_errno;
......
...@@ -30,10 +30,9 @@ static my_string NEAR_F expand_tilde(my_string *path); ...@@ -30,10 +30,9 @@ static my_string NEAR_F expand_tilde(my_string *path);
/* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */ /* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */
/* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */ /* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */
/* to may be == from */
void pack_dirname(my_string to, const char *from) void pack_dirname(my_string to, const char *from)
/* to may be == from */
{ {
int cwd_err; int cwd_err;
uint d_length,length,buff_length; uint d_length,length,buff_length;
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "mysys_priv.h" #include "mysys_priv.h"
#include "mysys_err.h" #include "mysys_err.h"
#include <errno.h> #include <errno.h>
#include <stdio.h>
#ifdef HAVE_FSEEKO #ifdef HAVE_FSEEKO
#undef ftell #undef ftell
......
...@@ -388,7 +388,6 @@ int ha_berkeley::close(void) ...@@ -388,7 +388,6 @@ int ha_berkeley::close(void)
bool ha_berkeley::fix_rec_buff_for_blob(ulong length) bool ha_berkeley::fix_rec_buff_for_blob(ulong length)
{ {
uint extra;
if (! rec_buff || length > alloced_rec_buff_length) if (! rec_buff || length > alloced_rec_buff_length)
{ {
byte *newptr; byte *newptr;
...@@ -663,7 +662,7 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed, ...@@ -663,7 +662,7 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
const byte * new_row, DBT *prim_key) const byte * new_row, DBT *prim_key)
{ {
DBT row, old_key; DBT row, old_key;
int error,new_error; int error;
DBUG_ENTER("update_primary_key"); DBUG_ENTER("update_primary_key");
if (primary_key_changed) if (primary_key_changed)
...@@ -705,9 +704,8 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed, ...@@ -705,9 +704,8 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
int ha_berkeley::update_row(const byte * old_row, byte * new_row) int ha_berkeley::update_row(const byte * old_row, byte * new_row)
{ {
DBT row, prim_key, key, old_prim_key; DBT prim_key, key, old_prim_key;
int error; int error;
uint keynr;
DB_TXN *sub_trans; DB_TXN *sub_trans;
bool primary_key_changed; bool primary_key_changed;
DBUG_ENTER("update_row"); DBUG_ENTER("update_row");
...@@ -1242,7 +1240,7 @@ THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to, ...@@ -1242,7 +1240,7 @@ THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to,
static int create_sub_table(const char *table_name, const char *sub_name, static int create_sub_table(const char *table_name, const char *sub_name,
DBTYPE type, int flags) DBTYPE type, int flags)
{ {
int error,error2; int error;
DB *file; DB *file;
DBUG_ENTER("create_sub_table"); DBUG_ENTER("create_sub_table");
DBUG_PRINT("enter",("sub_name: %s",sub_name)); DBUG_PRINT("enter",("sub_name: %s",sub_name));
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
/* static functions defined in this file */ /* static functions defined in this file */
static void NEAR_F set_form_timestamp(TABLE *table, byte *record);
static int NEAR_F delete_file(const char *name,const char *ext,int extflag); static int NEAR_F delete_file(const char *name,const char *ext,int extflag);
ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count, ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count,
......
...@@ -775,7 +775,10 @@ longlong Item_func_locate::val_int() ...@@ -775,7 +775,10 @@ longlong Item_func_locate::val_int()
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
} }
null_value=0; null_value=0;
uint start=0,start0=0; uint start=0;
#ifdef USE_MB
uint start0=0;
#endif
if (arg_count == 3) if (arg_count == 3)
{ {
start=(uint) args[2]->val_int()-1; start=(uint) args[2]->val_int()-1;
......
...@@ -843,7 +843,7 @@ public: ...@@ -843,7 +843,7 @@ public:
FT_DOCLIST *ft_handler; FT_DOCLIST *ft_handler;
Item_func_match(List<Item> &a, Item *b): Item_real_func(b), Item_func_match(List<Item> &a, Item *b): Item_real_func(b),
fields(a), table(0), ft_handler(0), master(0) {} fields(a), table(0), master(0), ft_handler(0) {}
~Item_func_match() ~Item_func_match()
{ {
if (!master) if (!master)
......
...@@ -412,7 +412,6 @@ net_real_write(NET *net,const char *packet,ulong len) ...@@ -412,7 +412,6 @@ net_real_write(NET *net,const char *packet,ulong len)
static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed) static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
{ {
char buff[1024];
ALARM alarm_buff; ALARM alarm_buff;
uint retry_count=0; uint retry_count=0;
if (!thr_alarm_in_use(alarmed)) if (!thr_alarm_in_use(alarmed))
......
...@@ -516,7 +516,6 @@ command"); ...@@ -516,7 +516,6 @@ command");
static uint read_event(MYSQL* mysql, MASTER_INFO *mi) static uint read_event(MYSQL* mysql, MASTER_INFO *mi)
{ {
uint len = packet_error; uint len = packet_error;
NET* net = &mysql->net;
int read_errno = EINTR; // for convinience lets think we start by int read_errno = EINTR; // for convinience lets think we start by
// being in the interrupted state :-) // being in the interrupted state :-)
// my_real_read() will time us out // my_real_read() will time us out
...@@ -543,15 +542,17 @@ static uint read_event(MYSQL* mysql, MASTER_INFO *mi) ...@@ -543,15 +542,17 @@ static uint read_event(MYSQL* mysql, MASTER_INFO *mi)
} }
DBUG_PRINT("info",( "len=%u, net->read_pos[4] = %d\n", DBUG_PRINT("info",( "len=%u, net->read_pos[4] = %d\n",
len, net->read_pos[4])); len, mysql->net.read_pos[4]));
return len - 1; return len - 1;
} }
static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
{ {
Log_event * ev = Log_event::read_log_event((const char*)net->read_pos + 1 , event_len); Log_event * ev = Log_event::read_log_event((const char*)net->read_pos + 1,
if(ev) event_len);
if (ev)
{ {
switch(ev->get_type_code()) switch(ev->get_type_code())
{ {
...@@ -780,14 +781,11 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) ...@@ -780,14 +781,11 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len)
} }
else else
{ {
sql_print_error("Could not parse log event entry, check the master for binlog corruption\ sql_print_error("Could not parse log event entry, check the master for binlog corruption\n\
This may also be a network problem, or just a bug in the master or slave code"); This may also be a network problem, or just a bug in the master or slave code");
return 1; return 1;
} }
return 0;
return 0;
} }
// slave thread // slave thread
......
...@@ -553,11 +553,11 @@ bool select_dump::send_data(List<Item> &items) ...@@ -553,11 +553,11 @@ bool select_dump::send_data(List<Item> &items)
} }
while ((item=li++)) while ((item=li++))
{ {
Item_result result_type=item->result_type();
res=item->str_result(&tmp); res=item->str_result(&tmp);
if (!res) if (!res) // If NULL
{ {
if (my_b_write(&cache,(byte*) "",1)) goto err; // NULL if (my_b_write(&cache,(byte*) "",1))
goto err;
} }
else if (my_b_write(&cache,(byte*) res->ptr(),res->length())) else if (my_b_write(&cache,(byte*) res->ptr(),res->length()))
{ {
......
...@@ -753,13 +753,11 @@ store_create_info(THD *thd, TABLE *table, String* packet) ...@@ -753,13 +753,11 @@ store_create_info(THD *thd, TABLE *table, String* packet)
for (uint j=0 ; j < key_info->key_parts ; j++,key_part++) for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
{ {
if(j) if (j)
packet->append(','); packet->append(',');
if(key_part->field) if (key_part->field)
packet->append(key_part->field->field_name); packet->append(key_part->field->field_name);
KEY *key=table->key_info+i;
if (!key_part->field || if (!key_part->field ||
(key_part->length != (key_part->length !=
table->field[key_part->fieldnr-1]->key_length() && table->field[key_part->fieldnr-1]->key_length() &&
......
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