mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
use handler no where clause
This commit is contained in:
parent
a99b54cf1f
commit
f41f5f742f
6 changed files with 63 additions and 14 deletions
|
@ -154,6 +154,7 @@ ha_spider::ha_spider(
|
||||||
result_list.direct_aggregate = FALSE;
|
result_list.direct_aggregate = FALSE;
|
||||||
#endif
|
#endif
|
||||||
result_list.casual_read = NULL;
|
result_list.casual_read = NULL;
|
||||||
|
result_list.use_both_key = FALSE;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,6 +259,7 @@ ha_spider::ha_spider(
|
||||||
result_list.direct_aggregate = FALSE;
|
result_list.direct_aggregate = FALSE;
|
||||||
#endif
|
#endif
|
||||||
result_list.casual_read = NULL;
|
result_list.casual_read = NULL;
|
||||||
|
result_list.use_both_key = FALSE;
|
||||||
ref_length = sizeof(SPIDER_POSITION);
|
ref_length = sizeof(SPIDER_POSITION);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
@ -1714,6 +1716,7 @@ int ha_spider::reset()
|
||||||
clone_bitmap_init = FALSE;
|
clone_bitmap_init = FALSE;
|
||||||
result_list.tmp_table_join = FALSE;
|
result_list.tmp_table_join = FALSE;
|
||||||
result_list.use_union = FALSE;
|
result_list.use_union = FALSE;
|
||||||
|
result_list.use_both_key = FALSE;
|
||||||
pt_clone_last_searcher = NULL;
|
pt_clone_last_searcher = NULL;
|
||||||
conn_kinds = SPIDER_CONN_KIND_MYSQL;
|
conn_kinds = SPIDER_CONN_KIND_MYSQL;
|
||||||
has_clone_for_merge = FALSE;
|
has_clone_for_merge = FALSE;
|
||||||
|
@ -4126,10 +4129,14 @@ int ha_spider::read_range_first(
|
||||||
if ((error_num = spider_bg_all_conn_pre_next(this, search_link_idx)))
|
if ((error_num = spider_bg_all_conn_pre_next(this, search_link_idx)))
|
||||||
DBUG_RETURN(error_num);
|
DBUG_RETURN(error_num);
|
||||||
use_pre_call = FALSE;
|
use_pre_call = FALSE;
|
||||||
DBUG_RETURN(read_range_next());
|
if ((error_num = read_range_next()))
|
||||||
|
DBUG_RETURN(error_num);
|
||||||
|
DBUG_RETURN(check_ha_range_eof());
|
||||||
}
|
}
|
||||||
DBUG_RETURN(read_range_first_internal(table->record[0], start_key, end_key,
|
if ((error_num = read_range_first_internal(table->record[0], start_key,
|
||||||
eq_range, sorted));
|
end_key, eq_range, sorted)))
|
||||||
|
DBUG_RETURN(error_num);
|
||||||
|
DBUG_RETURN(check_ha_range_eof());
|
||||||
}
|
}
|
||||||
|
|
||||||
int ha_spider::read_range_next()
|
int ha_spider::read_range_next()
|
||||||
|
@ -4160,7 +4167,7 @@ int ha_spider::read_range_next()
|
||||||
if ((error_num = spider_db_seek_next(table->record[0], this, search_link_idx,
|
if ((error_num = spider_db_seek_next(table->record[0], this, search_link_idx,
|
||||||
table)))
|
table)))
|
||||||
DBUG_RETURN(check_error_mode_eof(error_num));
|
DBUG_RETURN(check_error_mode_eof(error_num));
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(check_ha_range_eof());
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||||
|
@ -4687,7 +4694,7 @@ int ha_spider::read_multi_range_first_internal(
|
||||||
#else
|
#else
|
||||||
*found_range_p = multi_range_curr;
|
*found_range_p = multi_range_curr;
|
||||||
#endif
|
#endif
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(check_ha_range_eof());
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
error_num != HA_ERR_END_OF_FILE &&
|
error_num != HA_ERR_END_OF_FILE &&
|
||||||
|
@ -5743,7 +5750,7 @@ int ha_spider::read_multi_range_next(
|
||||||
) {
|
) {
|
||||||
if (!(error_num = spider_db_seek_next(table->record[0], this,
|
if (!(error_num = spider_db_seek_next(table->record[0], this,
|
||||||
search_link_idx, table)))
|
search_link_idx, table)))
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(check_ha_range_eof());
|
||||||
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
#ifdef HA_MRR_USE_DEFAULT_IMPL
|
||||||
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
|
range_res = mrr_funcs.next(mrr_iter, &mrr_cur_range);
|
||||||
DBUG_PRINT("info",("spider range_res1=%d", range_res));
|
DBUG_PRINT("info",("spider range_res1=%d", range_res));
|
||||||
|
@ -6092,7 +6099,7 @@ int ha_spider::read_multi_range_next(
|
||||||
#else
|
#else
|
||||||
*found_range_p = multi_range_curr;
|
*found_range_p = multi_range_curr;
|
||||||
#endif
|
#endif
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(check_ha_range_eof());
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
error_num != HA_ERR_END_OF_FILE &&
|
error_num != HA_ERR_END_OF_FILE &&
|
||||||
|
@ -11489,6 +11496,35 @@ void ha_spider::check_direct_order_limit()
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ha_spider::check_ha_range_eof()
|
||||||
|
{
|
||||||
|
DBUG_ENTER("ha_spider::check_ha_range_eof");
|
||||||
|
DBUG_PRINT("info",("spider this=%p", this));
|
||||||
|
const key_range *end_key = result_list.end_key;
|
||||||
|
DBUG_PRINT("info",("spider use_both_key=%s",
|
||||||
|
result_list.use_both_key ? "TRUE" : "FALSE"));
|
||||||
|
DBUG_PRINT("info",("spider sql_kind[%u]=%u",
|
||||||
|
search_link_idx, sql_kind[search_link_idx]));
|
||||||
|
DBUG_PRINT("info",("spider sql_command=%u", sql_command));
|
||||||
|
if (
|
||||||
|
result_list.use_both_key &&
|
||||||
|
(sql_kind[search_link_idx] & SPIDER_SQL_KIND_HANDLER) &&
|
||||||
|
sql_command != SQLCOM_HA_READ
|
||||||
|
) {
|
||||||
|
int cmp_result = key_cmp(result_list.key_info->key_part,
|
||||||
|
end_key->key, end_key->length);
|
||||||
|
DBUG_PRINT("info",("spider cmp_result=%d", cmp_result));
|
||||||
|
if (
|
||||||
|
cmp_result > 0 ||
|
||||||
|
(end_key->flag == HA_READ_BEFORE_KEY && !cmp_result)
|
||||||
|
) {
|
||||||
|
table->status = STATUS_NOT_FOUND;
|
||||||
|
DBUG_RETURN(HA_ERR_END_OF_FILE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DBUG_RETURN(0);
|
||||||
|
}
|
||||||
|
|
||||||
int ha_spider::drop_tmp_tables()
|
int ha_spider::drop_tmp_tables()
|
||||||
{
|
{
|
||||||
int error_num = 0, tmp_error_num, need_mon;
|
int error_num = 0, tmp_error_num, need_mon;
|
||||||
|
|
|
@ -740,6 +740,7 @@ public:
|
||||||
);
|
);
|
||||||
uint check_partitioned();
|
uint check_partitioned();
|
||||||
void check_direct_order_limit();
|
void check_direct_order_limit();
|
||||||
|
int check_ha_range_eof();
|
||||||
int drop_tmp_tables();
|
int drop_tmp_tables();
|
||||||
bool handler_opened(
|
bool handler_opened(
|
||||||
int link_idx,
|
int link_idx,
|
||||||
|
|
|
@ -1595,9 +1595,10 @@ int spider_db_append_key_where_internal(
|
||||||
start_key_part_map = 0;
|
start_key_part_map = 0;
|
||||||
use_both = FALSE;
|
use_both = FALSE;
|
||||||
}
|
}
|
||||||
if (end_key)
|
if (end_key) {
|
||||||
end_key_part_map = end_key->keypart_map & full_key_part_map;
|
end_key_part_map = end_key->keypart_map & full_key_part_map;
|
||||||
else {
|
result_list->end_key = end_key;
|
||||||
|
} else {
|
||||||
end_key_part_map = 0;
|
end_key_part_map = 0;
|
||||||
use_both = FALSE;
|
use_both = FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1657,6 +1658,8 @@ int spider_db_append_key_where_internal(
|
||||||
tgt_key_part_map = end_key_part_map;
|
tgt_key_part_map = end_key_part_map;
|
||||||
}
|
}
|
||||||
DBUG_PRINT("info", ("spider tgt_key_part_map=%lu", tgt_key_part_map));
|
DBUG_PRINT("info", ("spider tgt_key_part_map=%lu", tgt_key_part_map));
|
||||||
|
if (start_key_part_map == end_key_part_map)
|
||||||
|
result_list->use_both_key = TRUE;
|
||||||
|
|
||||||
if (sql_kind == SPIDER_SQL_KIND_SQL)
|
if (sql_kind == SPIDER_SQL_KIND_SQL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1591,6 +1591,8 @@ typedef struct st_spider_result_list
|
||||||
uint *sql_kind_backup;
|
uint *sql_kind_backup;
|
||||||
uint sql_kinds_backup;
|
uint sql_kinds_backup;
|
||||||
bool use_union;
|
bool use_union;
|
||||||
|
bool use_both_key;
|
||||||
|
const key_range *end_key;
|
||||||
spider_string *insert_sqls;
|
spider_string *insert_sqls;
|
||||||
spider_string *update_sqls;
|
spider_string *update_sqls;
|
||||||
TABLE **upd_tmp_tbls;
|
TABLE **upd_tmp_tbls;
|
||||||
|
|
|
@ -7119,10 +7119,17 @@ int spider_mysql_handler::append_condition_part(
|
||||||
}
|
}
|
||||||
ha_where_pos = str->length();
|
ha_where_pos = str->length();
|
||||||
|
|
||||||
if (sql_part2.length())
|
if (
|
||||||
{
|
spider->sql_command == SQLCOM_HA_READ ||
|
||||||
str->append(sql_part2);
|
!spider->result_list.use_both_key
|
||||||
start_where = FALSE;
|
) {
|
||||||
|
if (sql_part2.length())
|
||||||
|
{
|
||||||
|
str->append(sql_part2);
|
||||||
|
start_where = FALSE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
#define SPIDER_DETAIL_VERSION "3.1.13"
|
#define SPIDER_DETAIL_VERSION "3.1.14"
|
||||||
#define SPIDER_HEX_VERSION 0x0301
|
#define SPIDER_HEX_VERSION 0x0301
|
||||||
|
|
||||||
#if MYSQL_VERSION_ID < 50500
|
#if MYSQL_VERSION_ID < 50500
|
||||||
|
|
Loading…
Reference in a new issue