1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

less boilerplate code - move common operations to wrappers

This commit is contained in:
Sergei Golubchik
2011-07-14 18:24:01 +02:00
parent a844635637
commit 4b70fc0c56
8 changed files with 23 additions and 150 deletions

View File

@@ -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 */