diff options
author | unknown <monty@mysql.com> | 2004-12-31 03:47:56 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2004-12-31 03:47:56 +0200 |
commit | 45199f545cafb15687b4aae4d127d552a8dcf27a (patch) | |
tree | dd3c89af5e01f80d9172adc65e8df542cd91cb5b /merge | |
parent | 12a215b0833d9aa688ba16fe56eb3411a83e7d4f (diff) | |
download | mariadb-git-45199f545cafb15687b4aae4d127d552a8dcf27a.tar.gz |
After merge fixes
Cleanup of mi_print_error() handling
Deleted 'merge' directory
BitKeeper/deleted/.del-mrg_close.c~1fa9230422daa62a:
Delete: merge/mrg_close.c
BitKeeper/deleted/.del-mrg_create.c~b747c8ec2b801f6:
Delete: merge/mrg_create.c
BitKeeper/deleted/.del-mrg_delete.c~38b4156885bb4537:
Delete: merge/mrg_delete.c
BitKeeper/deleted/.del-mrg_extra.c~7eb6181e1761907e:
Delete: merge/mrg_extra.c
BitKeeper/deleted/.del-mrg_info.c~37728e7238cc5a11:
Delete: merge/mrg_info.c
BitKeeper/deleted/.del-mrg_locking.c~112756a2d581e1d0:
Delete: merge/mrg_locking.c
BitKeeper/deleted/.del-mrg_open.c~6e1d5c8bfa62a519:
Delete: merge/mrg_open.c
BitKeeper/deleted/.del-mrg_panic.c~e204e43cd6d55406:
Delete: merge/mrg_panic.c
BitKeeper/deleted/.del-mrg_rrnd.c~6087c3dd7ecb77:
Delete: merge/mrg_rrnd.c
BitKeeper/deleted/.del-mrg_rsame.c~3e8ed4be2a0952b1:
Delete: merge/mrg_rsame.c
BitKeeper/deleted/.del-mrg_static.c~75a4b78a165dbd0:
Delete: merge/mrg_static.c
BitKeeper/deleted/.del-mrg_update.c~4110a4f1fbf1ab45:
Delete: merge/mrg_update.c
BitKeeper/deleted/.del-Makefile.am~41238af048e60515:
Delete: merge/Makefile.am
BitKeeper/deleted/.del-make-ccc~4f1acbfc127e25d5:
Delete: merge/make-ccc
BitKeeper/deleted/.del-mrg_def.h~a10557d12a87ef1c:
Delete: merge/mrg_def.h
BitKeeper/deleted/.del-.cvsignore~2f287ba794db3da7:
Delete: merge/.cvsignore
include/myisam.h:
Added 'share' to st_mi_keydef' to not have to pass 'st_myisam_info' to functions
myisam/ft_static.c:
Removed compiler warning
myisam/mi_delete.c:
Cleanup of mi_print_error() handling
Break if get_key() return 0
Don't test for HA_ERR_CRASHED; Print errors when my_errno is set
myisam/mi_extra.c:
Cleanup of mi_print_error() handling
myisam/mi_key.c:
Cleanup of mi_print_error() handling
myisam/mi_keycache.c:
Cleanup of mi_print_error() handling
myisam/mi_locking.c:
Cleanup of mi_print_error() handling
myisam/mi_open.c:
Added 'my_isam_share' to MI_KEYDEF
myisam/mi_page.c:
Cleanup of mi_print_error() handling
myisam/mi_range.c:
get_key() calls mi_print_error() if needed
myisam/mi_rkey.c:
Cleanup of mi_print_error() handling
myisam/mi_search.c:
Cleanup of mi_print_error() handling
Break if get_key() return 0
Don't test for HA_ERR_CRASHED; Print errors when my_errno is set
myisam/mi_update.c:
Cleanup of mi_print_error() handling
myisam/mi_write.c:
Cleanup of mi_print_error() handling
Break if get_key() return 0
Don't test for HA_ERR_CRASHED; Print errors when my_errno is set
myisam/myisamdef.h:
Cleanup of mi_print_error() handling
mysql-test/r/grant.result:
Update results after merge
mysql-test/r/timezone2.result:
Update results after merge
mysql-test/t/grant.test:
New error numbers
mysql-test/t/timezone2.test:
New error numbers
sql/item_func.cc:
Remove duplicate include file
sql/sql_acl.cc:
Remove warnings from valgrind
sql/tztime.cc:
Print wrong timezone names to log
Diffstat (limited to 'merge')
-rw-r--r-- | merge/.cvsignore | 3 | ||||
-rw-r--r-- | merge/Makefile.am | 25 | ||||
-rwxr-xr-x | merge/make-ccc | 3 | ||||
-rw-r--r-- | merge/mrg_close.c | 40 | ||||
-rw-r--r-- | merge/mrg_create.c | 61 | ||||
-rw-r--r-- | merge/mrg_def.h | 29 | ||||
-rw-r--r-- | merge/mrg_delete.c | 29 | ||||
-rw-r--r-- | merge/mrg_extra.c | 46 | ||||
-rw-r--r-- | merge/mrg_info.c | 60 | ||||
-rw-r--r-- | merge/mrg_locking.c | 33 | ||||
-rw-r--r-- | merge/mrg_open.c | 150 | ||||
-rw-r--r-- | merge/mrg_panic.c | 47 | ||||
-rw-r--r-- | merge/mrg_rrnd.c | 110 | ||||
-rw-r--r-- | merge/mrg_rsame.c | 36 | ||||
-rw-r--r-- | merge/mrg_static.c | 26 | ||||
-rw-r--r-- | merge/mrg_update.c | 31 |
16 files changed, 0 insertions, 729 deletions
diff --git a/merge/.cvsignore b/merge/.cvsignore deleted file mode 100644 index e9955884756..00000000000 --- a/merge/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -.deps -Makefile -Makefile.in diff --git a/merge/Makefile.am b/merge/Makefile.am deleted file mode 100644 index 25e15e9c6ec..00000000000 --- a/merge/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -# 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 - -INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include -pkglib_LIBRARIES = libmerge.a -noinst_HEADERS = mrg_def.h -libmerge_a_SOURCES = mrg_open.c mrg_extra.c mrg_info.c mrg_locking.c \ - mrg_rrnd.c mrg_update.c mrg_delete.c mrg_rsame.c \ - mrg_panic.c mrg_close.c mrg_create.c mrg_static.c - -# Don't update the files from bitkeeper -%::SCCS/s.% diff --git a/merge/make-ccc b/merge/make-ccc deleted file mode 100755 index 3f37c33638f..00000000000 --- a/merge/make-ccc +++ /dev/null @@ -1,3 +0,0 @@ -ccc -I./../include -I../include -DDBUG_OFF -fast -O3 -c _locking.c close.c create.c delete.c extra.c info.c open.c panic.c rrnd.c rsame.c static.c update.c -rm libmerge.a -ar -cr libmerge.a _locking.o diff --git a/merge/mrg_close.c b/merge/mrg_close.c deleted file mode 100644 index e835fd06e47..00000000000 --- a/merge/mrg_close.c +++ /dev/null @@ -1,40 +0,0 @@ -/* 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 */ - -/* close a isam-database */ - -#include "mrg_def.h" - -int mrg_close(register MRG_INFO *info) -{ - int error=0,new_error; - MRG_TABLE *file; - DBUG_ENTER("mrg_close"); - - for (file=info->open_tables ; file != info->end_table ; file++) - if ((new_error=nisam_close(file->table))) - error=new_error; - pthread_mutex_lock(&THR_LOCK_open); - mrg_open_list=list_delete(mrg_open_list,&info->open_list); - pthread_mutex_unlock(&THR_LOCK_open); - my_free((gptr) info,MYF(0)); - if (error) - { - my_errno=error; - DBUG_RETURN(-1); - } - DBUG_RETURN(0); -} diff --git a/merge/mrg_create.c b/merge/mrg_create.c deleted file mode 100644 index d55a1421647..00000000000 --- a/merge/mrg_create.c +++ /dev/null @@ -1,61 +0,0 @@ -/* 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 */ - -/* Create a MERGE-file */ - -#include "mrg_def.h" - - /* create file named 'name' and save filenames in it - table_names should be NULL or a vector of string-pointers with - a NULL-pointer last - */ - -int mrg_create(const char *name, const char**table_names) -{ - int save_errno; - uint errpos; - File file; - char buff[FN_REFLEN],*end; - DBUG_ENTER("mrg_create"); - - errpos=0; - if ((file = my_create(fn_format(buff,name,"",MRG_NAME_EXT,4),0, - O_RDWR | O_TRUNC,MYF(MY_WME))) < 0) - goto err; - errpos=1; - if (table_names) - for ( ; *table_names ; table_names++) - { - strmov(buff,*table_names); - fn_same(buff,name,4); - *(end=strend(buff))='\n'; - if (my_write(file,*table_names,(uint) (end-buff+1), - MYF(MY_WME | MY_NABP))) - goto err; - } - if (my_close(file,MYF(0))) - goto err; - DBUG_RETURN(0); - -err: - save_errno=my_errno; - switch (errpos) { - case 1: - VOID(my_close(file,MYF(0))); - } - my_errno=save_errno; /* Return right errocode */ - DBUG_RETURN(-1); -} /* mrg_create */ diff --git a/merge/mrg_def.h b/merge/mrg_def.h deleted file mode 100644 index 8b6be08c32d..00000000000 --- a/merge/mrg_def.h +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 */ - -/* Denna fil includeras i alla merge-filer */ - -#ifndef N_MAXKEY -#include "../isam/isamdef.h" -#endif - -#include "merge.h" - -extern LIST *mrg_open_list; - -#ifdef THREAD -extern pthread_mutex_t THR_LOCK_open; -#endif diff --git a/merge/mrg_delete.c b/merge/mrg_delete.c deleted file mode 100644 index 920156be01e..00000000000 --- a/merge/mrg_delete.c +++ /dev/null @@ -1,29 +0,0 @@ -/* 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 */ - -/* Delete last read record */ - -#include "mrg_def.h" - -int mrg_delete(MRG_INFO *info,const byte *record) -{ - if (!info->current_table) - { - my_errno=HA_ERR_NO_ACTIVE_RECORD; - return(-1); - } - return nisam_delete(info->current_table->table,record); -} diff --git a/merge/mrg_extra.c b/merge/mrg_extra.c deleted file mode 100644 index d37b1aaa03c..00000000000 --- a/merge/mrg_extra.c +++ /dev/null @@ -1,46 +0,0 @@ -/* 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 */ - -/* - Extra functions we want to do with a database - - All flags, exept record-cache-flags, are set in all used databases - record-cache-flags are set in mrg_rrnd when we are changing database. -*/ - -#include "mrg_def.h" - -int mrg_extra( -MRG_INFO *info, -enum ha_extra_function function) -{ - MRG_TABLE *file; - - if (function == HA_EXTRA_CACHE) - info->cache_in_use=1; - else - { - if (function == HA_EXTRA_NO_CACHE || function == HA_EXTRA_RESET) - info->cache_in_use=0; - if (function == HA_EXTRA_RESET || function == HA_EXTRA_RESET_STATE) - { - info->current_table=0; - info->last_used_table=info->open_tables; - } - for (file=info->open_tables ; file != info->end_table ; file++) - nisam_extra(file->table,function); - } - return 0; -} diff --git a/merge/mrg_info.c b/merge/mrg_info.c deleted file mode 100644 index 57f22276487..00000000000 --- a/merge/mrg_info.c +++ /dev/null @@ -1,60 +0,0 @@ -/* 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 */ - -#include "mrg_def.h" - -ulong mrg_position(MRG_INFO *info) -{ - MRG_TABLE *current_table; - - if (!(current_table = info->current_table) && - info->open_tables != info->end_table) - current_table = info->open_tables; - return (current_table ? - (ulong) (current_table->table->lastpos + - current_table->file_offset) : - ~(ulong) 0); -} - - /* If flag != 0 one only gets pos of last record */ - -int mrg_info(MRG_INFO *info,register MERGE_INFO *x,int flag) -{ - MRG_TABLE *current_table; - DBUG_ENTER("mrg_info"); - - if (!(current_table = info->current_table) && - info->open_tables != info->end_table) - current_table = info->open_tables; - x->recpos = info->current_table ? - info->current_table->table->lastpos + info->current_table->file_offset : - (ulong) -1L; - if (flag != HA_STATUS_POS) - { - x->records = info->records; - x->deleted = info->del; - x->data_file_length = info->data_file_length; - x->reclength = info->reclength; - if (current_table) - x->errkey = current_table->table->errkey; - else - { /* No tables in MRG */ - x->errkey=0; - } - x->options = info->options; - } - DBUG_RETURN(0); -} diff --git a/merge/mrg_locking.c b/merge/mrg_locking.c deleted file mode 100644 index bd33e047091..00000000000 --- a/merge/mrg_locking.c +++ /dev/null @@ -1,33 +0,0 @@ -/* 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 */ - -/* - Lock databases against read or write. -*/ - -#include "mrg_def.h" - -int mrg_lock_database(MRG_INFO *info,int lock_type) -{ - int error,new_error; - MRG_TABLE *file; - - error=0; - for (file=info->open_tables ; file != info->end_table ; file++) - if ((new_error=nisam_lock_database(file->table,lock_type))) - error=new_error; - return(error); -} diff --git a/merge/mrg_open.c b/merge/mrg_open.c deleted file mode 100644 index 6bf75392131..00000000000 --- a/merge/mrg_open.c +++ /dev/null @@ -1,150 +0,0 @@ -/* 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 */ - -/* open a MERGE-database */ - -#include "mrg_def.h" -#include <stddef.h> -#include <errno.h> -#ifdef VMS -#include "static.c" -#endif - -/* open a MERGE-database. - - if handle_locking is 0 then exit with error if some database is locked - if handle_locking is 1 then wait if database is locked -*/ - - -MRG_INFO *mrg_open( -const char *name, -int mode, -int handle_locking) -{ - int save_errno,i,errpos; - uint files,dir_length,length, options; - ulonglong file_offset; - char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; - MRG_INFO info,*m_info; - File fd; - IO_CACHE file; - N_INFO *isam,*last_isam; - DBUG_ENTER("mrg_open"); - - LINT_INIT(last_isam); - isam=0; - errpos=files=0; - bzero((gptr) &info,sizeof(info)); - bzero((char*) &file,sizeof(file)); - if ((fd=my_open(fn_format(name_buff,name,"",MRG_NAME_EXT,4), - O_RDONLY | O_SHARE,MYF(0))) < 0 || - init_io_cache(&file, fd, IO_SIZE, READ_CACHE, 0, 0, - MYF(MY_WME | MY_NABP))) - goto err; - errpos=1; - dir_length=dirname_part(name_buff,name); - info.reclength=0; - while ((length=my_b_gets(&file,buff,FN_REFLEN-1))) - { - if ((end=buff+length)[-1] == '\n') - end[-1]='\0'; - if (buff[0] && buff[0] != '#') /* Skip empty lines and comments */ - { - last_isam=isam; - if (!test_if_hard_path(buff)) - { - VOID(strmake(name_buff+dir_length,buff, - sizeof(name_buff)-1-dir_length)); - VOID(cleanup_dirname(buff,name_buff)); - } - if (!(isam=nisam_open(buff,mode,test(handle_locking)))) - goto err; - files++; - } - last_isam=isam; - if (info.reclength && info.reclength != isam->s->base.reclength) - { - my_errno=HA_ERR_WRONG_IN_RECORD; - goto err; - } - info.reclength=isam->s->base.reclength; - } - if (!(m_info= (MRG_INFO*) my_malloc(sizeof(MRG_INFO)+files*sizeof(MRG_TABLE), - MYF(MY_WME)))) - goto err; - *m_info=info; - m_info->open_tables=(MRG_TABLE *) (m_info+1); - m_info->tables=files; - - options= (uint) ~0; - for (i=files ; i-- > 0 ; ) - { - m_info->open_tables[i].table=isam; - m_info->options|=isam->s->base.options; - options&=isam->s->base.options; - m_info->records+=isam->s->state.records; - m_info->del+=isam->s->state.del; - m_info->data_file_length=isam->s->state.data_file_length; - if (i) - isam=(N_INFO*) (isam->open_list.next->data); - } - /* Don't force readonly if not all tables are readonly */ - if (! (options & (HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA))) - m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA); - - /* Fix fileinfo for easyer debugging (actually set by rrnd) */ - file_offset=0; - for (i=0 ; (uint) i < files ; i++) - { - m_info->open_tables[i].file_offset=(my_off_t) file_offset; - file_offset+=m_info->open_tables[i].table->s->state.data_file_length; - } - if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L) - { - my_errno=HA_ERR_RECORD_FILE_FULL; - my_free((char*) m_info,MYF(0)); - goto err; - } - - m_info->end_table=m_info->open_tables+files; - m_info->last_used_table=m_info->open_tables; - - VOID(my_close(fd,MYF(0))); - end_io_cache(&file); - m_info->open_list.data=(void*) m_info; - pthread_mutex_lock(&THR_LOCK_open); - mrg_open_list=list_add(mrg_open_list,&m_info->open_list); - pthread_mutex_unlock(&THR_LOCK_open); - DBUG_RETURN(m_info); - -err: - save_errno=my_errno; - switch (errpos) { - case 1: - VOID(my_close(fd,MYF(0))); - end_io_cache(&file); - for (i=files ; i-- > 0 ; ) - { - isam=last_isam; - if (i) - last_isam=(N_INFO*) (isam->open_list.next->data); - nisam_close(isam); - } - } - my_errno=save_errno; - DBUG_RETURN (NULL); -} diff --git a/merge/mrg_panic.c b/merge/mrg_panic.c deleted file mode 100644 index e9ad1974d8f..00000000000 --- a/merge/mrg_panic.c +++ /dev/null @@ -1,47 +0,0 @@ -/* 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 */ - -#include "mrg_def.h" - - /* if flag == HA_PANIC_CLOSE then all misam files are closed */ - /* if flag == HA_PANIC_WRITE then all misam files are unlocked and - all changed data in single user misam is written to file */ - /* if flag == HA_PANIC_READ then all misam files that was locked when - nisam_panic(HA_PANIC_WRITE) was done is locked. A ni_readinfo() is - done for all single user files to get changes in database */ - - -int mrg_panic( -enum ha_panic_function flag) -{ - int error=0; - LIST *list_element,*next_open; - MRG_INFO *info; - DBUG_ENTER("mrg_panic"); - - for (list_element=mrg_open_list ; list_element ; list_element=next_open) - { - next_open=list_element->next; /* Save if close */ - info=(MRG_INFO*) list_element->data; - if (flag == HA_PANIC_CLOSE && mrg_close(info)) - error=my_errno; - } - if (mrg_open_list && flag != HA_PANIC_CLOSE) - DBUG_RETURN(nisam_panic(flag)); - if (!error) DBUG_RETURN(0); - my_errno=error; - DBUG_RETURN(-1); -} diff --git a/merge/mrg_rrnd.c b/merge/mrg_rrnd.c deleted file mode 100644 index 206427d74d4..00000000000 --- a/merge/mrg_rrnd.c +++ /dev/null @@ -1,110 +0,0 @@ -/* 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 */ - -/* - Read a record with random-access. The position to the record must - get by mrg_info(). The next record can be read with pos= -1 */ - - -#include "mrg_def.h" - -static MRG_TABLE *find_table(MRG_TABLE *start,MRG_TABLE *end,mrg_off_t pos); - -/* - If filepos == -1, read next - Returns same as nisam_rrnd: - 0 = Ok. - 1 = Record deleted. - -1 = EOF (or something, errno should be HA_ERR_END_OF_FILE) -*/ - -int mrg_rrnd(MRG_INFO *info,byte *buf,mrg_off_t filepos) -{ - int error; - N_INFO *isam_info; - - if (filepos == ~(mrg_off_t) 0) /* Can't use HA_POS_ERROR */ - { - if (!info->current_table) - { - if (info->open_tables == info->end_table) - { /* No tables */ - my_errno=HA_ERR_END_OF_FILE; - return -1; - } - isam_info=(info->current_table=info->open_tables)->table; - if (info->cache_in_use) - nisam_extra(isam_info,HA_EXTRA_CACHE); - filepos=isam_info->s->pack.header_length; - isam_info->lastinx= (uint) -1; /* Can't forward or backward */ - } - else - { - isam_info=info->current_table->table; - filepos= isam_info->nextpos; - } - - for (;;) - { - isam_info->update&= HA_STATE_CHANGED; - if ((error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf, - filepos,1)) >= 0 || - my_errno != HA_ERR_END_OF_FILE) - return (error); - if (info->cache_in_use) - nisam_extra(info->current_table->table,HA_EXTRA_NO_CACHE); - if (info->current_table+1 == info->end_table) - return(-1); - info->current_table++; - info->last_used_table=info->current_table; - if (info->cache_in_use) - nisam_extra(info->current_table->table,HA_EXTRA_CACHE); - info->current_table->file_offset= - info->current_table[-1].file_offset+ - info->current_table[-1].table->s->state.data_file_length; - - isam_info=info->current_table->table; - filepos=isam_info->s->pack.header_length; - isam_info->lastinx= (uint) -1; - } - } - info->current_table=find_table(info->open_tables, - info->end_table-1,filepos); - isam_info=info->current_table->table; - isam_info->update&= HA_STATE_CHANGED; - return ((*isam_info->s->read_rnd)(isam_info,(byte*) buf, - (ulong) (filepos - - info->current_table->file_offset), - 0)); -} - - - /* Find which table to use according to file-pos */ - -static MRG_TABLE *find_table(MRG_TABLE *start,MRG_TABLE *end,mrg_off_t pos) -{ - MRG_TABLE *mid; - - while (start != end) - { - mid=start+((uint) (end-start)+1)/2; - if (mid->file_offset > pos) - end=mid-1; - else - start=mid; - } - return start; -} diff --git a/merge/mrg_rsame.c b/merge/mrg_rsame.c deleted file mode 100644 index ee840bc3060..00000000000 --- a/merge/mrg_rsame.c +++ /dev/null @@ -1,36 +0,0 @@ -/* 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 */ - -#include "mrg_def.h" - - -int mrg_rsame( -MRG_INFO *info, -byte *record, -int inx) /* not used, should be 0 */ -{ - if (inx) - { - my_errno=HA_ERR_WRONG_INDEX; - return(-1); - } - if (!info->current_table) - { - my_errno=HA_ERR_NO_ACTIVE_RECORD; - return(-1); - } - return nisam_rsame(info->current_table->table,record,inx); -} diff --git a/merge/mrg_static.c b/merge/mrg_static.c deleted file mode 100644 index 1b7327c870f..00000000000 --- a/merge/mrg_static.c +++ /dev/null @@ -1,26 +0,0 @@ -/* 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 - a shared library -*/ - -#ifndef stdin -#include "mrg_def.h" -#endif - -LIST *mrg_open_list=0; diff --git a/merge/mrg_update.c b/merge/mrg_update.c deleted file mode 100644 index a6650267f36..00000000000 --- a/merge/mrg_update.c +++ /dev/null @@ -1,31 +0,0 @@ -/* 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 */ - -/* Update last read record */ - -#include "mrg_def.h" - -int mrg_update( -register MRG_INFO *info, -const byte *oldrec, const byte *newrec) -{ - if (!info->current_table) - { - my_errno=HA_ERR_NO_ACTIVE_RECORD; - return(-1); - } - return nisam_update(info->current_table->table,oldrec,newrec); -} |