diff options
Diffstat (limited to 'isam')
-rw-r--r-- | isam/_cache.c | 20 | ||||
-rw-r--r-- | isam/_dbug.c | 6 | ||||
-rw-r--r-- | isam/_dynrec.c | 26 | ||||
-rw-r--r-- | isam/_key.c | 6 | ||||
-rw-r--r-- | isam/_locking.c | 8 | ||||
-rw-r--r-- | isam/_packrec.c | 12 | ||||
-rw-r--r-- | isam/_page.c | 6 | ||||
-rw-r--r-- | isam/_search.c | 6 | ||||
-rw-r--r-- | isam/_statrec.c | 8 | ||||
-rw-r--r-- | isam/changed.c | 6 | ||||
-rw-r--r-- | isam/close.c | 6 | ||||
-rw-r--r-- | isam/create.c | 18 | ||||
-rw-r--r-- | isam/delete.c | 8 | ||||
-rw-r--r-- | isam/extra.c | 13 | ||||
-rw-r--r-- | isam/info.c | 6 | ||||
-rw-r--r-- | isam/isamchk.c | 398 | ||||
-rw-r--r-- | isam/isamdef.h | 6 | ||||
-rw-r--r-- | isam/isamlog.c | 12 | ||||
-rw-r--r-- | isam/log.c | 6 | ||||
-rw-r--r-- | isam/open.c | 6 | ||||
-rw-r--r-- | isam/pack_isam.c | 233 | ||||
-rw-r--r-- | isam/panic.c | 6 | ||||
-rw-r--r-- | isam/range.c | 6 | ||||
-rw-r--r-- | isam/rfirst.c | 6 | ||||
-rw-r--r-- | isam/rkey.c | 6 | ||||
-rw-r--r-- | isam/rlast.c | 6 | ||||
-rw-r--r-- | isam/rnext.c | 6 | ||||
-rw-r--r-- | isam/rprev.c | 6 | ||||
-rw-r--r-- | isam/rrnd.c | 6 | ||||
-rw-r--r-- | isam/rsame.c | 6 | ||||
-rw-r--r-- | isam/rsamepos.c | 6 | ||||
-rw-r--r-- | isam/sort.c | 6 | ||||
-rw-r--r-- | isam/static.c | 8 | ||||
-rw-r--r-- | isam/test1.c | 8 | ||||
-rw-r--r-- | isam/test2.c | 18 | ||||
-rw-r--r-- | isam/test3.c | 26 | ||||
-rw-r--r-- | isam/update.c | 6 | ||||
-rw-r--r-- | isam/write.c | 8 |
38 files changed, 478 insertions, 478 deletions
diff --git a/isam/_cache.c b/isam/_cache.c index 53619126660..bca9a699a85 100644 --- a/isam/_cache.c +++ b/isam/_cache.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -46,11 +46,11 @@ int _nisam_read_cache(IO_CACHE *info, byte *buff, ulong pos, uint length, buff+=read_length; } if ((offset=pos - (ulong) info->pos_in_file) < - (ulong) (info->rc_end - info->rc_request_pos)) + (ulong) (info->read_end - info->request_pos)) { - in_buff_pos=info->rc_request_pos+(uint) offset; - in_buff_length= min(length,(uint) (info->rc_end-in_buff_pos)); - memcpy(buff,info->rc_request_pos+(uint) offset,(size_t) in_buff_length); + in_buff_pos=info->request_pos+(uint) offset; + in_buff_length= min(length,(uint) (info->read_end-in_buff_pos)); + memcpy(buff,info->request_pos+(uint) offset,(size_t) in_buff_length); if (!(length-=in_buff_length)) return 0; pos+=in_buff_length; @@ -61,14 +61,14 @@ int _nisam_read_cache(IO_CACHE *info, byte *buff, ulong pos, uint length, if (flag & READING_NEXT) { if (pos != ((info)->pos_in_file + - (uint) ((info)->rc_end - (info)->rc_request_pos))) + (uint) ((info)->read_end - (info)->request_pos))) { info->pos_in_file=pos; /* Force start here */ - info->rc_pos=info->rc_end=info->rc_request_pos; /* Everything used */ + info->read_pos=info->read_end=info->request_pos; /* Everything used */ info->seek_not_done=1; } else - info->rc_pos=info->rc_end; /* All block used */ + info->read_pos=info->read_end; /* All block used */ if (!(*info->read_function)(info,buff,length)) return 0; if (!(flag & READING_HEADER) || info->error == -1 || diff --git a/isam/_dbug.c b/isam/_dbug.c index 18e671793ed..0a52dbbc916 100644 --- a/isam/_dbug.c +++ b/isam/_dbug.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/_dynrec.c b/isam/_dynrec.c index 2a908f5b42c..d17d34e6778 100644 --- a/isam/_dynrec.c +++ b/isam/_dynrec.c @@ -432,7 +432,7 @@ uint _nisam_rec_pack(N_INFO *info, register byte *to, register const byte *from) blob++; from+=sizeof(char*); /* Skipp blob-pointer */ } - else if (type == FIELD_SKIPP_ZERO) + else if (type == FIELD_SKIP_ZERO) { if (memcmp((byte*) from,zero_string,length) == 0) flag|=bit; @@ -441,11 +441,11 @@ uint _nisam_rec_pack(N_INFO *info, register byte *to, register const byte *from) memcpy((byte*) to,from,(size_t) length); to+=length; } } - else if (type == FIELD_SKIPP_ENDSPACE || - type == FIELD_SKIPP_PRESPACE) + else if (type == FIELD_SKIP_ENDSPACE || + type == FIELD_SKIP_PRESPACE) { pos= (byte*) from; end= (byte*) from + length; - if (type == FIELD_SKIPP_ENDSPACE) + if (type == FIELD_SKIP_ENDSPACE) { /* Pack trailing spaces */ while (end > from && *(end-1) == ' ') end--; @@ -532,7 +532,7 @@ my_bool _nisam_rec_check(N_INFO *info,const char *from) to+=length+ blob_length; from+=sizeof(char*); } - else if (type == FIELD_SKIPP_ZERO) + else if (type == FIELD_SKIP_ZERO) { if (memcmp((byte*) from,zero_string,length) == 0) { @@ -542,11 +542,11 @@ my_bool _nisam_rec_check(N_INFO *info,const char *from) else to+=length; } - else if (type == FIELD_SKIPP_ENDSPACE || - type == FIELD_SKIPP_PRESPACE) + else if (type == FIELD_SKIP_ENDSPACE || + type == FIELD_SKIP_PRESPACE) { pos= (byte*) from; end= (byte*) from + length; - if (type == FIELD_SKIPP_ENDSPACE) + if (type == FIELD_SKIP_ENDSPACE) { /* Pack trailing spaces */ while (end > from && *(end-1) == ' ') end--; @@ -641,10 +641,10 @@ uint _nisam_rec_unpack(register N_INFO *info, register byte *to, byte *from, bzero((byte*) to,rec_length+sizeof(char*)); to+=sizeof(char*); } - else if (type == FIELD_SKIPP_ZERO) + else if (type == FIELD_SKIP_ZERO) bzero((byte*) to,rec_length); - else if (type == FIELD_SKIPP_ENDSPACE || - type == FIELD_SKIPP_PRESPACE) + else if (type == FIELD_SKIP_ENDSPACE || + type == FIELD_SKIP_PRESPACE) { if (rec->base.length > 255 && *from & 128) { @@ -662,7 +662,7 @@ uint _nisam_rec_unpack(register N_INFO *info, register byte *to, byte *from, if (length >= rec_length || min_pack_length + length > (uint) (from_end - from)) goto err; - if (type == FIELD_SKIPP_ENDSPACE) + if (type == FIELD_SKIP_ENDSPACE) { memcpy(to,(byte*) from,(size_t) length); bfill((byte*) to+length,rec_length-length,' '); @@ -690,7 +690,7 @@ uint _nisam_rec_unpack(register N_INFO *info, register byte *to, byte *from, } else { - if (type == FIELD_SKIPP_ENDSPACE || type == FIELD_SKIPP_PRESPACE) + if (type == FIELD_SKIP_ENDSPACE || type == FIELD_SKIP_PRESPACE) min_pack_length--; if (min_pack_length + rec_length > (uint) (from_end - from)) goto err; diff --git a/isam/_key.c b/isam/_key.c index 62f080af172..c0d667cb32d 100644 --- a/isam/_key.c +++ b/isam/_key.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/_locking.c b/isam/_locking.c index ca38c611812..be9741a4237 100644 --- a/isam/_locking.c +++ b/isam/_locking.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -306,8 +306,8 @@ int _nisam_writeinfo(register N_INFO *info, uint flags) MYF(MY_WME | MY_SEEK_NOT_DONE)) && !error) DBUG_RETURN(1); } - } #endif + } my_errno=olderror; } else if (flags) diff --git a/isam/_packrec.c b/isam/_packrec.c index 5c387f011ad..74a45852e63 100644 --- a/isam/_packrec.c +++ b/isam/_packrec.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -456,7 +456,7 @@ int _nisam_pack_rec_unpack(register N_INFO *info, register byte *to, static void (*get_unpack_function(N_RECINFO *rec))(N_RECINFO *, BIT_BUFF *, uchar *, uchar *) { switch (rec->base_type) { - case FIELD_SKIPP_ZERO: + case FIELD_SKIP_ZERO: if (rec->pack_type & PACK_TYPE_ZERO_FILL) return &uf_zerofill_skipp_zero; return &uf_skipp_zero; @@ -466,7 +466,7 @@ static void (*get_unpack_function(N_RECINFO *rec))(N_RECINFO *, BIT_BUFF *, ucha if (rec->pack_type & PACK_TYPE_ZERO_FILL) return &uf_zerofill_normal; return &decode_bytes; - case FIELD_SKIPP_ENDSPACE: + case FIELD_SKIP_ENDSPACE: if (rec->pack_type & PACK_TYPE_SPACE_FIELDS) { if (rec->pack_type & PACK_TYPE_SELECTED) @@ -476,7 +476,7 @@ static void (*get_unpack_function(N_RECINFO *rec))(N_RECINFO *, BIT_BUFF *, ucha if (rec->pack_type & PACK_TYPE_SELECTED) return &uf_endspace_selected; return &uf_endspace; - case FIELD_SKIPP_PRESPACE: + case FIELD_SKIP_PRESPACE: if (rec->pack_type & PACK_TYPE_SPACE_FIELDS) { if (rec->pack_type & PACK_TYPE_SELECTED) diff --git a/isam/_page.c b/isam/_page.c index 6f6d632e85d..65733d66b77 100644 --- a/isam/_page.c +++ b/isam/_page.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/_search.c b/isam/_search.c index c005e9ddb69..32492f83929 100644 --- a/isam/_search.c +++ b/isam/_search.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/_statrec.c b/isam/_statrec.c index d93f4fe27f5..9dbc948440f 100644 --- a/isam/_statrec.c +++ b/isam/_statrec.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -187,7 +187,7 @@ int _nisam_read_rnd_static_record(N_INFO *info, byte *buf, (skipp_deleted_blocks || !filepos)) { cache_read=1; /* Read record using cache */ - cache_length=(uint) (info->rec_cache.rc_end - info->rec_cache.rc_pos); + cache_length=(uint) (info->rec_cache.read_end - info->rec_cache.read_pos); } else info->rec_cache.seek_not_done=1; /* Filepos is changed */ diff --git a/isam/changed.c b/isam/changed.c index 4f87a45aa2d..b8132538b86 100644 --- a/isam/changed.c +++ b/isam/changed.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/close.c b/isam/close.c index 6741e7b23f0..f1465990100 100644 --- a/isam/close.c +++ b/isam/close.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/create.c b/isam/create.c index fcf54ddc731..4c23f3edd11 100644 --- a/isam/create.c +++ b/isam/create.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -96,8 +96,8 @@ int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo, pack_reclength+=sizeof(char*)+(1 << (rec->base.length*8)); } } - else if (type == FIELD_SKIPP_PRESPACE || - type == FIELD_SKIPP_ENDSPACE) + else if (type == FIELD_SKIP_PRESPACE || + type == FIELD_SKIP_ENDSPACE) { if (pack_reclength != NI_POS_ERROR) pack_reclength+= rec->base.length > 255 ? 2 : 1; @@ -105,7 +105,7 @@ int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo, } else if (type == FIELD_ZERO) packed--; - else if (type != FIELD_SKIPP_ZERO) + else if (type != FIELD_SKIP_ZERO) { min_pack_length+=rec->base.length; packed--; /* Not a pack record type */ @@ -119,7 +119,7 @@ int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo, while (rec != recinfo) { rec--; - if (rec->base.type == (int) FIELD_SKIPP_ZERO && rec->base.length == 1) + if (rec->base.type == (int) FIELD_SKIP_ZERO && rec->base.length == 1) { rec->base.type=(int) FIELD_NORMAL; packed--; @@ -294,13 +294,13 @@ int nisam_create(const char *name,uint keys,N_KEYDEF *keyinfo, goto err; /* Enlarge files */ - if (my_chsize(file,(ulong) share.base.keystart,MYF(0))) + if (my_chsize(file, (ulong) share.base.keystart, 0, MYF(0))) goto err; if (! (flags & HA_DONT_TOUCH_DATA)) { #ifdef USE_RELOC - if (my_chsize(dfile,share.base.min_pack_length*reloc,MYF(0))) + if (my_chsize(dfile, share.base.min_pack_length*reloc, 0, MYF(0))) goto err; #endif errpos=1; diff --git a/isam/delete.c b/isam/delete.c index e50ad72c767..5aa542561c1 100644 --- a/isam/delete.c +++ b/isam/delete.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -613,5 +613,3 @@ static uint remove_key(N_KEYDEF *keyinfo, uint nod_flag, (uint) (page_end-start-s_length)); DBUG_RETURN((uint) s_length); } /* remove_key */ - - diff --git a/isam/extra.c b/isam/extra.c index 1d333fa372f..e2f13532ddf 100644 --- a/isam/extra.c +++ b/isam/extra.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -123,6 +123,7 @@ int nisam_extra(N_INFO *info, enum ha_extra_function function) } #endif if (!(info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED))) + { if (!(init_io_cache(&info->rec_cache,info->dfile,0, WRITE_CACHE,info->s->state.data_file_length, (pbool) (info->lock_type != F_UNLCK), @@ -131,7 +132,12 @@ int nisam_extra(N_INFO *info, enum ha_extra_function function) info->opt_flag|=WRITE_CACHE_USED; info->update&= ~HA_STATE_ROW_CHANGED; } + } break; + case HA_EXTRA_PREPARE_FOR_UPDATE: + if (info->s->data_file_type != DYNAMIC_RECORD) + break; + /* Remove read/write cache if dynamic rows */ case HA_EXTRA_NO_CACHE: if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) { @@ -204,6 +210,7 @@ int nisam_extra(N_INFO *info, enum ha_extra_function function) info->s->changed=1; /* Update on close */ break; case HA_EXTRA_FORCE_REOPEN: + case HA_EXTRA_PREPARE_FOR_DELETE: pthread_mutex_lock(&THR_LOCK_isam); info->s->last_version= 0L; /* Impossible version */ #ifdef __WIN__ diff --git a/isam/info.c b/isam/info.c index 43c15af908d..a23494e4876 100644 --- a/isam/info.c +++ b/isam/info.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/isamchk.c b/isam/isamchk.c index 3aa1cf4e3c2..35b4e881962 100644 --- a/isam/isamchk.c +++ b/isam/isamchk.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -20,7 +20,7 @@ #include <m_ctype.h> #include <stdarg.h> -#include <getopt.h> +#include <my_getopt.h> #ifdef HAVE_SYS_VADVICE_H #include <sys/vadvise.h> #endif @@ -62,7 +62,7 @@ SET_STACK_SIZE(9000) /* Minimum stack size for program */ #define MIN_SORT_BUFFER (4096-MALLOC_OVERHEAD) #endif -#define NEAD_MEM ((uint) 10*4*(IO_SIZE+32)+32) /* Nead for recursion */ +#define NEED_MEM ((uint) 10*4*(IO_SIZE+32)+32) /* Nead for recursion */ #define MAXERR 20 #define BUFFERS_WHEN_SORTING 16 /* Alloc for sort-key-tree */ #define WRITE_COUNT MY_HOW_OFTEN_TO_WRITE @@ -94,12 +94,16 @@ typedef struct st_isam_sort_info { N_KEYSEG *keyseg; } ISAM_SORT_INFO; -enum ic_options {OPT_CHARSETS_DIR_IC=256}; +enum ic_options {OPT_CHARSETS_DIR_IC=256, OPT_KEY_BUFFER_SIZE, + OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, + OPT_SORT_BUFFER_SIZE, OPT_SORT_KEY_BLOCKS, + OPT_DECODE_BITS}; static ulong use_buffers=0,read_buffer_length=0,write_buffer_length=0, sort_buffer_length=0,sort_key_blocks=0,crc=0,unique_count=0; static uint testflag=0,out_flag=0,warning_printed=0,error_printed=0, - rep_quick=0,verbose=0,opt_follow_links=1; + verbose=0,opt_follow_links=1; +static my_bool rep_quick= 0; static uint opt_sort_key=0,total_files=0,max_level=0,max_key=N_MAXKEY; static ulong keydata=0,totaldata=0,key_blocks=0; static ulong new_file_pos=0,record_checksum=0,key_file_blocks=0,decode_bits; @@ -234,118 +238,118 @@ int main( int argc, char **argv) } /* main */ -static CHANGEABLE_VAR changeable_vars[] = { - { "key_buffer_size",(long*) &use_buffers,(long) USE_BUFFER_INIT, - (long) MALLOC_OVERHEAD, (long) ~0L,(long) MALLOC_OVERHEAD,(long) IO_SIZE }, - { "read_buffer_size", (long*) &read_buffer_length,(long) READ_BUFFER_INIT, - (long) MALLOC_OVERHEAD,(long) ~0L,(long) MALLOC_OVERHEAD,(long) 1L }, - { "write_buffer_size", (long*) &write_buffer_length,(long) READ_BUFFER_INIT, - (long) MALLOC_OVERHEAD,(long) ~0L,(long) MALLOC_OVERHEAD,(long) 1L }, - { "sort_buffer_size",(long*) &sort_buffer_length,(long) SORT_BUFFER_INIT, - (long) (MIN_SORT_BUFFER+MALLOC_OVERHEAD),(long) ~0L, - (long) MALLOC_OVERHEAD,(long) 1L }, - { "sort_key_blocks",(long*) &sort_key_blocks,BUFFERS_WHEN_SORTING,4L,100L,0L, - 1L }, - { "decode_bits",(long*) &decode_bits,9L,4L,17L,0L,1L }, - { NullS,(long*) 0,0L,0L,0L,0L,0L,} }; - - -static struct option long_options[] = +static struct my_option my_long_options[] = { - {"analyze", no_argument, 0, 'a'}, - {"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR_IC}, + {"analyze", 'a', + "Analyze distribution of keys. Will make some joins in MySQL faster.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"character-sets-dir", OPT_CHARSETS_DIR_IC, + "Directory where character sets are", (gptr*) &charsets_dir, + (gptr*) &charsets_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #ifndef DBUG_OFF - {"debug", required_argument, 0, '#'}, + {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"default-character-set", required_argument, 0, 'C'}, - {"description", no_argument, 0, 'd'}, - {"extend-check", no_argument, 0, 'e'}, - {"information", no_argument, 0, 'i'}, - {"force", no_argument, 0, 'f'}, - {"help", no_argument, 0, '?'}, - {"keys-used", required_argument, 0, 'k'}, - {"no-symlinks", no_argument, 0, 'l'}, - {"quick", no_argument, 0, 'q'}, - {"recover", no_argument, 0, 'r'}, - {"safe-recover", no_argument, 0, 'o'}, - {"block-search", required_argument, 0, 'b'}, - {"set-variable", required_argument, 0, 'O'}, - {"silent", no_argument, 0, 's'}, - {"sort-index", no_argument, 0, 'S'}, - {"sort-records", required_argument, 0, 'R'}, - {"unpack", no_argument, 0, 'u'}, - {"verbose", no_argument, 0, 'v'}, - {"version", no_argument, 0, 'V'}, - {"wait", no_argument, 0, 'w'}, - {0, 0, 0, 0} + {"default-character-set", 'C', "Set the default character set", + (gptr*) &default_charset, (gptr*) &default_charset, 0, GET_STR, + REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"description", 'd', "Prints some information about table.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"extend-check", 'e', + "Check the table VERY thoroughly. One need to use this only in extreme cases, because isamchk should normally find all errors even without this switch.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"information", 'i', "Print statistics information about the table", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"force", 'f', + "Overwrite old temporary files. If one uses -f when checking tables (running isamchk without -r), isamchk will automatically restart with -r on any wrong table.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"help", '?', "Display this help and exit.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, + 0, 0, 0, 0, 0}, + {"keys-used", 'k', + "Used with '-r'. Tell ISAM to update only the first # keys. This can be used to get faster inserts!", + (gptr*) &max_key, (gptr*) &max_key, 0, GET_UINT, REQUIRED_ARG, N_MAXKEY, 0, + 0, 0, 0, 0}, + {"no-symlinks", 'l', + "Do not follow symbolic links when repairing. Normally isamchk repairs the table a symlink points at.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"quick", 'q', + "Used with -r to get a faster repair. (The data file isn't touched.) One can give a second '-q' to force isamchk to modify the original datafile.", + (gptr*) &rep_quick, (gptr*) &rep_quick, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, + 0}, + {"recover", 'r', + "Can fix almost anything except unique keys that aren't unique.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"safe-recover", 'o', + "Uses old recovery method; slower than '-r' but can handle a couple of cases that '-r' cannot handle.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"set-variable", 'O', + "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", + 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"block-search", 'b', "For debugging.", (gptr*) &search_after_block, + (gptr*) &search_after_block, 0, GET_ULONG, REQUIRED_ARG, NI_POS_ERROR, 0, + 0, 0, 0, 0}, + {"silent", 's', + "Only print errors. One can use two -s to make isamchk very silent.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"sort-index", 'S', + "Sort index blocks. This speeds up 'read-next' in applications.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"sort-records", 'R', + "Sort records according to an index. This makes your data much more localized and may speed up things (It may be VERY slow to do a sort the first time!)", + (gptr*) &opt_sort_key, (gptr*) &opt_sort_key, 0, GET_UINT, REQUIRED_ARG, + 0, 0, (N_MAXKEY - 1), 1, 0, 0}, + {"unpack", 'u', "Unpack file packed with pack_isam.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"verbose", 'v', + "Print more information. This can be used with -d and -e. Use many -v for more verbosity!", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"version", 'V', "Print version and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"wait", 'w', "Wait if table is locked.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"key_buffer_size", OPT_KEY_BUFFER_SIZE, "", (gptr*) &use_buffers, + (gptr*) &use_buffers, 0, GET_ULONG, REQUIRED_ARG, (long) USE_BUFFER_INIT, + (long) MALLOC_OVERHEAD, (long) ~0L, (long) MALLOC_OVERHEAD, (long) IO_SIZE, + 0}, + {"read_buffer_size", OPT_READ_BUFFER_SIZE, "", + (gptr*) &read_buffer_length, (gptr*) &read_buffer_length, 0, GET_ULONG, + REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, + (long) ~0L, (long) MALLOC_OVERHEAD, (long) 1L, 0}, + {"write_buffer_size", OPT_WRITE_BUFFER_SIZE, "", + (gptr*) &write_buffer_length, (gptr*) &write_buffer_length, 0, GET_ULONG, + REQUIRED_ARG, (long) READ_BUFFER_INIT, (long) MALLOC_OVERHEAD, (long) ~0L, + (long) MALLOC_OVERHEAD, (long) 1L, 0}, + {"sort_buffer_size", OPT_SORT_BUFFER_SIZE, "", + (gptr*) &sort_buffer_length, (gptr*) &sort_buffer_length, 0, GET_ULONG, + REQUIRED_ARG, (long) SORT_BUFFER_INIT, + (long) (MIN_SORT_BUFFER + MALLOC_OVERHEAD), (long) ~0L, + (long) MALLOC_OVERHEAD, (long) 1L, 0}, + {"sort_key_blocks", OPT_SORT_KEY_BLOCKS, "", + (gptr*) &sort_key_blocks, (gptr*) &sort_key_blocks, 0, GET_ULONG, + REQUIRED_ARG, BUFFERS_WHEN_SORTING, 4L, 100L, 0L, 1L, 0}, + {"decode_bits", OPT_DECODE_BITS, "", + (gptr*) &decode_bits, (gptr*) &decode_bits, 0, GET_ULONG, REQUIRED_ARG, + 9L, 4L, 17L, 0L, 1L, 0}, + {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; static void print_version(void) { - printf("%s Ver 5.17 for %s at %s\n",my_progname,SYSTEM_TYPE, + printf("%s Ver 6.01 for %s at %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); } static void usage(void) { - uint i; print_version(); - puts("TCX Datakonsult AB, by Monty, for your professional use"); + puts("MySQL AB, by Monty, for your professional use"); puts("This software comes with NO WARRANTY: see the PUBLIC for details.\n"); puts("Description, check and repair of ISAM tables."); puts("Used without options all tables on the command will be checked for errors"); printf("Usage: %s [OPTIONS] tables[.ISM]\n", my_progname); - puts("\n\ - -a, --analyze Analyze distribution of keys. Will make some joins in\n\ - MySQL faster.\n\ - -#, --debug=... Output debug log. Often this is 'd:t:o,filename`\n\ - --character-sets-dir=...\n\ - Directory where character sets are\n\ - -C, --default-character-set=...\n\ - Set the default character set\n\ - -d, --description Prints some information about table.\n\ - -e, --extend-check Check the table VERY thoroughly. One need use this\n\ - only in extreme cases as isamchk should normally find\n\ - all errors even without this switch\n\ - -f, --force Overwrite old temporary files.\n\ - If one uses -f when checking tables (running isamchk\n\ - without -r), isamchk will automatically restart with\n\ - -r on any wrong table.\n\ - -?, --help Display this help and exit.\n\ - -i, --information Print statistics information about the table\n\ - -k, --keys-used=# Used with '-r'. Tell ISAM to update only the first\n\ - # keys. This can be used to get faster inserts!\n\ - -l, --no-symlinks Do not follow symbolic links when repairing. Normally\n\ - isamchk repairs the table a symlink points at.\n\ - -q, --quick Used with -r to get a faster repair. (The data file\n\ - isn't touched.) One can give a second '-q' to force\n\ - isamchk to modify the original datafile."); - puts("\ - -r, --recover Can fix almost anything except unique keys that aren't\n\ - unique.\n\ - -o, --safe-recover Uses old recovery method; slower than '-r' but can\n\ - handle a couple of cases that '-r' cannot handle.\n\ - -O, --set-variable var=option\n\ - Change the value of a variable.\n\ - -s, --silent Only print errors. One can use two -s to make isamchk\n\ - very silent\n\ - -S, --sort-index Sort index blocks. This speeds up 'read-next' in\n\ - applications\n\ - -R, --sort-records=#\n\ - Sort records according to an index. This makes your\n\ - data much more localized and may speed up things\n\ - (It may be VERY slow to do a sort the first time!)\n\ - -u, --unpack Unpack file packed with pack_isam.\n\ - -v, --verbose Print more information. This can be used with\n\ - -d and -e. Use many -v for more verbosity!\n\ - -V, --version Print version and exit.\n\ - -w, --wait Wait if table is locked."); - print_defaults("my",load_default_groups); - printf("\nPossible variables for option --set-variable (-O) are:\n"); - for (i=0; changeable_vars[i].name ; i++) - printf("%-20s current value: %lu\n", - changeable_vars[i].name, - *changeable_vars[i].varptr); + my_print_help(my_long_options); + print_defaults("my", load_default_groups); + my_print_variables(my_long_options); } /* Check table */ @@ -512,7 +516,7 @@ static int nisamchk(my_string filename) if (!rep_quick) { if (testflag & T_EXTEND) - VOID(init_key_cache(use_buffers,(uint) NEAD_MEM)); + VOID(init_key_cache(use_buffers)); VOID(init_io_cache(&read_cache,datafile,(uint) read_buffer_length, READ_CACHE,share->pack.header_length,1, MYF(MY_WME))); @@ -575,112 +579,94 @@ end2: } /* nisamchk */ +static my_bool +get_one_option(int optid, const struct my_option *opt __attribute__((unused)), + char *argument) + +{ + switch(optid) { + case 'a': + testflag|= T_STATISTICS; + break; + case 's': /* silent */ + if (testflag & T_SILENT) + testflag|=T_VERY_SILENT; + testflag|= T_SILENT; + testflag&= ~T_WRITE_LOOP; + break; + case 'w': + testflag|= T_WAIT_FOREVER; + break; + case 'd': /* description if isam-file */ + testflag|= T_DESCRIPT; + break; + case 'e': /* extend check */ + testflag|= T_EXTEND; + break; + case 'i': + testflag|= T_INFO; + break; + case 'f': + tmpfile_createflag= O_RDWR | O_TRUNC; + testflag|=T_FORCE_CREATE; + break; + case 'l': + opt_follow_links=0; + break; + case 'r': /* Repair table */ + testflag= (testflag & ~T_REP) | T_REP_BY_SORT; + break; + case 'o': + testflag= (testflag & ~T_REP_BY_SORT) | T_REP; + my_disable_async_io=1; /* More safety */ + break; + case 'u': + testflag|= T_UNPACK | T_REP_BY_SORT; + break; + case 'v': /* Verbose */ + testflag|= T_VERBOSE; + verbose++; + break; + case 'R': /* Sort records */ + testflag|= T_SORT_RECORDS; + if (opt_sort_key >= N_MAXKEY) + { + fprintf(stderr, + "The value of the sort key is bigger than max key: %d.\n", + N_MAXKEY); + exit(1); + } + break; + case 'S': /* Sort index */ + testflag|= T_SORT_INDEX; + break; + case '#': + DBUG_PUSH(argument ? argument : "d:t:o,/tmp/isamchk.trace"); + break; + case 'V': + print_version(); + exit(0); + case '?': + usage(); + exit(0); + } + return 0; +} + /* Read options */ -static void get_options(register int *argc,register char ***argv) +static void get_options(register int *argc, register char ***argv) { - int c,option_index=0; + int ho_error; load_defaults("my",load_default_groups,argc,argv); defaults_alloc= *argv; - set_all_changeable_vars(changeable_vars); if (isatty(fileno(stdout))) testflag|=T_WRITE_LOOP; - while ((c=getopt_long(*argc,*argv,"adeif?lqrosSuvVw#:b:k:O:R:C:", - long_options, &option_index)) != EOF) - { - switch(c) { - case 'a': - testflag|= T_STATISTICS; - break; - case 'C': - default_charset=optarg; - break; - case OPT_CHARSETS_DIR_IC: - charsets_dir = optarg; - break; - case 'b': - search_after_block=strtoul(optarg,NULL,10); - break; - case 's': /* silent */ - if (testflag & T_SILENT) - testflag|=T_VERY_SILENT; - testflag|= T_SILENT; - testflag&= ~T_WRITE_LOOP; - break; - case 'w': - testflag|= T_WAIT_FOREVER; - break; - case 'd': /* description if isam-file */ - testflag|= T_DESCRIPT; - break; - case 'e': /* extend check */ - testflag|= T_EXTEND; - break; - case 'i': - testflag|= T_INFO; - break; - case 'f': - tmpfile_createflag= O_RDWR | O_TRUNC; - testflag|=T_FORCE_CREATE; - break; - case 'k': - max_key= (uint) atoi(optarg); - break; - case 'l': - opt_follow_links=0; - break; - case 'r': /* Repair table */ - testflag= (testflag & ~T_REP) | T_REP_BY_SORT; - break; - case 'o': - testflag= (testflag & ~T_REP_BY_SORT) | T_REP; - my_disable_async_io=1; /* More safety */ - break; - case 'q': - rep_quick++; - break; - case 'u': - testflag|= T_UNPACK | T_REP_BY_SORT; - break; - case 'v': /* Verbose */ - testflag|= T_VERBOSE; - verbose++; - break; - case 'O': - if (set_changeable_var(optarg, changeable_vars)) - { - usage(); - exit(1); - } - break; - case 'R': /* Sort records */ - testflag|= T_SORT_RECORDS; - opt_sort_key=(uint) atoi(optarg)-1; - if (opt_sort_key >= N_MAXKEY) - { - fprintf(stderr, - "The value of the sort key is bigger than max key: %d.\n", - N_MAXKEY); - exit(1); - } - break; - case 'S': /* Sort index */ - testflag|= T_SORT_INDEX; - break; - case '#': - DBUG_PUSH(optarg ? optarg : "d:t:o,/tmp/isamchk.trace"); - break; - case 'V': - print_version(); - exit(0); - case '?': - usage(); - exit(0); - } - } - (*argc)-=optind; - (*argv)+=optind; + + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + exit(ho_error); + if (*argc == 0) { usage(); @@ -1473,7 +1459,7 @@ my_string name; printf("Data records: %lu\n",(ulong) share->state.records); } - VOID(init_key_cache(use_buffers,NEAD_MEM)); + VOID(init_key_cache(use_buffers)); if (init_io_cache(&read_cache,info->dfile,(uint) read_buffer_length, READ_CACHE,share->pack.header_length,1,MYF(MY_WME))) goto err; @@ -1566,7 +1552,7 @@ my_string name; { VOID(fputs(" \r",stdout)); VOID(fflush(stdout)); } - if (my_chsize(share->kfile,share->state.key_file_length,MYF(0))) + if (my_chsize(share->kfile, share->state.key_file_length, 0, MYF(0))) { print_warning("Can't change size of indexfile, error: %d",my_errno); goto err; @@ -1950,7 +1936,7 @@ int write_info; if (share->state.key_root[sort_key] == NI_POS_ERROR) DBUG_RETURN(0); /* Nothing to do */ - init_key_cache(use_buffers,NEAD_MEM); + init_key_cache(use_buffers); if (init_io_cache(&info->rec_cache,-1,(uint) write_buffer_length, WRITE_CACHE,share->pack.header_length,1, MYF(MY_WME | MY_WAIT_IF_FULL))) @@ -2528,10 +2514,10 @@ my_string name; skr=share->base.reloc*share->base.min_pack_length; #endif if (skr != sort_info.filelength) - if (my_chsize(info->dfile,skr,MYF(0))) + if (my_chsize(info->dfile, skr, 0, MYF(0))) print_warning("Can't change size of datafile, error: %d",my_errno); } - if (my_chsize(share->kfile,share->state.key_file_length,MYF(0))) + if (my_chsize(share->kfile, share->state.key_file_length, 0, MYF(0))) print_warning("Can't change size of indexfile, error: %d",my_errno); if (!(testflag & T_SILENT)) diff --git a/isam/isamdef.h b/isam/isamdef.h index da08b5f6a14..0884b18e997 100644 --- a/isam/isamdef.h +++ b/isam/isamdef.h @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/isamlog.c b/isam/isamlog.c index 5763b697d07..0367c03e08a 100644 --- a/isam/isamlog.c +++ b/isam/isamlog.c @@ -327,9 +327,9 @@ static int examine_log(my_string file_name, char **table_names) init_io_cache(&cache,file,0,READ_CACHE,start_offset,0,MYF(0)); bzero((gptr) com_count,sizeof(com_count)); - init_tree(&tree,0,sizeof(file_info),(qsort_cmp) file_info_compare,1, - (void(*)(void*)) file_info_free); - VOID(init_key_cache(KEY_CACHE_SIZE,(uint) (10*4*(IO_SIZE+MALLOC_OVERHEAD)))); + init_tree(&tree,0,0,sizeof(file_info),(qsort_cmp2) file_info_compare,1, + (tree_element_free) file_info_free, NULL); + VOID(init_key_cache(KEY_CACHE_SIZE)); files_open=0; access_time=0; while (access_time++ != number_of_commands && @@ -400,11 +400,7 @@ static int examine_log(my_string file_name, char **table_names) } to=isam_file_name; if (filepath) - { - strmov(isam_file_name,filepath); - convert_dirname(isam_file_name); - to=strend(isam_file_name); - } + to=convert_dirname(isam_file_name, filepath, NullS); strmov(to,pos); fn_ext(isam_file_name)[0]=0; /* Remove extension */ } diff --git a/isam/log.c b/isam/log.c index a95b53b5110..78b56690401 100644 --- a/isam/log.c +++ b/isam/log.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/open.c b/isam/open.c index 8969b2fa8b8..9dc27981507 100644 --- a/isam/open.c +++ b/isam/open.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/pack_isam.c b/isam/pack_isam.c index 5a66a9cb33c..b2e21afc743 100644 --- a/isam/pack_isam.c +++ b/isam/pack_isam.c @@ -30,7 +30,7 @@ #ifndef __GNU_LIBRARY__ #define __GNU_LIBRARY__ /* Skipp warnings in getopt.h */ #endif -#include <getopt.h> +#include <my_getopt.h> #if INT_MAX > 32767 #define BITS_SAVED 32 @@ -67,7 +67,7 @@ struct st_file_buffer { char *buffer,*pos,*end; my_off_t pos_in_file; int bits; - uint byte; + uint bytes; }; struct st_huff_tree; @@ -182,8 +182,9 @@ static int mrg_rrnd(MRG_INFO *info,byte *buf); static void mrg_reset(MRG_INFO *mrg); -static int backup=0,error_on_write=0,test_only=0,verbose=0,silent=0, - write_loop=0,force_pack=0,opt_wait=0,isamchk_neaded=0; +static int error_on_write=0,test_only=0,verbose=0,silent=0, + write_loop=0,force_pack=0,isamchk_neaded=0; +static my_bool backup, opt_wait; static int tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL; static uint tree_buff_length=8196-MALLOC_OVERHEAD,force_pack_ref_length; static char tmp_dir[FN_REFLEN]={0},*join_table; @@ -240,26 +241,44 @@ int main(int argc, char **argv) } -static struct option long_options[] = +static struct my_option my_long_options[] = { - {"backup", no_argument, 0, 'b'}, - {"debug", optional_argument, 0, '#'}, - {"force", no_argument, 0, 'f'}, - {"join", required_argument, 0, 'j'}, - {"help", no_argument, 0, '?'}, - {"packlength",required_argument, 0, 'p'}, - {"silent", no_argument, 0, 's'}, - {"tmpdir", required_argument, 0, 'T'}, - {"test", no_argument, 0, 't'}, - {"verbose", no_argument, 0, 'v'}, - {"version", no_argument, 0, 'V'}, - {"wait", no_argument, 0, 'w'}, - {0, 0, 0, 0} + {"backup", 'b', "Make a backup of the table as table_name.OLD", + (gptr*) &backup, (gptr*) &backup, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"debug", '#', "Output debug log. Often this is 'd:t:o,filename'", + 0, 0, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, + {"force", 'f', + "Force packing of table even if it's gets bigger or tempfile exists.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"join", 'j', + "Join all given tables into 'new_table_name'. All tables MUST have the identical layout.", + (gptr*) &join_table, (gptr*) &join_table, 0, GET_STR, REQUIRED_ARG, 0, 0, + 0, 0, 0, 0}, + {"help", '?', "Display this help and exit.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"packlength", 'p', "Force storage size of recordlength (1, 2 or 3)", + (gptr*) &force_pack_ref_length, (gptr*) &force_pack_ref_length, 0, + GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + {"silent", 's', "Be more silent.", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0 ,0}, + {"tmpdir", 'T', "Use temporary directory to store temporary table", + (gptr*) &tmp_dir, (gptr*) &tmp_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, + 0, 0}, + {"test", 't', "Don't pack table, only test packing it", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0 ,0}, + {"verbose", 'v', "Write info about progress and packing result", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0 ,0}, + {"version", 'V', "output version information and exit", + 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0 ,0}, + {"wait", 'w', "Wait and retry if table is in use", (gptr*) &opt_wait, + (gptr*) &opt_wait, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; + static void print_version(void) { - printf("%s Ver 5.8 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE); + printf("%s Ver 5.10 for %s on %s\n", my_progname, SYSTEM_TYPE, MACHINE_TYPE); } static void usage(void) @@ -275,92 +294,72 @@ static void usage(void) puts("You should give the .ISM file as the filename argument"); printf("\nUsage: %s [OPTIONS] filename...\n", my_progname); - puts("\n\ - -b, --backup Make a backup of the table as table_name.OLD\n\ - -f, --force Force packing of table even if it's gets bigger or\n\ - tempfile exists.\n\ - -j, --join='new_table_name'\n\ - Join all given tables into 'new_table_name'.\n\ - All tables MUST have the identical layout.\n\ - -p, --packlength=# Force storage size of recordlength (1,2 or 3)\n\ - -s, --silent Be more silent.\n\ - -t, --test Don't pack table, only test packing it\n\ - -v, --verbose Write info about progress and packing result\n\ - -w, --wait Wait and retry if table is in use\n\ - -T, --tmpdir=# Use temporary directory to store temporary table\n\ - -#, --debug=... output debug log. Often this is 'd:t:o,filename`\n\ - -?, --help display this help and exit\n\ - -V, --version output version information and exit\n"); - print_defaults("my",load_default_groups); + my_print_help(my_long_options); + print_defaults("my", load_default_groups); + my_print_variables(my_long_options); +} + + +static my_bool +get_one_option(int optid, const struct my_option *opt __attribute__((unused)), + char *argument) +{ + uint length; + + switch(optid) { + case 'f': + force_pack= 1; + tmpfile_createflag= O_RDWR | O_TRUNC; + break; + case 'p': + if (force_pack_ref_length > 3) + force_pack_ref_length= 0; + break; + case 's': + write_loop= verbose= 0; + silent= 1; + break; + case 't': + test_only= verbose= 1; + break; + case 'T': + length=(uint) (strmov(tmp_dir, argument) - tmp_dir); + if (length != dirname_length(tmp_dir)) + { + tmp_dir[length]= FN_LIBCHAR; + tmp_dir[length + 1]= 0; + } + break; + case 'v': + verbose= 1; + silent= 0; + break; + case '#': + DBUG_PUSH(argument ? argument : "d:t:o"); + break; + case 'V': print_version(); exit(0); + case 'I': + case '?': + usage(); + exit(0); + } + return 0; } /* reads options */ /* Initiates DEBUG - but no debugging here ! */ -static void get_options(int *argc,char ***argv) +static void get_options(int *argc, char ***argv) { - int c,option_index=0; - uint length; + int ho_error; + + if ((ho_error=handle_options(argc, argv, my_long_options, get_one_option))) + exit(ho_error); my_progname= argv[0][0]; if (isatty(fileno(stdout))) write_loop=1; - while ((c=getopt_long(*argc,*argv,"bfj:p:stvwT:#::?V",long_options, - &option_index)) != EOF) - { - switch(c) { - case 'b': - backup=1; - break; - case 'f': - force_pack=1; - tmpfile_createflag=O_RDWR | O_TRUNC; - break; - case 'j': - join_table=optarg; - break; - case 'p': - force_pack_ref_length=(uint) atoi(optarg); - if (force_pack_ref_length > 3) - force_pack_ref_length=0; - break; - case 's': - write_loop=verbose=0; silent=1; - break; - case 't': - test_only=verbose=1; - break; - case 'T': - length=(uint) (strmov(tmp_dir,optarg)-tmp_dir); - if (length != dirname_length(tmp_dir)) - { - tmp_dir[length]=FN_LIBCHAR; - tmp_dir[length+1]=0; - } - break; - case 'v': - verbose=1; silent=0; - break; - case 'w': - opt_wait=1; - break; - case '#': - DBUG_PUSH(optarg ? optarg : "d:t:o"); - break; - case 'V': print_version(); exit(0); - case 'I': - case '?': - usage(); - exit(0); - default: - fprintf(stderr,"%s: Illegal option: -%c\n",my_progname,opterr); - usage(); - exit(1); - } - } - (*argc)-=optind; - (*argv)+=optind; if (!*argc) { usage(); @@ -686,9 +685,9 @@ static HUFF_COUNTS *init_huff_count(N_INFO *info,my_off_t records) type = FIELD_NORMAL; if (count[i].field_length <= 8 && (type == FIELD_NORMAL || - type == FIELD_SKIPP_ZERO)) + type == FIELD_SKIP_ZERO)) count[i].max_zero_fill= count[i].field_length; - init_tree(&count[i].int_tree,0,-1,(qsort_cmp) compare_tree,0,NULL); + init_tree(&count[i].int_tree,0,0,-1,(qsort_cmp2) compare_tree,0,NULL,NULL); if (records) count[i].tree_pos=count[i].tree_buff = my_malloc(count[i].field_length > 1 ? tree_buff_length : 2, @@ -790,7 +789,7 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts) /* Save character counters and space-counts and zero-field-counts */ if (count->field_type == FIELD_NORMAL || - count->field_type == FIELD_SKIPP_ENDSPACE) + count->field_type == FIELD_SKIP_ENDSPACE) { for ( ; end_pos > pos ; end_pos--) if (end_pos[-1] != ' ') @@ -809,7 +808,7 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts) count->max_end_space = length; } if (count->field_type == FIELD_NORMAL || - count->field_type == FIELD_SKIPP_PRESPACE) + count->field_type == FIELD_SKIP_PRESPACE) { for (pos=start_pos; pos < end_pos ; pos++) if (pos[0] != ' ') @@ -829,7 +828,7 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts) } if (count->field_length <= 8 && (count->field_type == FIELD_NORMAL || - count->field_type == FIELD_SKIPP_ZERO)) + count->field_type == FIELD_SKIP_ZERO)) { uint i; if (!memcmp((byte*) start_pos,zero_string,count->field_length)) @@ -910,7 +909,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, my_off_t records) new_length=calc_packed_length(huff_counts,0); if (old_length < new_length && huff_counts->field_length > 1) { - huff_counts->field_type=FIELD_SKIPP_ZERO; + huff_counts->field_type=FIELD_SKIP_ZERO; huff_counts->counts[0]-=length; huff_counts->bytes_packed=old_length- records/8; goto found_pack; @@ -954,7 +953,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, my_off_t records) huff_counts->counts[' ']+=huff_counts->tot_pre_space; if (test_space_compress(huff_counts,records,huff_counts->max_end_space, huff_counts->end_space, - huff_counts->tot_end_space,FIELD_SKIPP_ENDSPACE)) + huff_counts->tot_end_space,FIELD_SKIP_ENDSPACE)) goto found_pack; huff_counts->counts[' ']-=huff_counts->tot_pre_space; } @@ -962,7 +961,7 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, my_off_t records) { if (test_space_compress(huff_counts,records,huff_counts->max_pre_space, huff_counts->pre_space, - huff_counts->tot_pre_space,FIELD_SKIPP_PRESPACE)) + huff_counts->tot_pre_space,FIELD_SKIP_PRESPACE)) goto found_pack; } @@ -972,10 +971,10 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, my_off_t records) if (huff_counts->max_zero_fill && (huff_counts->field_type == FIELD_NORMAL || - huff_counts->field_type == FIELD_SKIPP_ZERO)) + huff_counts->field_type == FIELD_SKIP_ZERO)) { huff_counts->counts[0]-=huff_counts->max_zero_fill* - (huff_counts->field_type == FIELD_SKIPP_ZERO ? + (huff_counts->field_type == FIELD_SKIP_ZERO ? records - huff_counts->zero_fields : records); huff_counts->pack_type|=PACK_TYPE_ZERO_FILL; huff_counts->bytes_packed=calc_packed_length(huff_counts,0); @@ -1015,9 +1014,9 @@ static void check_counts(HUFF_COUNTS *huff_counts, uint trees, my_off_t records) if (verbose) printf("\nnormal: %3d empty-space: %3d empty-zero: %3d empty-fill: %3d\npre-space: %3d end-space: %3d table-lookup: %3d zero: %3d\n", field_count[FIELD_NORMAL],space_fields, - field_count[FIELD_SKIPP_ZERO],fill_zero_fields, - field_count[FIELD_SKIPP_PRESPACE], - field_count[FIELD_SKIPP_ENDSPACE], + field_count[FIELD_SKIP_ZERO],fill_zero_fields, + field_count[FIELD_SKIP_PRESPACE], + field_count[FIELD_SKIP_ENDSPACE], field_count[FIELD_INTERVALL], field_count[FIELD_ZERO]); DBUG_VOID_RETURN; @@ -1672,7 +1671,7 @@ static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts) field_length-=count->max_zero_fill; switch(count->field_type) { - case FIELD_SKIPP_ZERO: + case FIELD_SKIP_ZERO: if (!memcmp((byte*) start_pos,zero_string,field_length)) { write_bits(1,1); @@ -1686,7 +1685,7 @@ static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts) write_bits(tree->code[(uchar) *start_pos], (uint) tree->code_len[(uchar) *start_pos]); break; - case FIELD_SKIPP_ENDSPACE: + case FIELD_SKIP_ENDSPACE: for (pos=end_pos ; pos > start_pos && pos[-1] == ' ' ; pos--) ; length=(uint) (end_pos-pos); if (count->pack_type & PACK_TYPE_SELECTED) @@ -1709,7 +1708,7 @@ static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts) (uint) tree->code_len[(uchar) *start_pos]); start_pos=end_pos; break; - case FIELD_SKIPP_PRESPACE: + case FIELD_SKIP_PRESPACE: for (pos=start_pos ; pos < end_pos && pos[0] == ' ' ; pos++) ; length=(uint) (pos-start_pos); if (count->pack_type & PACK_TYPE_SELECTED) @@ -1833,7 +1832,7 @@ static void init_file_buffer(File file, pbool read_buffer) file_buffer.pos=file_buffer.buffer; file_buffer.bits=BITS_SAVED; } - file_buffer.byte=0; + file_buffer.bytes=0; } @@ -1864,13 +1863,13 @@ static void write_bits (register ulong value, register uint bits) { if ((file_buffer.bits-=(int) bits) >= 0) { - file_buffer.byte|=value << file_buffer.bits; + file_buffer.bytes|=value << file_buffer.bits; } else { reg3 uint byte_buff; bits= (uint) -file_buffer.bits; - byte_buff=file_buffer.byte | (uint) (value >> bits); + byte_buff=file_buffer.bytes | (uint) (value >> bits); #if BITS_SAVED == 32 *file_buffer.pos++= (byte) (byte_buff >> 24) ; *file_buffer.pos++= (byte) (byte_buff >> 16) ; @@ -1896,7 +1895,7 @@ static void write_bits (register ulong value, register uint bits) if (file_buffer.pos >= file_buffer.end) VOID(flush_buffer((uint) ~0)); file_buffer.bits=(int) (BITS_SAVED - bits); - file_buffer.byte=(uint) (value << (BITS_SAVED - bits)); + file_buffer.bytes=(uint) (value << (BITS_SAVED - bits)); } return; } @@ -1908,7 +1907,7 @@ static void flush_bits (void) uint bits,byte_buff; bits=(file_buffer.bits) & ~7; - byte_buff = file_buffer.byte >> bits; + byte_buff = file_buffer.bytes >> bits; bits=BITS_SAVED - bits; while (bits > 0) { @@ -1916,7 +1915,7 @@ static void flush_bits (void) *file_buffer.pos++= (byte) (uchar) (byte_buff >> bits) ; } file_buffer.bits=BITS_SAVED; - file_buffer.byte=0; + file_buffer.bytes=0; return; } @@ -1960,7 +1959,7 @@ static void save_state(N_INFO *isam_file,MRG_INFO *mrg,my_off_t new_length, isam_file->update|=(HA_STATE_CHANGED | HA_STATE_ROW_CHANGED); isam_file->this_uniq=crc; /* Save crc here */ share->changed=1; /* Force write of header */ - VOID(my_chsize(share->kfile,share->state.key_file_length, + VOID(my_chsize(share->kfile, share->state.key_file_length, 0, MYF(0))); if (share->state.keys != share->base.keys) isamchk_neaded=1; diff --git a/isam/panic.c b/isam/panic.c index 52a5d1eb3b6..e51e83671df 100644 --- a/isam/panic.c +++ b/isam/panic.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/range.c b/isam/range.c index 5594991cfc3..3b79b6d93a9 100644 --- a/isam/range.c +++ b/isam/range.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/rfirst.c b/isam/rfirst.c index 82fd3994bdf..cc1cbee92bf 100644 --- a/isam/rfirst.c +++ b/isam/rfirst.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/rkey.c b/isam/rkey.c index 8f1f2f11ab5..bbe4576418b 100644 --- a/isam/rkey.c +++ b/isam/rkey.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/rlast.c b/isam/rlast.c index df2b1bc39af..a91f1f1011b 100644 --- a/isam/rlast.c +++ b/isam/rlast.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/rnext.c b/isam/rnext.c index 451624bb42b..be26098c901 100644 --- a/isam/rnext.c +++ b/isam/rnext.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/rprev.c b/isam/rprev.c index 50f22c838fd..0997a04fbbe 100644 --- a/isam/rprev.c +++ b/isam/rprev.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/rrnd.c b/isam/rrnd.c index 7fd197a6d58..16b3ab1b859 100644 --- a/isam/rrnd.c +++ b/isam/rrnd.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/rsame.c b/isam/rsame.c index fe617cf258c..9a2a03da054 100644 --- a/isam/rsame.c +++ b/isam/rsame.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/rsamepos.c b/isam/rsamepos.c index 500dfc60e38..c64ac492d1a 100644 --- a/isam/rsamepos.c +++ b/isam/rsamepos.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/sort.c b/isam/sort.c index 72c4c7564f8..d22b0e648a0 100644 --- a/isam/sort.c +++ b/isam/sort.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/static.c b/isam/static.c index 941c4defea2..9c68a0cfdba 100644 --- a/isam/static.c +++ b/isam/static.c @@ -1,21 +1,21 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ /* - Static variables for pisam library. All definied here for easy making of + Static variables for ISAM library. All definied here for easy making of a shared library */ diff --git a/isam/test1.c b/isam/test1.c index 33c61a53d4a..9ebc7af041d 100644 --- a/isam/test1.c +++ b/isam/test1.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -19,7 +19,7 @@ static void get_options(int argc, char *argv[]); static int rec_pointer_size=0,verbose=0,remove_ant=0,pack_keys=1,flags[50], - packed_field=FIELD_SKIPP_PRESPACE; + packed_field=FIELD_SKIP_PRESPACE; int main(int argc, char *argv[]) { diff --git a/isam/test2.c b/isam/test2.c index def6a4d3d5c..c8f97ccdefa 100644 --- a/isam/test2.c +++ b/isam/test2.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -115,17 +115,17 @@ int main(int argc, char *argv[]) keyinfo[5].seg[1].base.type=0; keyinfo[5].base.flag = (uint8) (pack_type ? HA_PACK_KEY : 0); - recinfo[0].base.type=pack_fields ? FIELD_SKIPP_PRESPACE : 0; + recinfo[0].base.type=pack_fields ? FIELD_SKIP_PRESPACE : 0; recinfo[0].base.length=7; - recinfo[1].base.type=pack_fields ? FIELD_SKIPP_PRESPACE : 0; + recinfo[1].base.type=pack_fields ? FIELD_SKIP_PRESPACE : 0; recinfo[1].base.length=5; - recinfo[2].base.type=pack_fields ? FIELD_SKIPP_PRESPACE : 0; + recinfo[2].base.type=pack_fields ? FIELD_SKIP_PRESPACE : 0; recinfo[2].base.length=9; recinfo[3].base.type=FIELD_NORMAL; recinfo[3].base.length=STANDAR_LENGTH-7-5-9-4; - recinfo[4].base.type=pack_fields ? FIELD_SKIPP_ZERO : 0; + recinfo[4].base.type=pack_fields ? FIELD_SKIP_ZERO : 0; recinfo[4].base.length=4; - recinfo[5].base.type=pack_fields ? FIELD_SKIPP_ENDSPACE : 0; + recinfo[5].base.type=pack_fields ? FIELD_SKIP_ENDSPACE : 0; recinfo[5].base.length=60; if (use_blob) { @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) goto err; printf("- Writing key:s\n"); if (key_cacheing) - init_key_cache(IO_SIZE*16,(uint) IO_SIZE*4*10); /* Use a small cache */ + init_key_cache(IO_SIZE*16); /* Use a small cache */ if (locking) nisam_lock_database(file,F_WRLCK); if (write_cacheing) diff --git a/isam/test3.c b/isam/test3.c index 935c194106d..228030f5832 100644 --- a/isam/test3.c +++ b/isam/test3.c @@ -1,21 +1,23 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ /* Test av locking */ +#ifndef __NETWARE__ + #include "nisam.h" #include <sys/types.h> #ifdef HAVE_SYS_WAIT_H @@ -171,8 +173,8 @@ void start_test(int id) exit(1); } if (key_cacheing && rnd(2) == 0) - init_key_cache(65536L,(uint) IO_SIZE*4*10); - printf("Process %d, pid: %d\n",id,getpid()); fflush(stdout); + init_key_cache(65536L); + printf("Process %d, pid: %d\n",id,(int) getpid()); fflush(stdout); for (error=i=0 ; i < tests && !error; i++) { @@ -356,7 +358,7 @@ int test_write(N_INFO *file,int id,int lock_type) nisam_extra(file,HA_EXTRA_WRITE_CACHE); } - sprintf(record.id,"%7d",getpid()); + sprintf(record.id,"%7d",(int) getpid()); strmov(record.text,"Testing..."); tries=(uint) rnd(100)+10; @@ -477,3 +479,15 @@ int test_update(N_INFO *file,int id,int lock_type) printf("%2d: update: %5d\n",id,update); fflush(stdout); return 0; } + +#else /* __NETWARE__ */ + +#include <stdio.h> + +main() +{ + fprintf(stderr,"this test has not been ported to NetWare\n"); + return 0; +} + +#endif /* __NETWARE__ */ diff --git a/isam/update.c b/isam/update.c index 82dab4140e3..b3b676f967d 100644 --- a/isam/update.c +++ b/isam/update.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ diff --git a/isam/write.c b/isam/write.c index 49b0916afc4..f2c0d8dbc45 100644 --- a/isam/write.c +++ b/isam/write.c @@ -1,15 +1,15 @@ /* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult 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 the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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 */ @@ -262,7 +262,7 @@ int _nisam_insert(register N_INFO *info, register N_KEYDEF *keyinfo, /* This may happen if a key was deleted and the next key could be compressed better than before */ DBUG_DUMP("anc_buff",(byte*) anc_buff,a_length); - + bmove(key_pos,key_pos - (int) t_length,(uint)key_offset); } _nisam_store_key(keyinfo,key_pos,&s_temp); |