mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
less boilerplate code - move common operations to wrappers
This commit is contained in:
@@ -33,6 +33,7 @@
|
||||
#include "log.h"
|
||||
#include "rpl_tblmap.h"
|
||||
#include "mdl.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_locale.h" /* my_locale_st */
|
||||
#include "sql_profile.h" /* PROFILING */
|
||||
#include "scheduler.h" /* thd_scheduler */
|
||||
@@ -3921,11 +3922,13 @@ inline int handler::ha_index_read_map(uchar * buf, const uchar * key,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
increment_statistics(&SSV::ha_read_key_count);
|
||||
int error= index_read_map(buf, key, keypart_map, find_flag);
|
||||
if (!error)
|
||||
update_index_statistics();
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -3934,6 +3937,7 @@ inline int handler::ha_index_read_idx_map(uchar * buf, uint index,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
increment_statistics(&SSV::ha_read_key_count);
|
||||
int error= index_read_idx_map(buf, index, key, keypart_map, find_flag);
|
||||
if (!error)
|
||||
@@ -3942,50 +3946,59 @@ inline int handler::ha_index_read_idx_map(uchar * buf, uint index,
|
||||
index_rows_read[index]++;
|
||||
}
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
inline int handler::ha_index_next(uchar * buf)
|
||||
{
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
increment_statistics(&SSV::ha_read_next_count);
|
||||
int error= index_next(buf);
|
||||
if (!error)
|
||||
update_index_statistics();
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
inline int handler::ha_index_prev(uchar * buf)
|
||||
{
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
increment_statistics(&SSV::ha_read_prev_count);
|
||||
int error= index_prev(buf);
|
||||
if (!error)
|
||||
update_index_statistics();
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
inline int handler::ha_index_first(uchar * buf)
|
||||
{
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
increment_statistics(&SSV::ha_read_first_count);
|
||||
int error= index_first(buf);
|
||||
if (!error)
|
||||
update_index_statistics();
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
inline int handler::ha_index_last(uchar * buf)
|
||||
{
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
increment_statistics(&SSV::ha_read_last_count);
|
||||
int error= index_last(buf);
|
||||
if (!error)
|
||||
update_index_statistics();
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -3993,11 +4006,13 @@ inline int handler::ha_index_next_same(uchar *buf, const uchar *key,
|
||||
uint keylen)
|
||||
{
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
increment_statistics(&SSV::ha_read_next_count);
|
||||
int error= index_next_same(buf, key, keylen);
|
||||
if (!error)
|
||||
update_index_statistics();
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -4012,21 +4027,25 @@ inline int handler::ha_ft_read(uchar *buf)
|
||||
|
||||
inline int handler::ha_rnd_next(uchar *buf)
|
||||
{
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str, TRUE);
|
||||
increment_statistics(&SSV::ha_read_rnd_next_count);
|
||||
int error= rnd_next(buf);
|
||||
if (!error)
|
||||
rows_read++;
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
inline int handler::ha_rnd_pos(uchar *buf, uchar *pos)
|
||||
{
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str, FALSE);
|
||||
increment_statistics(&SSV::ha_read_rnd_count);
|
||||
int error= rnd_pos(buf, pos);
|
||||
if (!error)
|
||||
rows_read++;
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -4050,18 +4069,4 @@ inline int handler::ha_read_first_row(uchar *buf, uint primary_key)
|
||||
|
||||
#endif /* MYSQL_SERVER */
|
||||
|
||||
#if 0
|
||||
/**
|
||||
The meat of thd_proc_info(THD*, char*), a macro that packs the last
|
||||
three calling-info parameters.
|
||||
*/
|
||||
extern "C"
|
||||
const char *set_thd_proc_info(void *thd_arg, const char *info,
|
||||
const char *calling_func,
|
||||
const char *calling_file,
|
||||
const unsigned int calling_line);
|
||||
|
||||
#define thd_proc_info(thd, msg) \
|
||||
set_thd_proc_info(thd, msg, __func__, __FILE__, __LINE__)
|
||||
#endif
|
||||
#endif /* SQL_CLASS_INCLUDED */
|
||||
|
||||
@@ -19,11 +19,9 @@
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_class.h" // SSV
|
||||
#include "sql_table.h"
|
||||
#include <myisam.h>
|
||||
#include "sql_table.h" // build_table_filename
|
||||
#include <myisam.h> // T_EXTEND
|
||||
|
||||
#include "ha_archive.h"
|
||||
#include <my_dir.h>
|
||||
@@ -1008,9 +1006,7 @@ int ha_archive::index_read(uchar *buf, const uchar *key,
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_archive::index_read");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= index_read_idx(buf, active_index, key, key_len, find_flag);
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -1060,7 +1056,6 @@ int ha_archive::index_next(uchar * buf)
|
||||
int rc;
|
||||
|
||||
DBUG_ENTER("ha_archive::index_next");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
|
||||
while (!(get_row(&archive, buf)))
|
||||
{
|
||||
@@ -1072,7 +1067,6 @@ int ha_archive::index_next(uchar * buf)
|
||||
}
|
||||
|
||||
rc= found ? 0 : HA_ERR_END_OF_FILE;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -1300,8 +1294,6 @@ int ha_archive::rnd_next(uchar *buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_archive::rnd_next");
|
||||
MYSQL_READ_ROW_START(table_share->db.str,
|
||||
table_share->table_name.str, TRUE);
|
||||
|
||||
if (share->crashed)
|
||||
DBUG_RETURN(HA_ERR_CRASHED_ON_USAGE);
|
||||
@@ -1320,7 +1312,6 @@ int ha_archive::rnd_next(uchar *buf)
|
||||
table->status=rc ? STATUS_NOT_FOUND: 0;
|
||||
|
||||
end:
|
||||
MYSQL_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -1350,8 +1341,6 @@ int ha_archive::rnd_pos(uchar * buf, uchar *pos)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_archive::rnd_pos");
|
||||
MYSQL_READ_ROW_START(table_share->db.str,
|
||||
table_share->table_name.str, FALSE);
|
||||
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
|
||||
current_position= (my_off_t)my_get_ptr(pos, ref_length);
|
||||
if (azseek(&archive, current_position, SEEK_SET) == (my_off_t)(-1L))
|
||||
@@ -1361,7 +1350,6 @@ int ha_archive::rnd_pos(uchar * buf, uchar *pos)
|
||||
}
|
||||
rc= get_row(&archive, buf);
|
||||
end:
|
||||
MYSQL_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#define MYSQL_SERVER 1
|
||||
#include "sql_priv.h"
|
||||
#include "unireg.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "ha_blackhole.h"
|
||||
#include "sql_class.h" // THD, SYSTEM_THREAD_SLAVE_SQL
|
||||
|
||||
@@ -143,14 +142,11 @@ int ha_blackhole::rnd_next(uchar *buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_blackhole::rnd_next");
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
TRUE);
|
||||
THD *thd= ha_thd();
|
||||
if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
|
||||
rc= 0;
|
||||
else
|
||||
rc= HA_ERR_END_OF_FILE;
|
||||
MYSQL_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -158,10 +154,7 @@ int ha_blackhole::rnd_next(uchar *buf)
|
||||
int ha_blackhole::rnd_pos(uchar * buf, uchar *pos)
|
||||
{
|
||||
DBUG_ENTER("ha_blackhole::rnd_pos");
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
FALSE);
|
||||
DBUG_ASSERT(0);
|
||||
MYSQL_READ_ROW_DONE(0);
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
@@ -234,13 +227,11 @@ int ha_blackhole::index_read_map(uchar * buf, const uchar * key,
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_blackhole::index_read");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
THD *thd= ha_thd();
|
||||
if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
|
||||
rc= 0;
|
||||
else
|
||||
rc= HA_ERR_END_OF_FILE;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -251,13 +242,11 @@ int ha_blackhole::index_read_idx_map(uchar * buf, uint idx, const uchar * key,
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_blackhole::index_read_idx");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
THD *thd= ha_thd();
|
||||
if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
|
||||
rc= 0;
|
||||
else
|
||||
rc= HA_ERR_END_OF_FILE;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -267,13 +256,11 @@ int ha_blackhole::index_read_last_map(uchar * buf, const uchar * key,
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_blackhole::index_read_last");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
THD *thd= ha_thd();
|
||||
if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL && thd->query() == NULL)
|
||||
rc= 0;
|
||||
else
|
||||
rc= HA_ERR_END_OF_FILE;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -282,9 +269,7 @@ int ha_blackhole::index_next(uchar * buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_blackhole::index_next");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= HA_ERR_END_OF_FILE;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -293,9 +278,7 @@ int ha_blackhole::index_prev(uchar * buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_blackhole::index_prev");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= HA_ERR_END_OF_FILE;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -304,9 +287,7 @@ int ha_blackhole::index_first(uchar * buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_blackhole::index_first");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= HA_ERR_END_OF_FILE;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||
}
|
||||
@@ -316,9 +297,7 @@ int ha_blackhole::index_last(uchar * buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_blackhole::index_last");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= HA_ERR_END_OF_FILE;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
|
||||
@@ -91,11 +91,9 @@
|
||||
#pragma implementation // gcc: Class implementation
|
||||
#endif
|
||||
|
||||
#include "sql_priv.h"
|
||||
#include "sql_class.h" // MYSQL_HANDLERTON_INTERFACE_VERSION
|
||||
#include <mysql/plugin.h>
|
||||
#include "ha_example.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_plugin.h"
|
||||
#include "sql_class.h"
|
||||
|
||||
static handler *example_create_handler(handlerton *hton,
|
||||
TABLE_SHARE *table,
|
||||
@@ -547,9 +545,7 @@ int ha_example::index_read_map(uchar *buf, const uchar *key,
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_example::index_read");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= HA_ERR_WRONG_COMMAND;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -563,9 +559,7 @@ int ha_example::index_next(uchar *buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_example::index_next");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= HA_ERR_WRONG_COMMAND;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -579,9 +573,7 @@ int ha_example::index_prev(uchar *buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_example::index_prev");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= HA_ERR_WRONG_COMMAND;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -600,9 +592,7 @@ int ha_example::index_first(uchar *buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_example::index_first");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= HA_ERR_WRONG_COMMAND;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -621,9 +611,7 @@ int ha_example::index_last(uchar *buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_example::index_last");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
rc= HA_ERR_WRONG_COMMAND;
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -672,10 +660,7 @@ int ha_example::rnd_next(uchar *buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_example::rnd_next");
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
TRUE);
|
||||
rc= HA_ERR_END_OF_FILE;
|
||||
MYSQL_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -725,10 +710,7 @@ int ha_example::rnd_pos(uchar *buf, uchar *pos)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_example::rnd_pos");
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
TRUE);
|
||||
rc= HA_ERR_WRONG_COMMAND;
|
||||
MYSQL_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
|
||||
@@ -383,7 +383,6 @@
|
||||
#endif
|
||||
|
||||
#include "ha_federated.h"
|
||||
#include "probes_mysql.h"
|
||||
|
||||
#include "m_string.h"
|
||||
#include "key.h" // key_copy
|
||||
@@ -2355,12 +2354,10 @@ int ha_federated::index_read(uchar *buf, const uchar *key,
|
||||
int rc;
|
||||
DBUG_ENTER("ha_federated::index_read");
|
||||
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
free_result();
|
||||
rc= index_read_idx_with_result_set(buf, active_index, key,
|
||||
key_len, find_flag,
|
||||
&stored_result);
|
||||
MYSQL_INDEX_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -2512,7 +2509,6 @@ int ha_federated::read_range_first(const key_range *start_key,
|
||||
sizeof(sql_query_buffer),
|
||||
&my_charset_bin);
|
||||
DBUG_ENTER("ha_federated::read_range_first");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
|
||||
DBUG_ASSERT(!(start_key == NULL && end_key == NULL));
|
||||
|
||||
@@ -2535,12 +2531,10 @@ int ha_federated::read_range_first(const key_range *start_key,
|
||||
}
|
||||
|
||||
retval= read_next(table->record[0], stored_result);
|
||||
MYSQL_INDEX_READ_ROW_DONE(retval);
|
||||
DBUG_RETURN(retval);
|
||||
|
||||
error:
|
||||
table->status= STATUS_NOT_FOUND;
|
||||
MYSQL_INDEX_READ_ROW_DONE(retval);
|
||||
DBUG_RETURN(retval);
|
||||
}
|
||||
|
||||
@@ -2549,9 +2543,7 @@ int ha_federated::read_range_next()
|
||||
{
|
||||
int retval;
|
||||
DBUG_ENTER("ha_federated::read_range_next");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
retval= rnd_next_int(table->record[0]);
|
||||
MYSQL_INDEX_READ_ROW_DONE(retval);
|
||||
DBUG_RETURN(retval);
|
||||
}
|
||||
|
||||
@@ -2561,10 +2553,8 @@ int ha_federated::index_next(uchar *buf)
|
||||
{
|
||||
int retval;
|
||||
DBUG_ENTER("ha_federated::index_next");
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_next_count);
|
||||
retval= read_next(buf, stored_result);
|
||||
MYSQL_INDEX_READ_ROW_DONE(retval);
|
||||
DBUG_RETURN(retval);
|
||||
}
|
||||
|
||||
@@ -2660,10 +2650,7 @@ int ha_federated::rnd_next(uchar *buf)
|
||||
{
|
||||
int rc;
|
||||
DBUG_ENTER("ha_federated::rnd_next");
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
TRUE);
|
||||
rc= rnd_next_int(buf);
|
||||
MYSQL_READ_ROW_DONE(rc);
|
||||
DBUG_RETURN(rc);
|
||||
}
|
||||
|
||||
@@ -2777,8 +2764,6 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos)
|
||||
int ret_val;
|
||||
DBUG_ENTER("ha_federated::rnd_pos");
|
||||
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
FALSE);
|
||||
ha_statistic_increment(&SSV::ha_read_rnd_count);
|
||||
|
||||
/* Get stored result set. */
|
||||
@@ -2789,7 +2774,6 @@ int ha_federated::rnd_pos(uchar *buf, uchar *pos)
|
||||
sizeof(MYSQL_ROW_OFFSET));
|
||||
/* Read a row. */
|
||||
ret_val= read_next(buf, result);
|
||||
MYSQL_READ_ROW_DONE(ret_val);
|
||||
DBUG_RETURN(ret_val);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#define MYSQL_SERVER 1
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "sql_plugin.h"
|
||||
#include "ha_heap.h"
|
||||
#include "heapdef.h"
|
||||
@@ -289,25 +288,21 @@ int ha_heap::index_read_map(uchar *buf, const uchar *key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
ha_statistic_increment(&SSV::ha_read_key_count);
|
||||
int error = heap_rkey(file,buf,active_index, key, keypart_map, find_flag);
|
||||
table->status = error ? STATUS_NOT_FOUND : 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_heap::index_read_last_map(uchar *buf, const uchar *key,
|
||||
key_part_map keypart_map)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
ha_statistic_increment(&SSV::ha_read_key_count);
|
||||
int error= heap_rkey(file, buf, active_index, key, keypart_map,
|
||||
HA_READ_PREFIX_LAST);
|
||||
table->status= error ? STATUS_NOT_FOUND : 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -315,55 +310,45 @@ int ha_heap::index_read_idx_map(uchar *buf, uint index, const uchar *key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_key_count);
|
||||
int error = heap_rkey(file, buf, index, key, keypart_map, find_flag);
|
||||
table->status = error ? STATUS_NOT_FOUND : 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_heap::index_next(uchar * buf)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
ha_statistic_increment(&SSV::ha_read_next_count);
|
||||
int error=heap_rnext(file,buf);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_heap::index_prev(uchar * buf)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
ha_statistic_increment(&SSV::ha_read_prev_count);
|
||||
int error=heap_rprev(file,buf);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_heap::index_first(uchar * buf)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
ha_statistic_increment(&SSV::ha_read_first_count);
|
||||
int error=heap_rfirst(file, buf, active_index);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_heap::index_last(uchar * buf)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
ha_statistic_increment(&SSV::ha_read_last_count);
|
||||
int error=heap_rlast(file, buf, active_index);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -374,12 +359,9 @@ int ha_heap::rnd_init(bool scan)
|
||||
|
||||
int ha_heap::rnd_next(uchar *buf)
|
||||
{
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
TRUE);
|
||||
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
|
||||
int error=heap_scan(file, buf);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -387,13 +369,10 @@ int ha_heap::rnd_pos(uchar * buf, uchar *pos)
|
||||
{
|
||||
int error;
|
||||
HEAP_PTR heap_position;
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
FALSE);
|
||||
ha_statistic_increment(&SSV::ha_read_rnd_count);
|
||||
memcpy(&heap_position, pos, sizeof(HEAP_PTR));
|
||||
error=heap_rrnd(file, buf, heap_position);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#define MYSQL_SERVER 1
|
||||
#include "sql_priv.h"
|
||||
#include "probes_mysql.h"
|
||||
#include "key.h" // key_copy
|
||||
#include "sql_plugin.h"
|
||||
#include <m_ctype.h>
|
||||
@@ -1625,10 +1624,8 @@ int ha_myisam::index_read_map(uchar *buf, const uchar *key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
int error=mi_rkey(file, buf, active_index, key, keypart_map, find_flag);
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1636,45 +1633,35 @@ int ha_myisam::index_read_idx_map(uchar *buf, uint index, const uchar *key,
|
||||
key_part_map keypart_map,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
int error=mi_rkey(file, buf, index, key, keypart_map, find_flag);
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_myisam::index_next(uchar *buf)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
int error=mi_rnext(file,buf,active_index);
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_myisam::index_prev(uchar *buf)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
int error=mi_rprev(file,buf, active_index);
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_myisam::index_first(uchar *buf)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
int error=mi_rfirst(file, buf, active_index);
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_myisam::index_last(uchar *buf)
|
||||
{
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
int error=mi_rlast(file, buf, active_index);
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1684,12 +1671,10 @@ int ha_myisam::index_next_same(uchar *buf,
|
||||
{
|
||||
int error;
|
||||
DBUG_ASSERT(inited==INDEX);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
do
|
||||
{
|
||||
error= mi_rnext_same(file,buf);
|
||||
} while (error == HA_ERR_RECORD_DELETED);
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1703,10 +1688,7 @@ int ha_myisam::rnd_init(bool scan)
|
||||
|
||||
int ha_myisam::rnd_next(uchar *buf)
|
||||
{
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
TRUE);
|
||||
int error=mi_scan(file, buf);
|
||||
MYSQL_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1723,10 +1705,7 @@ int ha_myisam::restart_rnd_next(uchar *buf)
|
||||
|
||||
int ha_myisam::rnd_pos(uchar *buf, uchar *pos)
|
||||
{
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
FALSE);
|
||||
int error=mi_rrnd(file, buf, my_get_ptr(pos,ref_length));
|
||||
MYSQL_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,6 @@
|
||||
#include "sql_cache.h" // query_cache_*
|
||||
#include "sql_show.h" // append_identifier
|
||||
#include "sql_table.h" // build_table_filename
|
||||
#include "probes_mysql.h"
|
||||
#include <mysql/plugin.h>
|
||||
#include <m_ctype.h>
|
||||
#include "../myisam/ha_myisam.h"
|
||||
@@ -1083,11 +1082,9 @@ int ha_myisammrg::index_read_map(uchar * buf, const uchar * key,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_key_count);
|
||||
int error=myrg_rkey(file,buf,active_index, key, keypart_map, find_flag);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1096,11 +1093,9 @@ int ha_myisammrg::index_read_idx_map(uchar * buf, uint index, const uchar * key,
|
||||
enum ha_rkey_function find_flag)
|
||||
{
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_key_count);
|
||||
int error=myrg_rkey(file,buf,index, key, keypart_map, find_flag);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1108,56 +1103,46 @@ int ha_myisammrg::index_read_last_map(uchar *buf, const uchar *key,
|
||||
key_part_map keypart_map)
|
||||
{
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_key_count);
|
||||
int error=myrg_rkey(file,buf,active_index, key, keypart_map,
|
||||
HA_READ_PREFIX_LAST);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_myisammrg::index_next(uchar * buf)
|
||||
{
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_next_count);
|
||||
int error=myrg_rnext(file,buf,active_index);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_myisammrg::index_prev(uchar * buf)
|
||||
{
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_prev_count);
|
||||
int error=myrg_rprev(file,buf, active_index);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_myisammrg::index_first(uchar * buf)
|
||||
{
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_first_count);
|
||||
int error=myrg_rfirst(file, buf, active_index);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
int ha_myisammrg::index_last(uchar * buf)
|
||||
{
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_last_count);
|
||||
int error=myrg_rlast(file, buf, active_index);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1167,14 +1152,12 @@ int ha_myisammrg::index_next_same(uchar * buf,
|
||||
{
|
||||
int error;
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_INDEX_READ_ROW_START(table_share->db.str, table_share->table_name.str);
|
||||
ha_statistic_increment(&SSV::ha_read_next_count);
|
||||
do
|
||||
{
|
||||
error= myrg_rnext_same(file,buf);
|
||||
} while (error == HA_ERR_RECORD_DELETED);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_INDEX_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1189,12 +1172,9 @@ int ha_myisammrg::rnd_init(bool scan)
|
||||
int ha_myisammrg::rnd_next(uchar *buf)
|
||||
{
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
TRUE);
|
||||
ha_statistic_increment(&SSV::ha_read_rnd_next_count);
|
||||
int error=myrg_rrnd(file, buf, HA_OFFSET_ERROR);
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
@@ -1202,12 +1182,9 @@ int ha_myisammrg::rnd_next(uchar *buf)
|
||||
int ha_myisammrg::rnd_pos(uchar * buf, uchar *pos)
|
||||
{
|
||||
DBUG_ASSERT(this->file->children_attached);
|
||||
MYSQL_READ_ROW_START(table_share->db.str, table_share->table_name.str,
|
||||
TRUE);
|
||||
ha_statistic_increment(&SSV::ha_read_rnd_count);
|
||||
int error=myrg_rrnd(file, buf, my_get_ptr(pos,ref_length));
|
||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||
MYSQL_READ_ROW_DONE(error);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user