ha_myisam Class Reference

#include <ha_myisam.h>

Inheritance diagram for ha_myisam:

Inheritance graph
[legend]
Collaboration diagram for ha_myisam:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ha_myisam (TABLE *table)
 ~ha_myisam ()
const char * table_type () const
const char * index_type (uint key_number)
const char ** bas_ext () const
ulong table_flags () const
ulong index_flags (uint inx, uint part, bool all_parts) const
uint max_supported_keys () const
uint max_supported_key_length () const
uint max_supported_key_part_length () const
uint checksum () const
int open (const char *name, int mode, uint test_if_locked)
int close (void)
int write_row (byte *buf)
int update_row (const byte *old_data, byte *new_data)
int delete_row (const byte *buf)
int index_read (byte *buf, const byte *key, uint key_len, enum ha_rkey_function find_flag)
int index_read_idx (byte *buf, uint idx, const byte *key, uint key_len, enum ha_rkey_function find_flag)
int index_read_last (byte *buf, const byte *key, uint key_len)
int index_next (byte *buf)
int index_prev (byte *buf)
int index_first (byte *buf)
int index_last (byte *buf)
int index_next_same (byte *buf, const byte *key, uint keylen)
int ft_init ()
FT_INFOft_init_ext (uint flags, uint inx, const byte *key, uint keylen)
int ft_read (byte *buf)
int rnd_init (bool scan)
int rnd_next (byte *buf)
int rnd_pos (byte *buf, byte *pos)
int restart_rnd_next (byte *buf, byte *pos)
void position (const byte *record)
void info (uint)
int extra (enum ha_extra_function operation)
int extra_opt (enum ha_extra_function operation, ulong cache_size)
int external_lock (THD *thd, int lock_type)
int delete_all_rows (void)
int disable_indexes (uint mode)
int enable_indexes (uint mode)
int indexes_are_disabled (void)
void start_bulk_insert (ha_rows rows)
int end_bulk_insert ()
ha_rows records_in_range (uint inx, key_range *min_key, key_range *max_key)
void update_create_info (HA_CREATE_INFO *create_info)
int create (const char *name, TABLE *form, HA_CREATE_INFO *create_info)
THR_LOCK_DATA ** store_lock (THD *thd, THR_LOCK_DATA **to, enum thr_lock_type lock_type)
ulonglong get_auto_increment ()
int rename_table (const char *from, const char *to)
int delete_table (const char *name)
int check (THD *thd, HA_CHECK_OPT *check_opt)
int analyze (THD *thd, HA_CHECK_OPT *check_opt)
int repair (THD *thd, HA_CHECK_OPT *check_opt)
bool check_and_repair (THD *thd)
bool is_crashed () const
bool auto_repair () const
int optimize (THD *thd, HA_CHECK_OPT *check_opt)
int restore (THD *thd, HA_CHECK_OPT *check_opt)
int backup (THD *thd, HA_CHECK_OPT *check_opt)
int assign_to_keycache (THD *thd, HA_CHECK_OPT *check_opt)
int preload_keys (THD *thd, HA_CHECK_OPT *check_opt)

Private Member Functions

int repair (THD *thd, MI_CHECK &param, bool optimize)

Private Attributes

MI_INFOfile
ulong int_table_flags
char * data_file_name
char * index_file_name
bool can_enable_indexes

Constructor & Destructor Documentation

ha_myisam::ha_myisam TABLE table  )  [inline]
 

00046                          : handler(table), file(0),
00047     int_table_flags(HA_NULL_IN_KEY | HA_CAN_FULLTEXT | HA_CAN_SQL_HANDLER |
00048                     HA_DUPP_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
00049                     HA_FILE_BASED | HA_CAN_GEOMETRY | HA_READ_RND_SAME |
00050                     HA_CAN_INSERT_DELAYED),
00051     can_enable_indexes(1)
00052   {}

ha_myisam::~ha_myisam  )  [inline]
 

00053 {}


Member Function Documentation

int ha_myisam::analyze THD thd,
HA_CHECK_OPT check_opt
[virtual]
 

Reimplemented from handler.

00358 {
00359   int error=0;
00360   MI_CHECK param;
00361   MYISAM_SHARE* share = file->s;
00362 
00363   myisamchk_init(&param);
00364   param.thd = thd;
00365   param.op_name = (char*) "analyze";
00366   param.db_name    = table->table_cache_key;
00367   param.table_name = table->table_name;
00368   param.testflag=(T_FAST | T_CHECK | T_SILENT | T_STATISTICS |
00369                   T_DONT_CHECK_CHECKSUM);
00370   param.using_global_keycache = 1;
00371 
00372   if (!(share->state.changed & STATE_NOT_ANALYZED))
00373     return HA_ADMIN_ALREADY_DONE;
00374 
00375   error = chk_key(&param, file);
00376   if (!error)
00377   {
00378     pthread_mutex_lock(&share->intern_lock);
00379     error=update_state_info(&param,file,UPDATE_STAT);
00380     pthread_mutex_unlock(&share->intern_lock);
00381   }
00382   else if (!mi_is_crashed(file) && !thd->killed)
00383     mi_mark_crashed(file);
00384   return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK;
00385 }

int ha_myisam::assign_to_keycache THD thd,
HA_CHECK_OPT check_opt
[virtual]
 

Reimplemented from handler.

00705 {
00706   KEY_CACHE *new_key_cache= check_opt->key_cache;
00707   const char *errmsg= 0;
00708   int error= HA_ADMIN_OK;
00709   ulonglong map= ~(ulonglong) 0;
00710   TABLE_LIST *table_list= table->pos_in_table_list;
00711   DBUG_ENTER("ha_myisam::assign_to_keycache");
00712 
00713   /* Check validity of the index references */
00714   if (table_list->use_index)
00715   {
00716     /* We only come here when the user did specify an index map */
00717     key_map kmap;
00718     if (get_key_map_from_key_list(&kmap, table, table_list->use_index))
00719     {
00720       errmsg= thd->net.last_error;
00721       error= HA_ADMIN_FAILED;
00722       goto err;
00723     }
00724     map= kmap.to_ulonglong();
00725   }
00726 
00727   if ((error= mi_assign_to_key_cache(file, map, new_key_cache)))
00728   { 
00729     char buf[80];
00730     my_snprintf(buf, sizeof(buf),
00731                 "Failed to flush to index file (errno: %d)", error);
00732     errmsg= buf;
00733     error= HA_ADMIN_CORRUPT;
00734   }
00735 
00736  err:
00737   if (error != HA_ADMIN_OK)
00738   {
00739     /* Send error to user */
00740     MI_CHECK param;
00741     myisamchk_init(&param);
00742     param.thd= thd;
00743     param.op_name= (char*)"assign_to_keycache";
00744     param.db_name= table->table_cache_key;
00745     param.table_name= table->table_name;
00746     param.testflag= 0;
00747     mi_check_print_error(&param, errmsg);
00748   }
00749   DBUG_RETURN(error);
00750 }

bool ha_myisam::auto_repair  )  const [inline, virtual]
 

Reimplemented from handler.

00122 { return myisam_recover_options != 0; }

int ha_myisam::backup THD thd,
HA_CHECK_OPT check_opt
[virtual]
 

Reimplemented from handler.

00430 {
00431   char* backup_dir= thd->lex->backup_dir;
00432   char src_path[FN_REFLEN], dst_path[FN_REFLEN];
00433   char* table_name = table->real_name;
00434   int error;
00435   const char *errmsg;
00436   DBUG_ENTER("ha_myisam::backup");
00437 
00438   if (fn_format_relative_to_data_home(dst_path, table_name, backup_dir,
00439                                       reg_ext))
00440   {
00441     errmsg = "Failed in fn_format() for .frm file (errno: %d)";
00442     error = HA_ADMIN_INVALID;
00443     goto err;
00444   }
00445 
00446   if (my_copy(fn_format(src_path, table->path,"", reg_ext, MY_UNPACK_FILENAME),
00447               dst_path,
00448               MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
00449   {
00450     error = HA_ADMIN_FAILED;
00451     errmsg = "Failed copying .frm file (errno: %d)";
00452     goto err;
00453   }
00454 
00455   /* Change extension */
00456   if (!fn_format(dst_path, dst_path, "", MI_NAME_DEXT,
00457                  MY_REPLACE_EXT | MY_UNPACK_FILENAME | MY_SAFE_PATH))
00458   {
00459     errmsg = "Failed in fn_format() for .MYD file (errno: %d)";
00460     error = HA_ADMIN_INVALID;
00461     goto err;
00462   }
00463 
00464   if (my_copy(fn_format(src_path, table->path,"", MI_NAME_DEXT,
00465                         MY_UNPACK_FILENAME),
00466               dst_path,
00467               MYF(MY_WME | MY_HOLD_ORIGINAL_MODES | MY_DONT_OVERWRITE_FILE)))
00468   {
00469     errmsg = "Failed copying .MYD file (errno: %d)";
00470     error= HA_ADMIN_FAILED;
00471     goto err;
00472   }
00473   DBUG_RETURN(HA_ADMIN_OK);
00474 
00475  err:
00476   {
00477     MI_CHECK param;
00478     myisamchk_init(&param);
00479     param.thd = thd;
00480     param.op_name = (char*)"backup";
00481     param.db_name    = table->table_cache_key;
00482     param.table_name = table->table_name;
00483     param.testflag = 0;
00484     mi_check_print_error(&param,errmsg, my_errno);
00485     DBUG_RETURN(error);
00486   }
00487 }

const char ** ha_myisam::bas_ext  )  const [virtual]
 

Implements handler.

00127 { static const char *ext[]= { ".MYI",".MYD", NullS }; return ext; }

int ha_myisam::check THD thd,
HA_CHECK_OPT check_opt
[virtual]
 

Reimplemented from handler.

00268 {
00269   if (!file) return HA_ADMIN_INTERNAL_ERROR;
00270   int error;
00271   MI_CHECK param;
00272   MYISAM_SHARE* share = file->s;
00273   const char *old_proc_info=thd->proc_info;
00274 
00275   thd->proc_info="Checking table";
00276   myisamchk_init(&param);
00277   param.thd = thd;
00278   param.op_name = (char*)"check";
00279   param.db_name    = table->table_cache_key;
00280   param.table_name = table->table_name;
00281   param.testflag = check_opt->flags | T_CHECK | T_SILENT;
00282 
00283   if (!(table->db_stat & HA_READ_ONLY))
00284     param.testflag|= T_STATISTICS;
00285   param.using_global_keycache = 1;
00286 
00287   if (!mi_is_crashed(file) &&
00288       (((param.testflag & T_CHECK_ONLY_CHANGED) &&
00289         !(share->state.changed & (STATE_CHANGED | STATE_CRASHED |
00290                                   STATE_CRASHED_ON_REPAIR)) &&
00291         share->state.open_count == 0) ||
00292        ((param.testflag & T_FAST) && (share->state.open_count ==
00293                                       (uint) (share->global_changed ? 1 : 0)))))
00294     return HA_ADMIN_ALREADY_DONE;
00295 
00296   error = chk_status(&param, file);             // Not fatal
00297   error = chk_size(&param, file);
00298   if (!error)
00299     error |= chk_del(&param, file, param.testflag);
00300   if (!error)
00301     error = chk_key(&param, file);
00302   if (!error)
00303   {
00304     if ((!(param.testflag & T_QUICK) &&
00305          ((share->options &
00306            (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ||
00307           (param.testflag & (T_EXTEND | T_MEDIUM)))) ||
00308         mi_is_crashed(file))
00309     {
00310       uint old_testflag=param.testflag;
00311       param.testflag|=T_MEDIUM;
00312       init_io_cache(&param.read_cache, file->dfile,
00313                     my_default_record_cache_size, READ_CACHE,
00314                     share->pack.header_length, 1, MYF(MY_WME));
00315       error |= chk_data_link(&param, file, param.testflag & T_EXTEND);
00316       end_io_cache(&(param.read_cache));
00317       param.testflag=old_testflag;
00318     }
00319   }
00320   if (!error)
00321   {
00322     if ((share->state.changed & (STATE_CHANGED |
00323                                  STATE_CRASHED_ON_REPAIR |
00324                                  STATE_CRASHED | STATE_NOT_ANALYZED)) ||
00325         (param.testflag & T_STATISTICS) ||
00326         mi_is_crashed(file))
00327     {
00328       file->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
00329       pthread_mutex_lock(&share->intern_lock);
00330       share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
00331                                STATE_CRASHED_ON_REPAIR);
00332       if (!(table->db_stat & HA_READ_ONLY))
00333         error=update_state_info(&param,file,UPDATE_TIME | UPDATE_OPEN_COUNT |
00334                                 UPDATE_STAT);
00335       pthread_mutex_unlock(&share->intern_lock);
00336       info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
00337            HA_STATUS_CONST);
00338     }
00339   }
00340   else if (!mi_is_crashed(file) && !thd->killed)
00341   {
00342     mi_mark_crashed(file);
00343     file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
00344   }
00345 
00346   thd->proc_info=old_proc_info;
00347   return error ? HA_ADMIN_CORRUPT : HA_ADMIN_OK;
00348 }

bool ha_myisam::check_and_repair THD thd  )  [virtual]
 

Reimplemented from handler.

01039 {
01040   int error=0;
01041   int marked_crashed;
01042   char *old_query;
01043   uint old_query_length;
01044   HA_CHECK_OPT check_opt;
01045   DBUG_ENTER("ha_myisam::check_and_repair");
01046 
01047   check_opt.init();
01048   check_opt.flags= T_MEDIUM | T_AUTO_REPAIR;
01049   // Don't use quick if deleted rows
01050   if (!file->state->del && (myisam_recover_options & HA_RECOVER_QUICK))
01051     check_opt.flags|=T_QUICK;
01052   sql_print_warning("Checking table:   '%s'",table->path);
01053 
01054   old_query= thd->query;
01055   old_query_length= thd->query_length;
01056   pthread_mutex_lock(&LOCK_thread_count);
01057   thd->query= table->real_name;
01058   thd->query_length= strlen(table->real_name);
01059   pthread_mutex_unlock(&LOCK_thread_count);
01060 
01061   if ((marked_crashed= mi_is_crashed(file)) || check(thd, &check_opt))
01062   {
01063     sql_print_warning("Recovering table: '%s'",table->path);
01064     check_opt.flags=
01065       ((myisam_recover_options & HA_RECOVER_BACKUP ? T_BACKUP_DATA : 0) |
01066        (marked_crashed                             ? 0 : T_QUICK) |
01067        (myisam_recover_options & HA_RECOVER_FORCE  ? 0 : T_SAFE_REPAIR) |
01068        T_AUTO_REPAIR);
01069     if (repair(thd, &check_opt))
01070       error=1;
01071   }
01072   pthread_mutex_lock(&LOCK_thread_count);
01073   thd->query= old_query;
01074   thd->query_length= old_query_length;
01075   pthread_mutex_unlock(&LOCK_thread_count);
01076   DBUG_RETURN(error);
01077 }

uint ha_myisam::checksum  )  const [virtual]
 

Reimplemented from handler.

01627 {
01628   return (uint)file->s->state.checksum;
01629 }

int ha_myisam::close void   )  [virtual]
 

Implements handler.

00244 {
00245   MI_INFO *tmp=file;
00246   file=0;
00247   return mi_close(tmp);
00248 }

int ha_myisam::create const char *  name,
TABLE form,
HA_CREATE_INFO create_info
[virtual]
 

Implements handler.

int ha_myisam::delete_all_rows void   )  [virtual]
 

Reimplemented from handler.

01299 {
01300   return mi_delete_all_rows(file);
01301 }

int ha_myisam::delete_row const byte buf  )  [virtual]
 

Reimplemented from handler.

01094 {
01095   statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
01096   return mi_delete(file,buf);
01097 }

int ha_myisam::delete_table const char *  name  )  [virtual]
 

Reimplemented from handler.

01304 {
01305   return mi_delete_table(name);
01306 }

int ha_myisam::disable_indexes uint  mode  )  [virtual]
 

Reimplemented from handler.

00842 {
00843   int error;
00844 
00845   if (mode == HA_KEY_SWITCH_ALL)
00846   {
00847     /* call a storage engine function to switch the key map */
00848     error= mi_disable_indexes(file);
00849   }
00850   else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
00851   {
00852     mi_extra(file, HA_EXTRA_NO_KEYS, 0);
00853     info(HA_STATUS_CONST);                        // Read new key info
00854     error= 0;
00855   }
00856   else
00857   {
00858     /* mode not implemented */
00859     error= HA_ERR_WRONG_COMMAND;
00860   }
00861   return error;
00862 }

int ha_myisam::enable_indexes uint  mode  )  [virtual]
 

Reimplemented from handler.

00894 {
00895   int error;
00896 
00897   if (file->s->state.key_map == set_bits(ulonglong, file->s->base.keys))
00898   {
00899     /* All indexes are enabled already. */
00900     return 0;
00901   }
00902 
00903   if (mode == HA_KEY_SWITCH_ALL)
00904   {
00905     error= mi_enable_indexes(file);
00906     /*
00907        Do not try to repair on error,
00908        as this could make the enabled state persistent,
00909        but mode==HA_KEY_SWITCH_ALL forbids it.
00910     */
00911   }
00912   else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE)
00913   {
00914     THD *thd=current_thd;
00915     MI_CHECK param;
00916     const char *save_proc_info=thd->proc_info;
00917     thd->proc_info="Creating index";
00918     myisamchk_init(&param);
00919     param.op_name = (char*) "recreating_index";
00920     param.testflag = (T_SILENT | T_REP_BY_SORT | T_QUICK |
00921                       T_CREATE_MISSING_KEYS);
00922     param.myf_rw&= ~MY_WAIT_IF_FULL;
00923     param.sort_buffer_length=  thd->variables.myisam_sort_buff_size;
00924     param.tmpdir=&mysql_tmpdir_list;
00925     if ((error= (repair(thd,param,0) != HA_ADMIN_OK)) && param.retry_repair)
00926     {
00927       sql_print_warning("Warning: Enabling keys got errno %d, retrying",
00928                         my_errno);
00929       param.testflag&= ~(T_REP_BY_SORT | T_QUICK);
00930       error= (repair(thd,param,0) != HA_ADMIN_OK);
00931     }
00932     info(HA_STATUS_CONST);
00933     thd->proc_info=save_proc_info;
00934   }
00935   else
00936   {
00937     /* mode not implemented */
00938     error= HA_ERR_WRONG_COMMAND;
00939   }
00940   return error;
00941 }

int ha_myisam::end_bulk_insert  )  [virtual]
 

Reimplemented from handler.

01030 {
01031   mi_end_bulk_insert(file);
01032   int err=mi_extra(file, HA_EXTRA_NO_CACHE, 0);
01033   return err ? err : can_enable_indexes ?
01034                      enable_indexes(HA_KEY_SWITCH_NONUNIQ_SAVE) : 0;
01035 }

int ha_myisam::external_lock THD thd,
int  lock_type
[virtual]
 

Implements handler.

01310 {
01311   return mi_lock_database(file, !table->tmp_table ?
01312                           lock_type : ((lock_type == F_UNLCK) ?
01313                                        F_UNLCK : F_EXTRA_LCK));
01314 }

int ha_myisam::extra enum ha_extra_function  operation  )  [virtual]
 

Reimplemented from handler.

01282 {
01283   if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_KEYREAD)
01284     return 0;
01285   return mi_extra(file, operation, 0);
01286 }

int ha_myisam::extra_opt enum ha_extra_function  operation,
ulong  cache_size
[virtual]
 

Reimplemented from handler.

01292 {
01293   if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_WRITE_CACHE)
01294     return 0;
01295   return mi_extra(file, operation, (void*) &cache_size);
01296 }

int ha_myisam::ft_init  )  [inline, virtual]
 

Reimplemented from handler.

00085   {
00086     if (!ft_handler)
00087       return 1;
00088     ft_handler->please->reinit_search(ft_handler);
00089     return 0;
00090   }

FT_INFO* ha_myisam::ft_init_ext uint  flags,
uint  inx,
const byte key,
uint  keylen
[inline, virtual]
 

Reimplemented from handler.

00092   { return ft_init_search(flags,file,inx,(byte*) key,keylen, table->record[0]); }

int ha_myisam::ft_read byte buf  )  [virtual]
 

Reimplemented from handler.

01611 {
01612   int error;
01613 
01614   if (!ft_handler)
01615     return -1;
01616 
01617   thread_safe_increment(table->in_use->status_var.ha_read_next_count,
01618                         &LOCK_status); // why ?
01619 
01620   error=ft_handler->please->read_next(ft_handler,(char*) buf);
01621 
01622   table->status=error ? STATUS_NOT_FOUND: 0;
01623   return error;
01624 }

ulonglong ha_myisam::get_auto_increment  )  [virtual]
 

Reimplemented from handler.

01548 {
01549   ulonglong nr;
01550   int error;
01551   byte key[MI_MAX_KEY_LENGTH];
01552 
01553   if (!table->next_number_key_offset)
01554   {                                             // Autoincrement at key-start
01555     ha_myisam::info(HA_STATUS_AUTO);
01556     return auto_increment_value;
01557   }
01558 
01559   /* it's safe to call the following if bulk_insert isn't on */
01560   mi_flush_bulk_insert(file, table->next_number_index);
01561 
01562   (void) extra(HA_EXTRA_KEYREAD);
01563   key_copy(key, table->record[0],
01564            table->key_info + table->next_number_index,
01565            table->next_number_key_offset);
01566   error=mi_rkey(file,table->record[1],(int) table->next_number_index,
01567                 key,table->next_number_key_offset,HA_READ_PREFIX_LAST);
01568   if (error)
01569     nr= 1;
01570   else
01571     nr= ((ulonglong) table->next_number_field->
01572          val_int_offset(table->rec_buff_length)+1);
01573   extra(HA_EXTRA_NO_KEYREAD);
01574   return nr;
01575 }

int ha_myisam::index_first byte buf  )  [virtual]
 

Reimplemented from handler.

01151 {
01152   DBUG_ASSERT(inited==INDEX);
01153   statistic_increment(table->in_use->status_var.ha_read_first_count,
01154                       &LOCK_status);
01155   int error=mi_rfirst(file, buf, active_index);
01156   table->status=error ? STATUS_NOT_FOUND: 0;
01157   return error;
01158 }

ulong ha_myisam::index_flags uint  inx,
uint  part,
bool  all_parts
const [inline, virtual]
 

Implements handler.

00059   {
00060     return ((table->key_info[inx].algorithm == HA_KEY_ALG_FULLTEXT) ?
00061             0 : HA_READ_NEXT | HA_READ_PREV | HA_READ_RANGE |
00062             HA_READ_ORDER | HA_KEYREAD_ONLY);
00063   }

int ha_myisam::index_last byte buf  )  [virtual]
 

Reimplemented from handler.

01161 {
01162   DBUG_ASSERT(inited==INDEX);
01163   statistic_increment(table->in_use->status_var.ha_read_last_count,
01164                       &LOCK_status);
01165   int error=mi_rlast(file, buf, active_index);
01166   table->status=error ? STATUS_NOT_FOUND: 0;
01167   return error;
01168 }

int ha_myisam::index_next byte buf  )  [virtual]
 

Reimplemented from handler.

01131 {
01132   DBUG_ASSERT(inited==INDEX);
01133   statistic_increment(table->in_use->status_var.ha_read_next_count,
01134                       &LOCK_status);
01135   int error=mi_rnext(file,buf,active_index);
01136   table->status=error ? STATUS_NOT_FOUND: 0;
01137   return error;
01138 }

int ha_myisam::index_next_same byte buf,
const byte key,
uint  keylen
[virtual]
 

Reimplemented from handler.

int ha_myisam::index_prev byte buf  )  [virtual]
 

Reimplemented from handler.

01141 {
01142   DBUG_ASSERT(inited==INDEX);
01143   statistic_increment(table->in_use->status_var.ha_read_prev_count,
01144                       &LOCK_status);
01145   int error=mi_rprev(file,buf, active_index);
01146   table->status=error ? STATUS_NOT_FOUND: 0;
01147   return error;
01148 }

int ha_myisam::index_read byte buf,
const byte key,
uint  key_len,
enum ha_rkey_function  find_flag
[virtual]
 

Reimplemented from handler.

01101 {
01102   DBUG_ASSERT(inited==INDEX);
01103   statistic_increment(table->in_use->status_var.ha_read_key_count,
01104                       &LOCK_status);
01105   int error=mi_rkey(file,buf,active_index, key, key_len, find_flag);
01106   table->status=error ? STATUS_NOT_FOUND: 0;
01107   return error;
01108 }

int ha_myisam::index_read_idx byte buf,
uint  idx,
const byte key,
uint  key_len,
enum ha_rkey_function  find_flag
[virtual]
 

Reimplemented from handler.

01112 {
01113   statistic_increment(table->in_use->status_var.ha_read_key_count,
01114                       &LOCK_status);
01115   int error=mi_rkey(file,buf,index, key, key_len, find_flag);
01116   table->status=error ? STATUS_NOT_FOUND: 0;
01117   return error;
01118 }

int ha_myisam::index_read_last byte buf,
const byte key,
uint  key_len
[virtual]
 

Reimplemented from handler.

01121 {
01122   DBUG_ASSERT(inited==INDEX);
01123   statistic_increment(table->in_use->status_var.ha_read_key_count,
01124                       &LOCK_status);
01125   int error=mi_rkey(file,buf,active_index, key, key_len, HA_READ_PREFIX_LAST);
01126   table->status=error ? STATUS_NOT_FOUND: 0;
01127   return error;
01128 }

const char * ha_myisam::index_type uint  key_number  )  [virtual]
 

Reimplemented from handler.

00131 {
00132   return ((table->key_info[key_number].flags & HA_FULLTEXT) ? 
00133           "FULLTEXT" :
00134           (table->key_info[key_number].flags & HA_SPATIAL) ?
00135           "SPATIAL" :
00136           (table->key_info[key_number].algorithm == HA_KEY_ALG_RTREE) ?
00137           "RTREE" :
00138           "BTREE");
00139 }

int ha_myisam::indexes_are_disabled void   )  [virtual]
 

Reimplemented from handler.

00960 {
00961   
00962   return mi_indexes_are_disabled(file);
00963 }

void ha_myisam::info uint   )  [virtual]
 

Implements handler.

01220 {
01221   MI_ISAMINFO info;
01222   char name_buff[FN_REFLEN];
01223 
01224   (void) mi_status(file,&info,flag);
01225   if (flag & HA_STATUS_VARIABLE)
01226   {
01227     records = info.records;
01228     deleted = info.deleted;
01229     data_file_length=info.data_file_length;
01230     index_file_length=info.index_file_length;
01231     delete_length = info.delete_length;
01232     check_time  = info.check_time;
01233     mean_rec_length=info.mean_reclength;
01234   }
01235   if (flag & HA_STATUS_CONST)
01236   {
01237     max_data_file_length=info.max_data_file_length;
01238     max_index_file_length=info.max_index_file_length;
01239     create_time = info.create_time;
01240     sortkey = info.sortkey;
01241     ref_length=info.reflength;
01242     table->db_options_in_use    = info.options;
01243     block_size=myisam_block_size;
01244     table->keys_in_use.set_prefix(table->keys);
01245     table->keys_in_use.intersect(info.key_map);
01246     table->keys_for_keyread= table->keys_in_use;
01247     table->keys_for_keyread.subtract(table->read_only_keys);
01248     table->db_record_offset=info.record_offset;
01249     if (table->key_parts)
01250       memcpy((char*) table->key_info[0].rec_per_key,
01251              (char*) info.rec_per_key,
01252              sizeof(table->key_info[0].rec_per_key)*table->key_parts);
01253     raid_type=info.raid_type;
01254     raid_chunks=info.raid_chunks;
01255     raid_chunksize=info.raid_chunksize;
01256 
01257    /*
01258      Set data_file_name and index_file_name to point at the symlink value
01259      if table is symlinked (Ie;  Real name is not same as generated name)
01260    */
01261     data_file_name=index_file_name=0;
01262     fn_format(name_buff, file->filename, "", MI_NAME_DEXT, 2);
01263     if (strcmp(name_buff, info.data_file_name))
01264       data_file_name=info.data_file_name;
01265     strmov(fn_ext(name_buff),MI_NAME_IEXT);
01266     if (strcmp(name_buff, info.index_file_name))
01267       index_file_name=info.index_file_name;
01268   }
01269   if (flag & HA_STATUS_ERRKEY)
01270   {
01271     errkey  = info.errkey;
01272     my_store_ptr(dupp_ref, ref_length, info.dupp_key_pos);
01273   }
01274   if (flag & HA_STATUS_TIME)
01275     update_time = info.update_time;
01276   if (flag & HA_STATUS_AUTO)
01277     auto_increment_value= info.auto_increment;
01278 }

bool ha_myisam::is_crashed  )  const [virtual]
 

Reimplemented from handler.

01080 {
01081   return (file->s->state.changed & STATE_CRASHED ||
01082           (my_disable_locking && file->s->state.open_count));
01083 }

uint ha_myisam::max_supported_key_length  )  const [inline, virtual]
 

Reimplemented from handler.

00065 { return MI_MAX_KEY_LENGTH; }

uint ha_myisam::max_supported_key_part_length  )  const [inline, virtual]
 

Reimplemented from handler.

00066 { return MI_MAX_KEY_LENGTH; }

uint ha_myisam::max_supported_keys  )  const [inline, virtual]
 

Reimplemented from handler.

00064 { return MI_MAX_KEY; }

int ha_myisam::open const char *  name,
int  mode,
uint  test_if_locked
[virtual]
 

Implements handler.

00227 {
00228   if (!(file=mi_open(name, mode, test_if_locked)))
00229     return (my_errno ? my_errno : -1);
00230   
00231   if (test_if_locked & (HA_OPEN_IGNORE_IF_LOCKED | HA_OPEN_TMP_TABLE))
00232     VOID(mi_extra(file, HA_EXTRA_NO_WAIT_LOCK, 0));
00233   info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
00234   if (!(test_if_locked & HA_OPEN_WAIT_IF_LOCKED))
00235     VOID(mi_extra(file, HA_EXTRA_WAIT_LOCK, 0));
00236   if (!table->db_record_offset)
00237     int_table_flags|=HA_REC_NOT_IN_SEQ;
00238   if (file->s->options & (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))
00239     int_table_flags|=HA_HAS_CHECKSUM;
00240   return (0);
00241 }

int ha_myisam::optimize THD thd,
HA_CHECK_OPT check_opt
[virtual]
 

Reimplemented from handler.

00540 {
00541   int error;
00542   if (!file) return HA_ADMIN_INTERNAL_ERROR;
00543   MI_CHECK param;
00544 
00545   myisamchk_init(&param);
00546   param.thd = thd;
00547   param.op_name = (char*) "optimize";
00548   param.testflag = (check_opt->flags | T_SILENT | T_FORCE_CREATE |
00549                     T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX);
00550   param.sort_buffer_length=  check_opt->sort_buffer_size;
00551   if ((error= repair(thd,param,1)) && param.retry_repair)
00552   {
00553     sql_print_warning("Warning: Optimize table got errno %d, retrying",
00554                       my_errno);
00555     param.testflag&= ~T_REP_BY_SORT;
00556     error= repair(thd,param,1);
00557   }
00558   return error;
00559 }

void ha_myisam::position const byte record  )  [virtual]
 

Implements handler.

01214 {
01215   my_off_t position=mi_position(file);
01216   my_store_ptr(ref, ref_length, position);
01217 }

int ha_myisam::preload_keys THD thd,
HA_CHECK_OPT check_opt
[virtual]
 

Reimplemented from handler.

00758 {
00759   int error;
00760   const char *errmsg;
00761   ulonglong map= ~(ulonglong) 0;
00762   TABLE_LIST *table_list= table->pos_in_table_list;
00763   my_bool ignore_leaves= table_list->ignore_leaves;
00764 
00765   DBUG_ENTER("ha_myisam::preload_keys");
00766 
00767   /* Check validity of the index references */
00768   if (table_list->use_index)
00769   {
00770     key_map kmap;
00771     get_key_map_from_key_list(&kmap, table, table_list->use_index);
00772     if (kmap.is_set_all())
00773     {
00774       errmsg= thd->net.last_error;
00775       error= HA_ADMIN_FAILED;
00776       goto err;
00777     }
00778     if (!kmap.is_clear_all())
00779       map= kmap.to_ulonglong();
00780   }
00781 
00782   mi_extra(file, HA_EXTRA_PRELOAD_BUFFER_SIZE,
00783            (void *) &thd->variables.preload_buff_size);
00784 
00785   if ((error= mi_preload(file, map, ignore_leaves)))
00786   {
00787     switch (error) {
00788     case HA_ERR_NON_UNIQUE_BLOCK_SIZE:
00789       errmsg= "Indexes use different block sizes";
00790       break;
00791     case HA_ERR_OUT_OF_MEM:
00792       errmsg= "Failed to allocate buffer";
00793       break;
00794     default:
00795       char buf[ERRMSGSIZE+20];
00796       my_snprintf(buf, ERRMSGSIZE,
00797                   "Failed to read from index file (errno: %d)", my_errno);
00798       errmsg= buf;
00799     }
00800     error= HA_ADMIN_FAILED;
00801     goto err;
00802   }
00803 
00804   DBUG_RETURN(HA_ADMIN_OK);
00805 
00806  err:
00807   {
00808     MI_CHECK param;
00809     myisamchk_init(&param);
00810     param.thd= thd;
00811     param.op_name= (char*)"preload_keys";
00812     param.db_name= table->table_cache_key;
00813     param.table_name= table->table_name;
00814     param.testflag= 0;
00815     mi_check_print_error(&param, errmsg);
00816     DBUG_RETURN(error);
00817   }
00818 }

ha_rows ha_myisam::records_in_range uint  inx,
key_range min_key,
key_range max_key
[virtual]
 

Reimplemented from handler.

01605 {
01606   return (ha_rows) mi_records_in_range(file, (int) inx, min_key, max_key);
01607 }

int ha_myisam::rename_table const char *  from,
const char *  to
[virtual]
 

Reimplemented from handler.

01542 {
01543   return mi_rename(from,to);
01544 }

int ha_myisam::repair THD thd,
HA_CHECK_OPT check_opt
[virtual]
 

Reimplemented from handler.

00491 {
00492   int error;
00493   MI_CHECK param;
00494   ha_rows start_records;
00495 
00496   if (!file) return HA_ADMIN_INTERNAL_ERROR;
00497 
00498   myisamchk_init(&param);
00499   param.thd = thd;
00500   param.op_name = (char*) "repair";
00501   param.testflag = ((check_opt->flags & ~(T_EXTEND)) |
00502                     T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM |
00503                     (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT));
00504   param.sort_buffer_length=  check_opt->sort_buffer_size;
00505   start_records=file->state->records;
00506   while ((error=repair(thd,param,0)) && param.retry_repair)
00507   {
00508     param.retry_repair=0;
00509     if (test_all_bits(param.testflag,
00510                       (uint) (T_RETRY_WITHOUT_QUICK | T_QUICK)))
00511     {
00512       param.testflag&= ~T_RETRY_WITHOUT_QUICK;
00513       sql_print_information("Retrying repair of: '%s' without quick",
00514                             table->path);
00515       continue;
00516     }
00517     param.testflag&= ~T_QUICK;
00518     if ((param.testflag & T_REP_BY_SORT))
00519     {
00520       param.testflag= (param.testflag & ~T_REP_BY_SORT) | T_REP;
00521       sql_print_information("Retrying repair of: '%s' with keycache",
00522                             table->path);
00523       continue;
00524     }
00525     break;
00526   }
00527   if (!error && start_records != file->state->records &&
00528       !(check_opt->flags & T_VERY_SILENT))
00529   {
00530     char llbuff[22],llbuff2[22];
00531     sql_print_information("Found %s of %s rows when repairing '%s'",
00532                           llstr(file->state->records, llbuff),
00533                           llstr(start_records, llbuff2),
00534                           table->path);
00535   }
00536   return error;
00537 }

int ha_myisam::repair THD thd,
MI_CHECK param,
bool  optimize
[private]
 

00563 {
00564   int error=0;
00565   uint local_testflag=param.testflag;
00566   bool optimize_done= !optimize, statistics_done=0;
00567   const char *old_proc_info=thd->proc_info;
00568   char fixed_name[FN_REFLEN];
00569   MYISAM_SHARE* share = file->s;
00570   ha_rows rows= file->state->records;
00571   DBUG_ENTER("ha_myisam::repair");
00572 
00573   param.db_name    = table->table_cache_key;
00574   param.table_name = table->table_name;
00575   param.tmpfile_createflag = O_RDWR | O_TRUNC;
00576   param.using_global_keycache = 1;
00577   param.thd=thd;
00578   param.tmpdir=&mysql_tmpdir_list;
00579   param.out_flag=0;
00580   strmov(fixed_name,file->filename);
00581 
00582   // Don't lock tables if we have used LOCK TABLE
00583   if (!thd->locked_tables && 
00584       mi_lock_database(file, table->tmp_table ? F_EXTRA_LCK : F_WRLCK))
00585   {
00586     mi_check_print_error(&param,ER(ER_CANT_LOCK),my_errno);
00587     DBUG_RETURN(HA_ADMIN_FAILED);
00588   }
00589 
00590   if (!optimize ||
00591       ((file->state->del || share->state.split != file->state->records) &&
00592        (!(param.testflag & T_QUICK) ||
00593         !(share->state.changed & STATE_NOT_OPTIMIZED_KEYS))))
00594   {
00595     ulonglong key_map= ((local_testflag & T_CREATE_MISSING_KEYS) ?
00596                         ((ulonglong) 1L << share->base.keys)-1 :
00597                         share->state.key_map);
00598     uint testflag=param.testflag;
00599     if (mi_test_if_sort_rep(file,file->state->records,key_map,0) &&
00600         (local_testflag & T_REP_BY_SORT))
00601     {
00602       local_testflag|= T_STATISTICS;
00603       param.testflag|= T_STATISTICS;            // We get this for free
00604       statistics_done=1;
00605       if (thd->variables.myisam_repair_threads>1)
00606       {
00607         char buf[40];
00608         /* TODO: respect myisam_repair_threads variable */
00609         my_snprintf(buf, 40, "Repair with %d threads", my_count_bits(key_map));
00610         thd->proc_info=buf;
00611         error = mi_repair_parallel(&param, file, fixed_name,
00612             param.testflag & T_QUICK);
00613         thd->proc_info="Repair done"; // to reset proc_info, as
00614                                       // it was pointing to local buffer
00615       }
00616       else
00617       {
00618         thd->proc_info="Repair by sorting";
00619         error = mi_repair_by_sort(&param, file, fixed_name,
00620             param.testflag & T_QUICK);
00621       }
00622     }
00623     else
00624     {
00625       thd->proc_info="Repair with keycache";
00626       param.testflag &= ~T_REP_BY_SORT;
00627       error=  mi_repair(&param, file, fixed_name,
00628                         param.testflag & T_QUICK);
00629     }
00630     param.testflag=testflag;
00631     optimize_done=1;
00632   }
00633   if (!error)
00634   {
00635     if ((local_testflag & T_SORT_INDEX) &&
00636         (share->state.changed & STATE_NOT_SORTED_PAGES))
00637     {
00638       optimize_done=1;
00639       thd->proc_info="Sorting index";
00640       error=mi_sort_index(&param,file,fixed_name);
00641     }
00642     if (!statistics_done && (local_testflag & T_STATISTICS))
00643     {
00644       if (share->state.changed & STATE_NOT_ANALYZED)
00645       {
00646         optimize_done=1;
00647         thd->proc_info="Analyzing";
00648         error = chk_key(&param, file);
00649       }
00650       else
00651         local_testflag&= ~T_STATISTICS;         // Don't update statistics
00652     }
00653   }
00654   thd->proc_info="Saving state";
00655   if (!error)
00656   {
00657     if ((share->state.changed & STATE_CHANGED) || mi_is_crashed(file))
00658     {
00659       share->state.changed&= ~(STATE_CHANGED | STATE_CRASHED |
00660                                STATE_CRASHED_ON_REPAIR);
00661       file->update|=HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
00662     }
00663     /*
00664       the following 'if', thought conceptually wrong,
00665       is a useful optimization nevertheless.
00666     */
00667     if (file->state != &file->s->state.state)
00668       file->s->state.state = *file->state;
00669     if (file->s->base.auto_key)
00670       update_auto_increment_key(&param, file, 1);
00671     if (optimize_done)
00672       error = update_state_info(&param, file,
00673                                 UPDATE_TIME | UPDATE_OPEN_COUNT |
00674                                 (local_testflag &
00675                                  T_STATISTICS ? UPDATE_STAT : 0));
00676     info(HA_STATUS_NO_LOCK | HA_STATUS_TIME | HA_STATUS_VARIABLE |
00677          HA_STATUS_CONST);
00678     if (rows != file->state->records && ! (param.testflag & T_VERY_SILENT))
00679     {
00680       char llbuff[22],llbuff2[22];
00681       mi_check_print_warning(&param,"Number of rows changed from %s to %s",
00682                              llstr(rows,llbuff),
00683                              llstr(file->state->records,llbuff2));
00684     }
00685   }
00686   else
00687   {
00688     mi_mark_crashed_on_repair(file);
00689     file->update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED;
00690     update_state_info(&param, file, 0);
00691   }
00692   thd->proc_info=old_proc_info;
00693   if (!thd->locked_tables)
00694     mi_lock_database(file,F_UNLCK);
00695   DBUG_RETURN(error ? HA_ADMIN_FAILED :
00696               !optimize_done ? HA_ADMIN_ALREADY_DONE : HA_ADMIN_OK);
00697 }

int ha_myisam::restart_rnd_next byte buf,
byte pos
[virtual]
 

Reimplemented from handler.

01200 {
01201   return rnd_pos(buf,pos);
01202 }

int ha_myisam::restore THD thd,
HA_CHECK_OPT check_opt
[virtual]
 

Reimplemented from handler.

00389 {
00390   HA_CHECK_OPT tmp_check_opt;
00391   char* backup_dir= thd->lex->backup_dir;
00392   char src_path[FN_REFLEN], dst_path[FN_REFLEN];
00393   char* table_name = table->real_name;
00394   int error;
00395   const char* errmsg;
00396   DBUG_ENTER("restore");
00397 
00398   if (fn_format_relative_to_data_home(src_path, table_name, backup_dir,
00399                                       MI_NAME_DEXT))
00400     DBUG_RETURN(HA_ADMIN_INVALID);
00401 
00402   if (my_copy(src_path, fn_format(dst_path, table->path, "",
00403                                   MI_NAME_DEXT, 4), MYF(MY_WME)))
00404   {
00405     error = HA_ADMIN_FAILED;
00406     errmsg = "Failed in my_copy (Error %d)";
00407     goto err;
00408   }
00409 
00410   tmp_check_opt.init();
00411   tmp_check_opt.flags |= T_VERY_SILENT | T_CALC_CHECKSUM | T_QUICK;
00412   DBUG_RETURN(repair(thd, &tmp_check_opt));
00413 
00414  err:
00415   {
00416     MI_CHECK param;
00417     myisamchk_init(&param);
00418     param.thd = thd;
00419     param.op_name = (char*)"restore";
00420     param.db_name    = table->table_cache_key;
00421     param.table_name = table->table_name;
00422     param.testflag = 0;
00423     mi_check_print_error(&param, errmsg, my_errno);
00424     DBUG_RETURN(error);
00425   }
00426 }

int ha_myisam::rnd_init bool  scan  )  [virtual]
 

Implements handler.

01184 {
01185   if (scan)
01186     return mi_scan_init(file);
01187   return mi_extra(file, HA_EXTRA_RESET, 0);
01188 }

int ha_myisam::rnd_next byte buf  )  [virtual]
 

Implements handler.

01191 {
01192   statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
01193                       &LOCK_status);
01194   int error=mi_scan(file, buf);
01195   table->status=error ? STATUS_NOT_FOUND: 0;
01196   return error;
01197 }

int ha_myisam::rnd_pos byte buf,
byte pos
[virtual]
 

Implements handler.

01205 {
01206   statistic_increment(table->in_use->status_var.ha_read_rnd_count,
01207                       &LOCK_status);
01208   int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
01209   table->status=error ? STATUS_NOT_FOUND: 0;
01210   return error;
01211 }

void ha_myisam::start_bulk_insert ha_rows  rows  )  [virtual]
 

Reimplemented from handler.

00981 {
00982   DBUG_ENTER("ha_myisam::start_bulk_insert");
00983   THD *thd=current_thd;
00984   ulong size= min(thd->variables.read_buff_size, table->avg_row_length*rows);
00985   DBUG_PRINT("info",("start_bulk_insert: rows %lu size %lu",
00986                      (ulong) rows, size));
00987 
00988   /* don't enable row cache if too few rows */
00989   if (! rows || (rows > MI_MIN_ROWS_TO_USE_WRITE_CACHE))
00990     mi_extra(file, HA_EXTRA_WRITE_CACHE, (void*) &size);
00991 
00992   can_enable_indexes= (file->s->state.key_map ==
00993                        set_bits(ulonglong, file->s->base.keys));
00994 
00995   if (!(specialflag & SPECIAL_SAFE_MODE))
00996   {
00997     /*
00998       Only disable old index if the table was empty and we are inserting
00999       a lot of rows.
01000       We should not do this for only a few rows as this is slower and
01001       we don't want to update the key statistics based of only a few rows.
01002     */
01003     if (file->state->records == 0 && can_enable_indexes &&
01004         (!rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES))
01005       mi_disable_non_unique_index(file,rows);
01006     else
01007     if (!file->bulk_insert &&
01008         (!rows || rows >= MI_MIN_ROWS_TO_USE_BULK_INSERT))
01009     {
01010       mi_init_bulk_insert(file, thd->variables.bulk_insert_buff_size, rows);
01011     }
01012   }
01013   DBUG_VOID_RETURN;
01014 }

THR_LOCK_DATA ** ha_myisam::store_lock THD thd,
THR_LOCK_DATA **  to,
enum thr_lock_type  lock_type
[virtual]
 

Implements handler.

01319 {
01320   if (lock_type != TL_IGNORE && file->lock.type == TL_UNLOCK)
01321     file->lock.type=lock_type;
01322   *to++= &file->lock;
01323   return to;
01324 }

ulong ha_myisam::table_flags void   )  const [inline, virtual]
 

Implements handler.

00057 { return int_table_flags; }

const char* ha_myisam::table_type  )  const [inline, virtual]
 

Implements handler.

00054 { return "MyISAM"; }

void ha_myisam::update_create_info HA_CREATE_INFO create_info  )  [virtual]
 

Reimplemented from handler.

01327 {
01328   ha_myisam::info(HA_STATUS_AUTO | HA_STATUS_CONST);
01329   if (!(create_info->used_fields & HA_CREATE_USED_AUTO))
01330   {
01331     create_info->auto_increment_value=auto_increment_value;
01332   }
01333   if (!(create_info->used_fields & HA_CREATE_USED_RAID))
01334   {
01335     create_info->raid_type= raid_type;
01336     create_info->raid_chunks= raid_chunks;
01337     create_info->raid_chunksize= raid_chunksize;
01338   }
01339   create_info->data_file_name=data_file_name;
01340   create_info->index_file_name=index_file_name;
01341 }

int ha_myisam::update_row const byte old_data,
byte new_data
[virtual]
 

Reimplemented from handler.

01086 {
01087   statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
01088   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
01089     table->timestamp_field->set_time();
01090   return mi_update(file,old_data,new_data);
01091 }

int ha_myisam::write_row byte buf  )  [virtual]
 

Reimplemented from handler.

00251 {
00252   statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
00253 
00254   /* If we have a timestamp column, update it to the current time */
00255   if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
00256     table->timestamp_field->set_time();
00257 
00258   /*
00259     If we have an auto_increment column and we are writing a changed row
00260     or a new row, then update the auto_increment value in the record.
00261   */
00262   if (table->next_number_field && buf == table->record[0])
00263     update_auto_increment();
00264   return mi_write(file,buf);
00265 }


Member Data Documentation

bool ha_myisam::can_enable_indexes [private]
 

char* ha_myisam::data_file_name [private]
 

MI_INFO* ha_myisam::file [private]
 

char * ha_myisam::index_file_name [private]
 

ulong ha_myisam::int_table_flags [private]
 


The documentation for this class was generated from the following files:
Generated on Thu Feb 24 11:19:24 2005 for MySQL by  doxygen 1.3.9.1