19 #include "myisamdef.h"
26 my_off_t mi_position(
MI_INFO *info)
39 DBUG_ENTER(
"mi_status");
41 x->recpos = info->lastpos;
42 if (flag == HA_STATUS_POS)
44 if (!(flag & HA_STATUS_NO_LOCK))
47 (void) _mi_readinfo(info,F_RDLCK,0);
48 fast_mi_writeinfo(info);
51 if (flag & HA_STATUS_VARIABLE)
53 x->records = info->state->records;
54 x->deleted = info->state->del;
55 x->delete_length = info->state->empty;
56 x->data_file_length =info->state->data_file_length;
57 x->index_file_length=info->state->key_file_length;
59 x->keys = share->state.header.keys;
60 x->check_time = share->state.check_time;
61 x->mean_reclength= x->records ?
62 (ulong) ((x->data_file_length - x->delete_length) / x->records) :
63 (ulong) share->min_pack_length;
65 if (flag & HA_STATUS_ERRKEY)
67 x->errkey = info->errkey;
68 x->dupp_key_pos= info->dupp_key_pos;
70 if (flag & HA_STATUS_CONST)
72 x->reclength = share->base.reclength;
73 x->max_data_file_length=share->base.max_data_file_length;
74 x->max_index_file_length=info->s->base.max_key_file_length;
75 x->filenr = info->dfile;
76 x->options = share->options;
77 x->create_time=share->state.create_time;
78 x->reflength= mi_get_pointer_length(share->base.max_data_file_length,
79 myisam_data_pointer_size);
80 x->record_offset= ((share->options &
81 (HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD)) ?
82 0L : share->base.pack_reclength);
84 x->rec_per_key = share->state.rec_per_key_part;
85 x->key_map = share->state.key_map;
86 x->data_file_name = share->data_file_name;
87 x->index_file_name = share->index_file_name;
89 if ((flag & HA_STATUS_TIME) && !
mysql_file_fstat(info->dfile, &state, MYF(0)))
90 x->update_time=state.st_mtime;
93 if (flag & HA_STATUS_AUTO)
95 x->auto_increment= share->state.auto_increment+1;
96 if (!x->auto_increment)
97 x->auto_increment= ~(ulonglong) 0;
122 void mi_report_error(
int errcode,
const char *file_name)
125 DBUG_ENTER(
"mi_report_error");
126 DBUG_PRINT(
"enter",(
"errcode %d, table '%s'", errcode, file_name));
128 if ((lgt= strlen(file_name)) > 64)
129 file_name+= lgt - 64;
130 my_error(errcode, MYF(ME_NOREFRESH), file_name);