Commit c77c58bb authored by unknown's avatar unknown

Changed some unneccessary calls to current_thd() into table->in_use

parent aca57a3d
......@@ -86,7 +86,7 @@ void ha_heap::set_keys_for_scanning(void)
int ha_heap::write_row(byte * buf)
{
statistic_increment(current_thd->status_var.ha_write_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
if (table->next_number_field && buf == table->record[0])
......@@ -96,7 +96,7 @@ int ha_heap::write_row(byte * buf)
int ha_heap::update_row(const byte * old_data, byte * new_data)
{
statistic_increment(current_thd->status_var.ha_update_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
return heap_update(file,old_data,new_data);
......@@ -104,7 +104,7 @@ int ha_heap::update_row(const byte * old_data, byte * new_data)
int ha_heap::delete_row(const byte * buf)
{
statistic_increment(current_thd->status_var.ha_delete_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
return heap_delete(file,buf);
}
......@@ -112,7 +112,8 @@ int ha_heap::index_read(byte * buf, const byte * key, uint key_len,
enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_key_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error = heap_rkey(file,buf,active_index, key, key_len, find_flag);
table->status = error ? STATUS_NOT_FOUND : 0;
return error;
......@@ -121,7 +122,8 @@ int ha_heap::index_read(byte * buf, const byte * key, uint key_len,
int ha_heap::index_read_last(byte *buf, const byte *key, uint key_len)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_key_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error= heap_rkey(file, buf, active_index, key, key_len,
HA_READ_PREFIX_LAST);
table->status= error ? STATUS_NOT_FOUND : 0;
......@@ -131,7 +133,8 @@ int ha_heap::index_read_last(byte *buf, const byte *key, uint key_len)
int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
statistic_increment(current_thd->status_var.ha_read_key_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error = heap_rkey(file, buf, index, key, key_len, find_flag);
table->status = error ? STATUS_NOT_FOUND : 0;
return error;
......@@ -140,7 +143,8 @@ int ha_heap::index_read_idx(byte * buf, uint index, const byte * key,
int ha_heap::index_next(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_next_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_next_count,
&LOCK_status);
int error=heap_rnext(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -149,7 +153,8 @@ int ha_heap::index_next(byte * buf)
int ha_heap::index_prev(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_prev_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_prev_count,
&LOCK_status);
int error=heap_rprev(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -158,7 +163,7 @@ int ha_heap::index_prev(byte * buf)
int ha_heap::index_first(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_first_count,
statistic_increment(table->in_use->status_var.ha_read_first_count,
&LOCK_status);
int error=heap_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -168,7 +173,8 @@ int ha_heap::index_first(byte * buf)
int ha_heap::index_last(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_last_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_last_count,
&LOCK_status);
int error=heap_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -181,7 +187,7 @@ int ha_heap::rnd_init(bool scan)
int ha_heap::rnd_next(byte *buf)
{
statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status);
int error=heap_scan(file, buf);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -192,7 +198,8 @@ int ha_heap::rnd_pos(byte * buf, byte *pos)
{
int error;
HEAP_PTR position;
statistic_increment(current_thd->status_var.ha_read_rnd_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
&LOCK_status);
memcpy_fixed((char*) &position,pos,sizeof(HEAP_PTR));
error=heap_rrnd(file, buf, position);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -456,7 +463,7 @@ int ha_heap::create(const char *name, TABLE *table_arg,
}
}
mem_per_row+= MY_ALIGN(table_arg->reclength + 1, sizeof(char*));
max_rows = (ha_rows) (current_thd->variables.max_heap_table_size /
max_rows = (ha_rows) (table->in_use->variables.max_heap_table_size /
mem_per_row);
HP_CREATE_INFO hp_create_info;
hp_create_info.auto_key= auto_key;
......
......@@ -69,7 +69,7 @@ uint ha_isam::min_record_length(uint options) const
int ha_isam::write_row(byte * buf)
{
statistic_increment(current_thd->status_var.ha_write_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_write_count, &LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
if (table->next_number_field && buf == table->record[0])
......@@ -79,7 +79,7 @@ int ha_isam::write_row(byte * buf)
int ha_isam::update_row(const byte * old_data, byte * new_data)
{
statistic_increment(current_thd->status_var.ha_update_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_update_count, &LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
return !nisam_update(file,old_data,new_data) ? 0 : my_errno ? my_errno : -1;
......@@ -87,14 +87,15 @@ int ha_isam::update_row(const byte * old_data, byte * new_data)
int ha_isam::delete_row(const byte * buf)
{
statistic_increment(current_thd->status_var.ha_delete_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_delete_count, &LOCK_status);
return !nisam_delete(file,buf) ? 0 : my_errno ? my_errno : -1;
}
int ha_isam::index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
statistic_increment(current_thd->status_var.ha_read_key_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error=nisam_rkey(file, buf, active_index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return !error ? 0 : my_errno ? my_errno : -1;
......@@ -103,7 +104,8 @@ int ha_isam::index_read(byte * buf, const byte * key,
int ha_isam::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
statistic_increment(current_thd->status_var.ha_read_key_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error=nisam_rkey(file, buf, index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return !error ? 0 : my_errno ? my_errno : -1;
......@@ -111,7 +113,8 @@ int ha_isam::index_read_idx(byte * buf, uint index, const byte * key,
int ha_isam::index_read_last(byte * buf, const byte * key, uint key_len)
{
statistic_increment(current_thd->status_var.ha_read_key_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error=nisam_rkey(file, buf, active_index, key, key_len,
HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -120,7 +123,7 @@ int ha_isam::index_read_last(byte * buf, const byte * key, uint key_len)
int ha_isam::index_next(byte * buf)
{
statistic_increment(current_thd->status_var.ha_read_next_count,
statistic_increment(table->in_use->status_var.ha_read_next_count,
&LOCK_status);
int error=nisam_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -129,7 +132,7 @@ int ha_isam::index_next(byte * buf)
int ha_isam::index_prev(byte * buf)
{
statistic_increment(current_thd->status_var.ha_read_prev_count,
statistic_increment(table->in_use->status_var.ha_read_prev_count,
&LOCK_status);
int error=nisam_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -138,7 +141,7 @@ int ha_isam::index_prev(byte * buf)
int ha_isam::index_first(byte * buf)
{
statistic_increment(current_thd->status_var.ha_read_first_count,
statistic_increment(table->in_use->status_var.ha_read_first_count,
&LOCK_status);
int error=nisam_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -147,7 +150,7 @@ int ha_isam::index_first(byte * buf)
int ha_isam::index_last(byte * buf)
{
statistic_increment(current_thd->status_var.ha_read_last_count,
statistic_increment(table->in_use->status_var.ha_read_last_count,
&LOCK_status);
int error=nisam_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -161,7 +164,7 @@ int ha_isam::rnd_init(bool scan)
int ha_isam::rnd_next(byte *buf)
{
statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status);
int error=nisam_rrnd(file, buf, NI_POS_ERROR);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -170,7 +173,7 @@ int ha_isam::rnd_next(byte *buf)
int ha_isam::rnd_pos(byte * buf, byte *pos)
{
statistic_increment(current_thd->status_var.ha_read_rnd_count,
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
&LOCK_status);
int error=nisam_rrnd(file, buf, (ulong) ha_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;
......
......@@ -77,7 +77,7 @@ int ha_isammrg::write_row(byte * buf)
int ha_isammrg::update_row(const byte * old_data, byte * new_data)
{
statistic_increment(current_thd->status_var.ha_update_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_update_count, &LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
return !mrg_update(file,old_data,new_data) ? 0 : my_errno ? my_errno : -1;
......@@ -85,7 +85,7 @@ int ha_isammrg::update_row(const byte * old_data, byte * new_data)
int ha_isammrg::delete_row(const byte * buf)
{
statistic_increment(current_thd->status_var.ha_delete_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_delete_count, &LOCK_status);
return !mrg_delete(file,buf) ? 0 : my_errno ? my_errno : -1;
}
......@@ -128,7 +128,7 @@ int ha_isammrg::rnd_init(bool scan)
int ha_isammrg::rnd_next(byte *buf)
{
statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status);
int error=mrg_rrnd(file, buf, ~(mrg_off_t) 0);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -137,7 +137,8 @@ int ha_isammrg::rnd_next(byte *buf)
int ha_isammrg::rnd_pos(byte * buf, byte *pos)
{
statistic_increment(current_thd->status_var.ha_read_rnd_count, &LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
&LOCK_status);
int error=mrg_rrnd(file, buf, (ulong) ha_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;
return !error ? 0 : my_errno ? my_errno : -1;
......
......@@ -249,7 +249,7 @@ int ha_myisam::close(void)
int ha_myisam::write_row(byte * buf)
{
statistic_increment(current_thd->status_var.ha_write_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
/* If we have a timestamp column, update it to the current time */
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
......@@ -602,7 +602,7 @@ int ha_myisam::repair(THD *thd, MI_CHECK &param, bool optimize)
local_testflag|= T_STATISTICS;
param.testflag|= T_STATISTICS; // We get this for free
statistics_done=1;
if (current_thd->variables.myisam_repair_threads>1)
if (thd->variables.myisam_repair_threads>1)
{
char buf[40];
/* TODO: respect myisam_repair_threads variable */
......@@ -1084,7 +1084,7 @@ bool ha_myisam::is_crashed() const
int ha_myisam::update_row(const byte * old_data, byte * new_data)
{
statistic_increment(current_thd->status_var.ha_update_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
return mi_update(file,old_data,new_data);
......@@ -1092,7 +1092,7 @@ int ha_myisam::update_row(const byte * old_data, byte * new_data)
int ha_myisam::delete_row(const byte * buf)
{
statistic_increment(current_thd->status_var.ha_delete_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
return mi_delete(file,buf);
}
......@@ -1100,7 +1100,8 @@ int ha_myisam::index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_key_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error=mi_rkey(file,buf,active_index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -1109,7 +1110,8 @@ int ha_myisam::index_read(byte * buf, const byte * key,
int ha_myisam::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
statistic_increment(current_thd->status_var.ha_read_key_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error=mi_rkey(file,buf,index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -1118,7 +1120,8 @@ int ha_myisam::index_read_idx(byte * buf, uint index, const byte * key,
int ha_myisam::index_read_last(byte * buf, const byte * key, uint key_len)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_key_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error=mi_rkey(file,buf,active_index, key, key_len, HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -1127,7 +1130,8 @@ int ha_myisam::index_read_last(byte * buf, const byte * key, uint key_len)
int ha_myisam::index_next(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_next_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_next_count,
&LOCK_status);
int error=mi_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -1136,7 +1140,8 @@ int ha_myisam::index_next(byte * buf)
int ha_myisam::index_prev(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_prev_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_prev_count,
&LOCK_status);
int error=mi_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -1145,7 +1150,7 @@ int ha_myisam::index_prev(byte * buf)
int ha_myisam::index_first(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_first_count,
statistic_increment(table->in_use->status_var.ha_read_first_count,
&LOCK_status);
int error=mi_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -1155,7 +1160,8 @@ int ha_myisam::index_first(byte * buf)
int ha_myisam::index_last(byte * buf)
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_last_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_last_count,
&LOCK_status);
int error=mi_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -1166,7 +1172,8 @@ int ha_myisam::index_next_same(byte * buf,
uint length __attribute__((unused)))
{
DBUG_ASSERT(inited==INDEX);
statistic_increment(current_thd->status_var.ha_read_next_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_next_count,
&LOCK_status);
int error=mi_rnext_same(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -1182,7 +1189,7 @@ int ha_myisam::rnd_init(bool scan)
int ha_myisam::rnd_next(byte *buf)
{
statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status);
int error=mi_scan(file, buf);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -1196,7 +1203,8 @@ int ha_myisam::restart_rnd_next(byte *buf, byte *pos)
int ha_myisam::rnd_pos(byte * buf, byte *pos)
{
statistic_increment(current_thd->status_var.ha_read_rnd_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
&LOCK_status);
int error=mi_rrnd(file, buf, ha_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -1606,7 +1614,7 @@ int ha_myisam::ft_read(byte * buf)
if (!ft_handler)
return -1;
thread_safe_increment(current_thd->status_var.ha_read_next_count,
thread_safe_increment(table->in_use->status_var.ha_read_next_count,
&LOCK_status); // why ?
error=ft_handler->please->read_next(ft_handler,(char*) buf);
......
......@@ -81,7 +81,7 @@ int ha_myisammrg::close(void)
int ha_myisammrg::write_row(byte * buf)
{
statistic_increment(current_thd->status_var.ha_write_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_write_count,&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_INSERT)
table->timestamp_field->set_time();
if (table->next_number_field && buf == table->record[0])
......@@ -91,7 +91,7 @@ int ha_myisammrg::write_row(byte * buf)
int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
{
statistic_increment(current_thd->status_var.ha_update_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_update_count,&LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
table->timestamp_field->set_time();
return myrg_update(file,old_data,new_data);
......@@ -99,14 +99,15 @@ int ha_myisammrg::update_row(const byte * old_data, byte * new_data)
int ha_myisammrg::delete_row(const byte * buf)
{
statistic_increment(current_thd->status_var.ha_delete_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_delete_count,&LOCK_status);
return myrg_delete(file,buf);
}
int ha_myisammrg::index_read(byte * buf, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
statistic_increment(current_thd->status_var.ha_read_key_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error=myrg_rkey(file,buf,active_index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -115,7 +116,8 @@ int ha_myisammrg::index_read(byte * buf, const byte * key,
int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
statistic_increment(current_thd->status_var.ha_read_key_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error=myrg_rkey(file,buf,index, key, key_len, find_flag);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -123,7 +125,8 @@ int ha_myisammrg::index_read_idx(byte * buf, uint index, const byte * key,
int ha_myisammrg::index_read_last(byte * buf, const byte * key, uint key_len)
{
statistic_increment(current_thd->status_var.ha_read_key_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_key_count,
&LOCK_status);
int error=myrg_rkey(file,buf,active_index, key, key_len,
HA_READ_PREFIX_LAST);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -132,7 +135,8 @@ int ha_myisammrg::index_read_last(byte * buf, const byte * key, uint key_len)
int ha_myisammrg::index_next(byte * buf)
{
statistic_increment(current_thd->status_var.ha_read_next_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_next_count,
&LOCK_status);
int error=myrg_rnext(file,buf,active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -140,7 +144,8 @@ int ha_myisammrg::index_next(byte * buf)
int ha_myisammrg::index_prev(byte * buf)
{
statistic_increment(current_thd->status_var.ha_read_prev_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_prev_count,
&LOCK_status);
int error=myrg_rprev(file,buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -148,7 +153,7 @@ int ha_myisammrg::index_prev(byte * buf)
int ha_myisammrg::index_first(byte * buf)
{
statistic_increment(current_thd->status_var.ha_read_first_count,
statistic_increment(table->in_use->status_var.ha_read_first_count,
&LOCK_status);
int error=myrg_rfirst(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -157,7 +162,8 @@ int ha_myisammrg::index_first(byte * buf)
int ha_myisammrg::index_last(byte * buf)
{
statistic_increment(current_thd->status_var.ha_read_last_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_last_count,
&LOCK_status);
int error=myrg_rlast(file, buf, active_index);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -167,7 +173,8 @@ int ha_myisammrg::index_next_same(byte * buf,
const byte *key __attribute__((unused)),
uint length __attribute__((unused)))
{
statistic_increment(current_thd->status_var.ha_read_next_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_next_count,
&LOCK_status);
int error=myrg_rnext_same(file,buf);
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......@@ -180,7 +187,7 @@ int ha_myisammrg::rnd_init(bool scan)
int ha_myisammrg::rnd_next(byte *buf)
{
statistic_increment(current_thd->status_var.ha_read_rnd_next_count,
statistic_increment(table->in_use->status_var.ha_read_rnd_next_count,
&LOCK_status);
int error=myrg_rrnd(file, buf, HA_OFFSET_ERROR);
table->status=error ? STATUS_NOT_FOUND: 0;
......@@ -189,7 +196,8 @@ int ha_myisammrg::rnd_next(byte *buf)
int ha_myisammrg::rnd_pos(byte * buf, byte *pos)
{
statistic_increment(current_thd->status_var.ha_read_rnd_count,&LOCK_status);
statistic_increment(table->in_use->status_var.ha_read_rnd_count,
&LOCK_status);
int error=myrg_rrnd(file, buf, ha_get_ptr(pos,ref_length));
table->status=error ? STATUS_NOT_FOUND: 0;
return error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment