#include <my_base.h>#include <myisam.h>#include <queues.h>Include dependency graph for myisammrg.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
| #define MERGE_INSERT_DISABLED 0 |
Definition at line 37 of file myisammrg.h.
Referenced by ha_myisammrg::append_create_info(), myrg_create(), and ha_myisammrg::write_row().
| #define MERGE_INSERT_TO_FIRST 1 |
| #define MERGE_INSERT_TO_LAST 2 |
| #define MYRG_NAME_EXT ".MRG" |
| typedef struct st_mymerge_info MYMERGE_INFO |
| typedef struct st_myrg_info MYRG_INFO |
| typedef struct st_myrg_table_info MYRG_TABLE |
| int myrg_close | ( | MYRG_INFO * | file | ) |
Definition at line 21 of file myrg_close.c.
References st_myrg_info::by_key, DBUG_ENTER, DBUG_RETURN, delete_queue(), st_myrg_info::end_table, error, list_delete(), mi_close(), my_errno, my_free, MYF, myrg_open_list, st_myrg_info::open_list, st_myrg_info::open_tables, pthread_mutex_lock, pthread_mutex_unlock, and st_myrg_table_info::table.
Referenced by ha_myisammrg::close(), myrg_panic(), and ha_myisammrg::open().
00022 { 00023 int error=0,new_error; 00024 MYRG_TABLE *file; 00025 DBUG_ENTER("myrg_close"); 00026 00027 for (file=info->open_tables ; file != info->end_table ; file++) 00028 if ((new_error=mi_close(file->table))) 00029 error=new_error; 00030 delete_queue(&info->by_key); 00031 pthread_mutex_lock(&THR_LOCK_open); 00032 myrg_open_list=list_delete(myrg_open_list,&info->open_list); 00033 pthread_mutex_unlock(&THR_LOCK_open); 00034 my_free((gptr) info,MYF(0)); 00035 if (error) 00036 { 00037 DBUG_RETURN(my_errno=error); 00038 } 00039 DBUG_RETURN(0); 00040 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int myrg_create | ( | const char * | name, | |
| const char ** | table_names, | |||
| uint | insert_method, | |||
| my_bool | fix_names | |||
| ) |
Definition at line 26 of file myrg_create.c.
References DBUG_ENTER, DBUG_RETURN, err, fn_format(), FN_REFLEN, fn_same(), get_type(), MERGE_INSERT_DISABLED, merge_insert_method, MY_APPEND_EXT, my_close(), my_create(), my_errno, MY_NABP, MY_UNPACK_FILENAME, MY_WME, my_write, MYF, MYRG_NAME_EXT, NullS, O_NOFOLLOW, strend(), strmov(), strxmov(), and VOID.
00028 { 00029 int save_errno; 00030 uint errpos; 00031 File file; 00032 char buff[FN_REFLEN],*end; 00033 DBUG_ENTER("myrg_create"); 00034 00035 errpos=0; 00036 if ((file = my_create(fn_format(buff,name,"",MYRG_NAME_EXT, 00037 MY_UNPACK_FILENAME|MY_APPEND_EXT),0, 00038 O_RDWR | O_EXCL | O_NOFOLLOW,MYF(MY_WME))) < 0) 00039 goto err; 00040 errpos=1; 00041 if (table_names) 00042 { 00043 for ( ; *table_names ; table_names++) 00044 { 00045 strmov(buff,*table_names); 00046 if (fix_names) 00047 fn_same(buff,name,4); 00048 *(end=strend(buff))='\n'; 00049 end[1]=0; 00050 if (my_write(file,buff,(uint) (end-buff+1), 00051 MYF(MY_WME | MY_NABP))) 00052 goto err; 00053 } 00054 } 00055 if (insert_method != MERGE_INSERT_DISABLED) 00056 { 00057 end=strxmov(buff,"#INSERT_METHOD=", 00058 get_type(&merge_insert_method,insert_method-1),"\n",NullS); 00059 if (my_write(file,buff,(uint) (end-buff),MYF(MY_WME | MY_NABP))) 00060 goto err; 00061 } 00062 if (my_close(file,MYF(0))) 00063 goto err; 00064 DBUG_RETURN(0); 00065 00066 err: 00067 save_errno=my_errno ? my_errno : -1; 00068 switch (errpos) { 00069 case 1: 00070 VOID(my_close(file,MYF(0))); 00071 } 00072 DBUG_RETURN(my_errno=save_errno); 00073 } /* myrg_create */
Here is the call graph for this function:

Definition at line 21 of file myrg_delete.c.
References st_myrg_info::current_table, HA_ERR_NO_ACTIVE_RECORD, mi_delete(), my_errno, and st_myrg_table_info::table.
Referenced by ha_myisammrg::delete_row().
00022 { 00023 if (!info->current_table) 00024 return (my_errno= HA_ERR_NO_ACTIVE_RECORD); 00025 00026 return mi_delete(info->current_table->table,record); 00027 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int myrg_extra | ( | MYRG_INFO * | file, | |
| enum ha_extra_function | function, | |||
| void * | extra_arg | |||
| ) |
Definition at line 25 of file myrg_extra.c.
References st_myrg_info::cache_in_use, st_myrg_info::cache_size, st_myrg_info::current_table, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, st_myrg_info::end_table, error, HA_EXTRA_CACHE, HA_EXTRA_NO_CACHE, HA_EXTRA_PREPARE_FOR_UPDATE, HA_EXTRA_RESET_STATE, st_myrg_info::last_used_table, mi_extra(), my_default_record_cache_size, st_myrg_info::open_tables, and st_myrg_table_info::table.
Referenced by ha_myisammrg::extra(), ha_myisammrg::extra_opt(), and ha_myisammrg::open().
00027 { 00028 int error,save_error=0; 00029 MYRG_TABLE *file; 00030 DBUG_ENTER("myrg_extra"); 00031 DBUG_PRINT("info",("function: %d",(ulong) function)); 00032 00033 if (function == HA_EXTRA_CACHE) 00034 { 00035 info->cache_in_use=1; 00036 info->cache_size= (extra_arg ? *(ulong*) extra_arg : 00037 my_default_record_cache_size); 00038 } 00039 else 00040 { 00041 if (function == HA_EXTRA_NO_CACHE || 00042 function == HA_EXTRA_PREPARE_FOR_UPDATE) 00043 info->cache_in_use=0; 00044 if (function == HA_EXTRA_RESET_STATE) 00045 { 00046 info->current_table=0; 00047 info->last_used_table=info->open_tables; 00048 } 00049 for (file=info->open_tables ; file != info->end_table ; file++) 00050 { 00051 if ((error=mi_extra(file->table, function, extra_arg))) 00052 save_error=error; 00053 } 00054 } 00055 DBUG_RETURN(save_error); 00056 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void myrg_extrafunc | ( | MYRG_INFO * | info, | |
| invalidator_by_filename | inv | |||
| ) |
Definition at line 59 of file myrg_extra.c.
References DBUG_ENTER, DBUG_VOID_RETURN, st_myrg_info::end_table, st_mi_isam_share::invalidator, st_myrg_info::open_tables, st_myisam_info::s, and st_myrg_table_info::table.
Referenced by ha_myisammrg::open().
00060 { 00061 MYRG_TABLE *file; 00062 DBUG_ENTER("myrg_extrafunc"); 00063 00064 for (file=info->open_tables ; file != info->end_table ; file++) 00065 file->table->s->invalidator = inv; 00066 00067 DBUG_VOID_RETURN; 00068 }
Here is the caller graph for this function:

| int myrg_lock_database | ( | MYRG_INFO * | file, | |
| int | lock_type | |||
| ) |
Definition at line 23 of file myrg_locking.c.
References st_myrg_info::end_table, error, mi_lock_database(), st_myrg_info::open_tables, and st_myrg_table_info::table.
Referenced by ha_myisammrg::external_lock().
00024 { 00025 int error,new_error; 00026 MYRG_TABLE *file; 00027 00028 error=0; 00029 for (file=info->open_tables ; file != info->end_table ; file++) 00030 if ((new_error=mi_lock_database(file->table,lock_type))) 00031 error=new_error; 00032 return(error); 00033 }
Here is the call graph for this function:

Here is the caller graph for this function:

| MYRG_INFO* myrg_open | ( | const char * | name, | |
| int | mode, | |||
| int | wait_if_locked | |||
| ) |
Definition at line 33 of file myrg_open.c.
References st_mi_isam_share::base, st_myrg_info::by_key, bzero, cleanup_dirname(), st_list::data, st_mi_status_info::data_file_length, st_myrg_info::data_file_length, DBUG_ENTER, DBUG_RETURN, st_myrg_info::del, st_mi_status_info::del, dirname_part(), end_io_cache(), st_myrg_info::end_table, err, st_myrg_table_info::file_offset, files, find_type(), fn_format(), FN_REFLEN, HA_ERR_RECORD_FILE_FULL, HA_ERR_WRONG_MRG_TABLE_DEF, HA_OPEN_WAIT_IF_LOCKED, HA_OPTION_COMPRESS_RECORD, HA_OPTION_READ_ONLY_DATA, has_path(), init_io_cache(), IO_SIZE, st_mi_base_info::key_parts, st_myrg_info::keys, st_mi_base_info::keys, st_myrg_info::last_used_table, LINT_INIT, list_add(), merge_insert_method, st_myrg_info::merge_insert_method, mi_close(), mi_open(), MY_APPEND_EXT, my_b_gets(), my_b_seek(), my_close(), my_errno, my_free, my_malloc(), MY_NABP, my_open(), MY_UNPACK_FILENAME, MY_WME, MY_ZEROFILL, MYF, MYRG_NAME_EXT, myrg_open_list, NULL, O_SHARE, st_myrg_info::open_list, st_myrg_info::open_tables, st_myrg_info::options, st_mi_isam_share::options, pthread_mutex_lock, pthread_mutex_unlock, READ_CACHE, st_myrg_info::rec_per_key_part, st_mi_state_info::rec_per_key_part, st_myrg_info::reclength, st_mi_base_info::reclength, st_myrg_info::records, st_mi_status_info::records, st_myisam_info::s, st_myisam_info::state, st_mi_isam_share::state, strmake(), st_myrg_table_info::table, st_myrg_info::tables, and VOID.
Referenced by ha_myisammrg::open().
00034 { 00035 int save_errno,errpos=0; 00036 uint files=0,i,dir_length,length,key_parts; 00037 ulonglong file_offset=0; 00038 char name_buff[FN_REFLEN*2],buff[FN_REFLEN],*end; 00039 MYRG_INFO *m_info=0; 00040 File fd; 00041 IO_CACHE file; 00042 MI_INFO *isam=0; 00043 uint found_merge_insert_method= 0; 00044 DBUG_ENTER("myrg_open"); 00045 00046 LINT_INIT(key_parts); 00047 00048 bzero((char*) &file,sizeof(file)); 00049 if ((fd=my_open(fn_format(name_buff,name,"",MYRG_NAME_EXT, 00050 MY_UNPACK_FILENAME|MY_APPEND_EXT), 00051 O_RDONLY | O_SHARE,MYF(0))) < 0) 00052 goto err; 00053 errpos=1; 00054 if (init_io_cache(&file, fd, 4*IO_SIZE, READ_CACHE, 0, 0, 00055 MYF(MY_WME | MY_NABP))) 00056 goto err; 00057 errpos=2; 00058 dir_length=dirname_part(name_buff,name); 00059 while ((length=my_b_gets(&file,buff,FN_REFLEN-1))) 00060 { 00061 if ((end=buff+length)[-1] == '\n') 00062 end[-1]='\0'; 00063 if (buff[0] && buff[0] != '#') 00064 files++; 00065 } 00066 00067 my_b_seek(&file, 0); 00068 while ((length=my_b_gets(&file,buff,FN_REFLEN-1))) 00069 { 00070 if ((end=buff+length)[-1] == '\n') 00071 *--end='\0'; 00072 if (!buff[0]) 00073 continue; /* Skip empty lines */ 00074 if (buff[0] == '#') 00075 { 00076 if (!strncmp(buff+1,"INSERT_METHOD=",14)) 00077 { /* Lookup insert method */ 00078 int tmp=find_type(buff+15,&merge_insert_method,2); 00079 found_merge_insert_method = (uint) (tmp >= 0 ? tmp : 0); 00080 } 00081 continue; /* Skip comments */ 00082 } 00083 00084 if (!has_path(buff)) 00085 { 00086 VOID(strmake(name_buff+dir_length,buff, 00087 sizeof(name_buff)-1-dir_length)); 00088 VOID(cleanup_dirname(buff,name_buff)); 00089 } 00090 else 00091 fn_format(buff, buff, "", "", 0); 00092 if (!(isam=mi_open(buff,mode,(handle_locking?HA_OPEN_WAIT_IF_LOCKED:0)))) 00093 goto err; 00094 if (!m_info) /* First file */ 00095 { 00096 key_parts=isam->s->base.key_parts; 00097 if (!(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO) + 00098 files*sizeof(MYRG_TABLE) + 00099 key_parts*sizeof(long), 00100 MYF(MY_WME|MY_ZEROFILL)))) 00101 goto err; 00102 if (files) 00103 { 00104 m_info->open_tables=(MYRG_TABLE *) (m_info+1); 00105 m_info->rec_per_key_part=(ulong *) (m_info->open_tables+files); 00106 m_info->tables= files; 00107 files= 0; 00108 } 00109 m_info->reclength=isam->s->base.reclength; 00110 errpos=3; 00111 } 00112 m_info->open_tables[files].table= isam; 00113 m_info->open_tables[files].file_offset=(my_off_t) file_offset; 00114 file_offset+=isam->state->data_file_length; 00115 files++; 00116 if (m_info->reclength != isam->s->base.reclength) 00117 { 00118 my_errno=HA_ERR_WRONG_MRG_TABLE_DEF; 00119 goto err; 00120 } 00121 m_info->options|= isam->s->options; 00122 m_info->records+= isam->state->records; 00123 m_info->del+= isam->state->del; 00124 m_info->data_file_length+= isam->state->data_file_length; 00125 for (i=0; i < key_parts; i++) 00126 m_info->rec_per_key_part[i]+= (isam->s->state.rec_per_key_part[i] / 00127 m_info->tables); 00128 } 00129 00130 if (!m_info && !(m_info= (MYRG_INFO*) my_malloc(sizeof(MYRG_INFO), 00131 MYF(MY_WME | MY_ZEROFILL)))) 00132 goto err; 00133 /* Don't mark table readonly, for ALTER TABLE ... UNION=(...) to work */ 00134 m_info->options&= ~(HA_OPTION_COMPRESS_RECORD | HA_OPTION_READ_ONLY_DATA); 00135 m_info->merge_insert_method= found_merge_insert_method; 00136 00137 if (sizeof(my_off_t) == 4 && file_offset > (ulonglong) (ulong) ~0L) 00138 { 00139 my_errno=HA_ERR_RECORD_FILE_FULL; 00140 goto err; 00141 } 00142 m_info->keys= files ? isam->s->base.keys : 0; 00143 bzero((char*) &m_info->by_key,sizeof(m_info->by_key)); 00144 00145 /* this works ok if the table list is empty */ 00146 m_info->end_table=m_info->open_tables+files; 00147 m_info->last_used_table=m_info->open_tables; 00148 00149 VOID(my_close(fd,MYF(0))); 00150 end_io_cache(&file); 00151 m_info->open_list.data=(void*) m_info; 00152 pthread_mutex_lock(&THR_LOCK_open); 00153 myrg_open_list=list_add(myrg_open_list,&m_info->open_list); 00154 pthread_mutex_unlock(&THR_LOCK_open); 00155 DBUG_RETURN(m_info); 00156 00157 err: 00158 save_errno=my_errno; 00159 switch (errpos) { 00160 case 3: 00161 while (files) 00162 mi_close(m_info->open_tables[--files].table); 00163 my_free((char*) m_info,MYF(0)); 00164 /* Fall through */ 00165 case 2: 00166 end_io_cache(&file); 00167 /* Fall through */ 00168 case 1: 00169 VOID(my_close(fd,MYF(0))); 00170 } 00171 my_errno=save_errno; 00172 DBUG_RETURN (NULL); 00173 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int myrg_panic | ( | enum ha_panic_function | function | ) |
Definition at line 27 of file myrg_panic.c.
References st_list::data, DBUG_ENTER, DBUG_RETURN, error, HA_PANIC_CLOSE, info, mi_panic(), my_errno, myrg_close(), myrg_open_list, and st_list::next.
Referenced by myisammrg_init().
00028 { 00029 int error=0; 00030 LIST *list_element,*next_open; 00031 MYRG_INFO *info; 00032 DBUG_ENTER("myrg_panic"); 00033 00034 for (list_element=myrg_open_list ; list_element ; list_element=next_open) 00035 { 00036 next_open=list_element->next; /* Save if close */ 00037 info=(MYRG_INFO*) list_element->data; 00038 if (flag == HA_PANIC_CLOSE && myrg_close(info)) 00039 error=my_errno; 00040 } 00041 if (myrg_open_list && flag != HA_PANIC_CLOSE) 00042 DBUG_RETURN(mi_panic(flag)); 00043 if (error) 00044 my_errno=error; 00045 DBUG_RETURN(error); 00046 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 19 of file myrg_info.c.
References st_myrg_info::current_table, st_myrg_info::end_table, st_myrg_table_info::file_offset, st_myisam_info::lastpos, st_myrg_info::open_tables, and st_myrg_table_info::table.
Referenced by ha_myisammrg::position().
00020 { 00021 MYRG_TABLE *current_table; 00022 00023 if (!(current_table = info->current_table) && 00024 info->open_tables != info->end_table) 00025 current_table = info->open_tables; 00026 return current_table ? 00027 current_table->table->lastpos + current_table->file_offset : 00028 ~(ulonglong) 0; 00029 }
Here is the caller graph for this function:

| ha_rows myrg_records_in_range | ( | MYRG_INFO * | info, | |
| int | inx, | |||
| key_range * | min_key, | |||
| key_range * | max_key | |||
| ) |
Definition at line 19 of file myrg_range.c.
References st_myrg_info::end_table, HA_POS_ERROR, mi_records_in_range(), st_myrg_info::open_tables, records, and st_myrg_table_info::table.
Referenced by ha_myisammrg::records_in_range().
00021 { 00022 ha_rows records=0, res; 00023 MYRG_TABLE *table; 00024 00025 for (table=info->open_tables ; table != info->end_table ; table++) 00026 { 00027 res= mi_records_in_range(table->table, inx, min_key, max_key); 00028 if (res == HA_POS_ERROR) 00029 return HA_POS_ERROR; 00030 if (records > HA_POS_ERROR - res) 00031 return HA_POS_ERROR-1; 00032 records+=res; 00033 } 00034 return records; 00035 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int myrg_reset | ( | MYRG_INFO * | info | ) |
Definition at line 71 of file myrg_extra.c.
References st_myrg_info::cache_in_use, st_myrg_info::current_table, DBUG_ENTER, DBUG_RETURN, st_myrg_info::end_table, error, st_myrg_info::last_used_table, mi_reset(), st_myrg_info::open_tables, and st_myrg_table_info::table.
Referenced by ha_myisammrg::reset(), and ha_myisammrg::rnd_init().
00072 { 00073 int save_error= 0; 00074 MYRG_TABLE *file; 00075 DBUG_ENTER("myrg_reset"); 00076 00077 info->cache_in_use=0; 00078 info->current_table=0; 00079 info->last_used_table= info->open_tables; 00080 00081 for (file=info->open_tables ; file != info->end_table ; file++) 00082 { 00083 int error; 00084 if ((error= mi_reset(file->table))) 00085 save_error=error; 00086 } 00087 DBUG_RETURN(save_error); 00088 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 21 of file myrg_rfirst.c.
References _myrg_init_queue(), _myrg_mi_read_record(), st_myrg_info::by_key, st_myrg_info::current_table, st_queue::elements, st_myrg_info::end_table, err, HA_ERR_END_OF_FILE, HA_READ_KEY_OR_NEXT, st_myrg_info::last_used_table, mi_rfirst(), my_errno, NULL, st_myrg_info::open_tables, queue_insert(), queue_top, and st_myrg_table_info::table.
Referenced by ha_myisammrg::index_first().
00022 { 00023 MYRG_TABLE *table; 00024 MI_INFO *mi; 00025 int err; 00026 00027 if (_myrg_init_queue(info,inx,HA_READ_KEY_OR_NEXT)) 00028 return my_errno; 00029 00030 for (table=info->open_tables ; table != info->end_table ; table++) 00031 { 00032 if ((err=mi_rfirst(table->table,NULL,inx))) 00033 { 00034 if (err == HA_ERR_END_OF_FILE) 00035 continue; 00036 return err; 00037 } 00038 /* adding to queue */ 00039 queue_insert(&(info->by_key),(byte *)table); 00040 } 00041 /* We have done a read in all tables */ 00042 info->last_used_table=table; 00043 00044 if (!info->by_key.elements) 00045 return HA_ERR_END_OF_FILE; 00046 00047 mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; 00048 return _myrg_mi_read_record(mi,buf); 00049 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int myrg_rkey | ( | MYRG_INFO * | file, | |
| byte * | buf, | |||
| int | inx, | |||
| const byte * | key, | |||
| uint | key_len, | |||
| enum ha_rkey_function | search_flag | |||
| ) |
Definition at line 39 of file myrg_rkey.c.
References _myrg_init_queue(), _myrg_mi_read_record(), st_mi_isam_share::base, st_myrg_info::by_key, st_myrg_info::current_table, DBUG_DUMP, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, st_queue::elements, st_myrg_info::end_table, err, HA_ERR_KEY_NOT_FOUND, st_myrg_info::last_used_table, st_myisam_info::lastkey, st_myisam_info::lastkey_length, LINT_INIT, st_mi_base_info::max_key_length, mi_rkey(), my_errno, st_myisam_info::once_flags, st_myrg_info::open_tables, st_myisam_info::pack_key_length, queue_insert(), queue_top, RRND_PRESERVE_LASTINX, st_myisam_info::s, st_myrg_table_info::table, and USE_PACKED_KEYS.
Referenced by ha_myisammrg::index_read(), ha_myisammrg::index_read_idx(), and ha_myisammrg::index_read_last().
00041 { 00042 byte *key_buff; 00043 uint pack_key_length; 00044 MYRG_TABLE *table; 00045 MI_INFO *mi; 00046 int err; 00047 DBUG_ENTER("myrg_rkey"); 00048 LINT_INIT(key_buff); 00049 LINT_INIT(pack_key_length); 00050 00051 if (_myrg_init_queue(info,inx,search_flag)) 00052 DBUG_RETURN(my_errno); 00053 00054 for (table=info->open_tables ; table != info->end_table ; table++) 00055 { 00056 mi=table->table; 00057 00058 if (table == info->open_tables) 00059 { 00060 err=mi_rkey(mi,0,inx,key,key_len,search_flag); 00061 /* Get the saved packed key and packed key length. */ 00062 key_buff=(byte*) mi->lastkey+mi->s->base.max_key_length; 00063 pack_key_length=mi->pack_key_length; 00064 } 00065 else 00066 { 00067 mi->once_flags|= USE_PACKED_KEYS; 00068 err=mi_rkey(mi,0,inx,key_buff,pack_key_length,search_flag); 00069 } 00070 info->last_used_table=table+1; 00071 00072 if (err) 00073 { 00074 if (err == HA_ERR_KEY_NOT_FOUND) 00075 continue; 00076 DBUG_PRINT("exit", ("err: %d", err)); 00077 DBUG_RETURN(err); 00078 } 00079 /* adding to queue */ 00080 queue_insert(&(info->by_key),(byte *)table); 00081 00082 } 00083 00084 DBUG_PRINT("info", ("tables with matches: %u", info->by_key.elements)); 00085 if (!info->by_key.elements) 00086 DBUG_RETURN(HA_ERR_KEY_NOT_FOUND); 00087 00088 mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; 00089 mi->once_flags|= RRND_PRESERVE_LASTINX; 00090 DBUG_PRINT("info", ("using table no: %d", 00091 info->current_table - info->open_tables + 1)); 00092 DBUG_DUMP("result key", (byte*) mi->lastkey, mi->lastkey_length); 00093 DBUG_RETURN(_myrg_mi_read_record(mi,buf)); 00094 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 21 of file myrg_rlast.c.
References _myrg_init_queue(), _myrg_mi_read_record(), st_myrg_info::by_key, st_myrg_info::current_table, st_queue::elements, err, HA_ERR_END_OF_FILE, HA_READ_KEY_OR_PREV, st_myrg_info::last_used_table, mi_rlast(), my_errno, NULL, st_myrg_info::open_tables, queue_insert(), queue_top, and st_myrg_table_info::table.
Referenced by ha_myisammrg::index_last().
00022 { 00023 MYRG_TABLE *table; 00024 MI_INFO *mi; 00025 int err; 00026 00027 if (_myrg_init_queue(info,inx, HA_READ_KEY_OR_PREV)) 00028 return my_errno; 00029 00030 for (table=info->open_tables ; table < info->end_table ; table++) 00031 { 00032 if ((err=mi_rlast(table->table,NULL,inx))) 00033 { 00034 if (err == HA_ERR_END_OF_FILE) 00035 continue; 00036 return err; 00037 } 00038 /* adding to queue */ 00039 queue_insert(&(info->by_key),(byte *)table); 00040 } 00041 /* We have done a read in all tables */ 00042 info->last_used_table=table; 00043 00044 if (!info->by_key.elements) 00045 return HA_ERR_END_OF_FILE; 00046 00047 mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; 00048 return _myrg_mi_read_record(mi,buf); 00049 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 23 of file myrg_rnext.c.
References _myrg_mi_read_record(), st_myrg_info::by_key, st_myrg_info::current_table, st_queue::elements, err, HA_ERR_END_OF_FILE, HA_ERR_KEY_NOT_FOUND, mi_rnext(), NULL, queue_remove(), queue_replaced, queue_top, and st_myrg_table_info::table.
Referenced by ha_myisammrg::index_next().
00024 { 00025 int err; 00026 MI_INFO *mi; 00027 00028 if (!info->current_table) 00029 return (HA_ERR_KEY_NOT_FOUND); 00030 00031 /* at first, do rnext for the table found before */ 00032 if ((err=mi_rnext(info->current_table->table,NULL,inx))) 00033 { 00034 if (err == HA_ERR_END_OF_FILE) 00035 { 00036 queue_remove(&(info->by_key),0); 00037 if (!info->by_key.elements) 00038 return HA_ERR_END_OF_FILE; 00039 } 00040 else 00041 return err; 00042 } 00043 else 00044 { 00045 /* Found here, adding to queue */ 00046 queue_top(&(info->by_key))=(byte *)(info->current_table); 00047 queue_replaced(&(info->by_key)); 00048 } 00049 00050 /* now, mymerge's read_next is as simple as one queue_top */ 00051 mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; 00052 return _myrg_mi_read_record(mi,buf); 00053 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 20 of file myrg_rnext_same.c.
References _myrg_mi_read_record(), st_myrg_info::by_key, st_myrg_info::current_table, st_queue::elements, err, HA_ERR_END_OF_FILE, HA_ERR_KEY_NOT_FOUND, mi_rnext_same(), NULL, queue_remove(), queue_replaced, queue_top, and st_myrg_table_info::table.
00021 { 00022 int err; 00023 MI_INFO *mi; 00024 00025 if (!info->current_table) 00026 return (HA_ERR_KEY_NOT_FOUND); 00027 00028 /* at first, do rnext for the table found before */ 00029 if ((err=mi_rnext_same(info->current_table->table,NULL))) 00030 { 00031 if (err == HA_ERR_END_OF_FILE) 00032 { 00033 queue_remove(&(info->by_key),0); 00034 if (!info->by_key.elements) 00035 return HA_ERR_END_OF_FILE; 00036 } 00037 else 00038 return err; 00039 } 00040 else 00041 { 00042 /* Found here, adding to queue */ 00043 queue_top(&(info->by_key))=(byte *)(info->current_table); 00044 queue_replaced(&(info->by_key)); 00045 } 00046 00047 /* now, mymerge's read_next is as simple as one queue_top */ 00048 mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; 00049 return _myrg_mi_read_record(mi,buf); 00050 }
Here is the call graph for this function:

Definition at line 23 of file myrg_rprev.c.
References _myrg_mi_read_record(), st_myrg_info::by_key, st_myrg_info::current_table, st_queue::elements, err, HA_ERR_END_OF_FILE, HA_ERR_KEY_NOT_FOUND, mi_rprev(), NULL, queue_remove(), queue_replaced, queue_top, and st_myrg_table_info::table.
Referenced by ha_myisammrg::index_prev().
00024 { 00025 int err; 00026 MI_INFO *mi; 00027 00028 if (!info->current_table) 00029 return (HA_ERR_KEY_NOT_FOUND); 00030 00031 /* at first, do rprev for the table found before */ 00032 if ((err=mi_rprev(info->current_table->table,NULL,inx))) 00033 { 00034 if (err == HA_ERR_END_OF_FILE) 00035 { 00036 queue_remove(&(info->by_key),0); 00037 if (!info->by_key.elements) 00038 return HA_ERR_END_OF_FILE; 00039 } 00040 else 00041 return err; 00042 } 00043 else 00044 { 00045 /* Found here, adding to queue */ 00046 queue_top(&(info->by_key))=(byte *)(info->current_table); 00047 queue_replaced(&(info->by_key)); 00048 } 00049 00050 /* now, mymerge's read_prev is as simple as one queue_top */ 00051 mi=(info->current_table=(MYRG_TABLE *)queue_top(&(info->by_key)))->table; 00052 return _myrg_mi_read_record(mi,buf); 00053 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 34 of file myrg_rrnd.c.
References st_myrg_info::cache_in_use, st_myrg_info::cache_size, st_myrg_info::current_table, st_mi_status_info::data_file_length, DBUG_ENTER, DBUG_PRINT, DBUG_RETURN, st_myrg_info::end_table, error, st_myrg_table_info::file_offset, find_table(), HA_ERR_END_OF_FILE, HA_EXTRA_CACHE, HA_EXTRA_NO_CACHE, HA_OFFSET_ERROR, HA_STATE_CHANGED, st_mi_isam_pack::header_length, st_myrg_info::last_used_table, st_myisam_info::lastinx, mi_extra(), my_errno, st_myisam_info::nextpos, st_myrg_info::open_tables, st_mi_isam_share::pack, st_mi_isam_share::read_rnd, st_myisam_info::s, st_myisam_info::state, st_myrg_table_info::table, and st_myisam_info::update.
Referenced by ha_myisammrg::rnd_next(), and ha_myisammrg::rnd_pos().
00035 { 00036 int error; 00037 MI_INFO *isam_info; 00038 DBUG_ENTER("myrg_rrnd"); 00039 DBUG_PRINT("info",("offset: %lu", (ulong) filepos)); 00040 00041 if (filepos == HA_OFFSET_ERROR) 00042 { 00043 if (!info->current_table) 00044 { 00045 if (info->open_tables == info->end_table) 00046 { /* No tables */ 00047 DBUG_RETURN(my_errno=HA_ERR_END_OF_FILE); 00048 } 00049 isam_info=(info->current_table=info->open_tables)->table; 00050 if (info->cache_in_use) 00051 mi_extra(isam_info,HA_EXTRA_CACHE,(byte*) &info->cache_size); 00052 filepos=isam_info->s->pack.header_length; 00053 isam_info->lastinx= (uint) -1; /* Can't forward or backward */ 00054 } 00055 else 00056 { 00057 isam_info=info->current_table->table; 00058 filepos= isam_info->nextpos; 00059 } 00060 00061 for (;;) 00062 { 00063 isam_info->update&= HA_STATE_CHANGED; 00064 if ((error=(*isam_info->s->read_rnd)(isam_info,(byte*) buf, 00065 (my_off_t) filepos,1)) != 00066 HA_ERR_END_OF_FILE) 00067 DBUG_RETURN(error); 00068 if (info->cache_in_use) 00069 mi_extra(info->current_table->table, HA_EXTRA_NO_CACHE, 00070 (byte*) &info->cache_size); 00071 if (info->current_table+1 == info->end_table) 00072 DBUG_RETURN(HA_ERR_END_OF_FILE); 00073 info->current_table++; 00074 info->last_used_table=info->current_table; 00075 if (info->cache_in_use) 00076 mi_extra(info->current_table->table, HA_EXTRA_CACHE, 00077 (byte*) &info->cache_size); 00078 info->current_table->file_offset= 00079 info->current_table[-1].file_offset+ 00080 info->current_table[-1].table->state->data_file_length; 00081 00082 isam_info=info->current_table->table; 00083 filepos=isam_info->s->pack.header_length; 00084 isam_info->lastinx= (uint) -1; 00085 } 00086 } 00087 info->current_table=find_table(info->open_tables, 00088 info->end_table-1,filepos); 00089 isam_info=info->current_table->table; 00090 isam_info->update&= HA_STATE_CHANGED; 00091 DBUG_RETURN((*isam_info->s->read_rnd) 00092 (isam_info, (byte*) buf, 00093 (my_off_t) (filepos - info->current_table->file_offset), 00094 0)); 00095 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 19 of file myrg_rsame.c.
References st_myrg_info::current_table, HA_ERR_NO_ACTIVE_RECORD, HA_ERR_WRONG_INDEX, mi_rsame(), my_errno, and st_myrg_table_info::table.
00020 { 00021 if (inx) /* not yet used, should be 0 */ 00022 return (my_errno=HA_ERR_WRONG_INDEX); 00023 00024 if (!info->current_table) 00025 return (my_errno=HA_ERR_NO_ACTIVE_RECORD); 00026 00027 return mi_rsame(info->current_table->table,record,inx); 00028 }
Here is the call graph for this function:

| int myrg_status | ( | MYRG_INFO * | file, | |
| MYMERGE_INFO * | x, | |||
| int | flag | |||
| ) |
Definition at line 29 of file myrg_static.c.
Referenced by ha_myisammrg::append_create_info(), myrg_create(), and myrg_open().
1.4.7

