93
96
result_list.tmp_sqls = NULL;
94
97
result_list.tmp_tables_created = FALSE;
95
98
result_list.bgs_working = FALSE;
99
result_list.direct_order_limit = FALSE;
96
100
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
97
101
result_list.hs_has_result = FALSE;
98
102
#ifndef HANDLERSOCKET_MYSQL_UTIL
148
155
result_list.tmp_sqls = NULL;
149
156
result_list.tmp_tables_created = FALSE;
150
157
result_list.bgs_working = FALSE;
158
result_list.direct_order_limit = FALSE;
151
159
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
152
160
result_list.hs_has_result = FALSE;
153
161
#ifndef HANDLERSOCKET_MYSQL_UTIL
532
540
conns[roop_count] = NULL;
545
st_spider_ft_info *tmp_ft_info;
547
tmp_ft_info = ft_first->next;
548
my_free(ft_first, MYF(0));
549
ft_first = tmp_ft_info;
535
553
spider_db_free_result(this, TRUE);
1343
1363
result_list.have_sql_kind_backup = FALSE;
1364
result_list.direct_order_limit = FALSE;
1365
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
1366
#ifndef HANDLERSOCKET_MYSQL_UTIL
1368
if (result_list.hs_da_init)
1369
spider_db_free_str_dynamic(&result_list.hs_strs);
1344
1372
DBUG_RETURN(error_num);
1561
1590
spider_db_free_one_result_for_start_next(this);
1562
1591
lock_mode = spider_conn_lock_mode(this);
1563
1592
spider_set_result_list_param(this);
1593
check_direct_order_limit();
1564
1594
start_key.key = key;
1565
1595
start_key.keypart_map = keypart_map;
1566
1596
start_key.flag = find_flag;
2713
2746
pt_clone_source_handler->pt_clone_last_searcher = this;
2715
2748
spider_db_free_one_result_for_start_next(this);
2749
check_direct_order_limit();
2716
2750
result_list.sql.length(0);
2717
2751
result_list.ha_sql.length(0);
2718
2752
#ifndef WITHOUT_SPIDER_BG_SEARCH
5536
5573
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
5538
5575
result_list.order_pos = result_list.sql.length();
5577
result_list.direct_order_limit &&
5578
(error_num = spider_db_append_key_order(this, FALSE))
5580
DBUG_RETURN(error_num);
5539
5581
result_list.limit_pos = result_list.order_pos;
5540
5582
result_list.ha_limit_pos = result_list.ha_sql.length();
5541
5583
result_list.desc_flg = FALSE;
5794
5836
DBUG_RETURN(spider_db_seek_tmp(buf, tmp_pos, this, table));
5839
float spider_ft_find_relevance(
5844
DBUG_ENTER("spider_ft_find_relevance");
5845
st_spider_ft_info *info = (st_spider_ft_info*) handler;
5846
DBUG_PRINT("info",("spider info=%p", info));
5847
DBUG_PRINT("info",("spider score=%f", info->score));
5848
DBUG_RETURN(info->score);
5851
float spider_ft_get_relevance(
5854
DBUG_ENTER("spider_ft_get_relevance");
5855
st_spider_ft_info *info = (st_spider_ft_info*) handler;
5856
DBUG_PRINT("info",("spider info=%p", info));
5857
DBUG_PRINT("info",("spider score=%f", info->score));
5858
DBUG_RETURN(info->score);
5861
void spider_ft_close_search(
5864
DBUG_ENTER("spider_ft_close_search");
5868
_ft_vft spider_ft_vft = {
5869
NULL, // spider_ft_read_next
5870
spider_ft_find_relevance,
5871
spider_ft_close_search,
5872
spider_ft_get_relevance,
5873
NULL // spider_ft_reinit_search
5797
5876
int ha_spider::ft_init()
5878
int roop_count, error_num;
5800
5879
DBUG_ENTER("ha_spider::ft_init");
5801
5880
DBUG_PRINT("info",("spider this=%x", this));
5881
if (store_error_num)
5882
DBUG_RETURN(store_error_num);
5883
if (active_index == MAX_KEY && inited == NONE)
5885
st_spider_ft_info *ft_info = ft_first;
5886
ft_init_without_index_init = TRUE;
5887
ft_init_idx = MAX_KEY;
5890
if (ft_info->used_in_where)
5892
ft_init_idx = ft_info->inx;
5893
if ((error_num = index_init(ft_init_idx, FALSE)))
5894
DBUG_RETURN(error_num);
5895
active_index = MAX_KEY;
5898
if (ft_info == ft_current)
5900
ft_info = ft_info->next;
5902
if (ft_init_idx == MAX_KEY)
5904
if ((error_num = rnd_init(TRUE)))
5905
DBUG_RETURN(error_num);
5908
ft_init_idx = active_index;
5909
ft_init_without_index_init = FALSE;
5802
5912
ft_init_and_first = TRUE;
5804
5914
for (roop_count = 0; roop_count < share->link_count; roop_count++)
5812
5922
DBUG_ENTER("ha_spider::ft_end");
5813
5923
DBUG_PRINT("info",("spider this=%x", this));
5814
5924
ft_handler = NULL;
5927
if (ft_init_without_index_init)
5929
if (ft_init_idx == MAX_KEY)
5930
store_error_num = rnd_end();
5932
store_error_num = index_end();
5934
ft_init_without_index_init = FALSE;
5816
5935
DBUG_VOID_RETURN;
5943
st_spider_ft_info *tmp_ft_info;
5824
5944
DBUG_ENTER("ha_spider::ft_init_ext");
5825
5945
DBUG_PRINT("info",("spider this=%x", this));
5826
DBUG_PRINT("info",("vp flags=%u", flags));
5827
DBUG_PRINT("info",("vp inx=%u", inx));
5828
DBUG_PRINT("info",("vp key=%s", key->ptr()));
5829
ft_init_flags = flags;
5946
DBUG_PRINT("info",("spider flags=%u", flags));
5947
DBUG_PRINT("info",("spider inx=%u", inx));
5948
DBUG_PRINT("info",("spider key=%s", key->ptr()));
5949
tmp_ft_info = ft_current;
5951
ft_current = ft_current->next;
5953
ft_current = ft_first;
5957
if (!(ft_current = (st_spider_ft_info *)
5958
my_malloc(sizeof(st_spider_ft_info), MYF(MY_WME | MY_ZEROFILL))))
5960
store_error_num = HA_ERR_OUT_OF_MEM;
5964
tmp_ft_info->next = ft_current;
5966
ft_first = ft_current;
5969
ft_current->please = &spider_ft_vft;
5970
ft_current->file = this;
5971
ft_current->used_in_where = (flags & FT_SORTED);
5972
ft_current->target = ft_count;
5973
ft_current->flags = flags;
5974
ft_current->inx = inx;
5975
ft_current->key = key;
5978
DBUG_RETURN((FT_INFO *) ft_current);
5834
5981
int ha_spider::ft_read(
5864
6012
DBUG_RETURN(error_num);
6014
ft_init_idx < MAX_KEY &&
5866
6015
share->key_hint &&
5867
6016
(error_num = spider_db_append_hint_after_table(this,
5868
&result_list.sql, &share->key_hint[active_index]))
6017
&result_list.sql, &share->key_hint[ft_init_idx]))
5870
6019
DBUG_RETURN(HA_ERR_OUT_OF_MEM);
5871
6020
result_list.where_pos = result_list.sql.length();
5872
6021
result_list.desc_flg = FALSE;
5873
6022
result_list.sorted = TRUE;
5874
result_list.key_info = &table->key_info[active_index];
6023
if (ft_init_idx == MAX_KEY)
6024
result_list.key_info = NULL;
6026
result_list.key_info = &table->key_info[ft_init_idx];
5875
6027
result_list.key_order = 0;
5876
6028
result_list.limit_num =
5877
6029
result_list.internal_limit >= result_list.split_read ?
5878
6030
result_list.split_read : result_list.internal_limit;
5880
(error_num = spider_db_append_match_where(this))
6032
(error_num = spider_db_append_match_where(this)) ||
6034
result_list.direct_order_limit &&
6035
(error_num = spider_db_append_key_order(this, FALSE))
5882
6038
DBUG_RETURN(error_num);
5883
6039
result_list.limit_pos = result_list.sql.length();
7600
7760
DBUG_VOID_RETURN;
7603
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
7604
7763
int ha_spider::info_push(
7605
7764
uint info_type,
7608
7767
DBUG_ENTER("ha_spider::info_push");
7768
#ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
7609
7769
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
7610
7770
if (info_type == INFO_KIND_HS_RET_FIELDS)
7877
8037
DBUG_RETURN(0);
8040
void ha_spider::check_direct_order_limit()
8043
DBUG_ENTER("ha_spider::check_direct_order_limit");
8044
DBUG_PRINT("info",("spider this=%x", this));
8045
if (!result_list.check_direct_order_limit)
8047
if (spider_check_direct_order_limit(this))
8049
result_list.direct_order_limit = TRUE;
8050
sql_kinds = SPIDER_SQL_KIND_SQL;
8051
for (roop_count = 0; roop_count < share->link_count; roop_count++)
8052
sql_kind[roop_count] = SPIDER_SQL_KIND_SQL;
8054
result_list.direct_order_limit = FALSE;
8055
result_list.check_direct_order_limit = TRUE;
7880
8060
int ha_spider::drop_tmp_tables()
7882
8062
int error_num = 0, tmp_error_num;