修复编码转换失败后,丢失表达式子项的bug。

This commit is contained in:
zhengchao
2016-06-24 11:49:15 +08:00
parent 5845a06b3f
commit 19f248a341
2 changed files with 8 additions and 3 deletions

View File

@@ -26,7 +26,7 @@
#include "mesa_fuzzy.h"
#include "great_index_engine.h"
int MAAT_FRAME_VERSION_1_8_20160623_PERF_TEST=1;
int MAAT_FRAME_VERSION_1_8_20160624_PERF_TEST=1;
const char *maat_module="MAAT Frame";
const char* CHARSET_STRING[]={"NONE","gbk","big5","unicode","utf8","bin",
@@ -810,6 +810,7 @@ struct op_expr_t* create_op_expr(unsigned int expr_id,int operation,void* u_para
struct op_expr_t* op_expr=NULL;
op_expr=(struct op_expr_t*)calloc(sizeof(struct op_expr_t),1);
op_expr->no_effect_convert_cnt=0;
op_expr->convert_failed=0;
op_expr->p_expr=(boolean_expr_t*)calloc(sizeof(boolean_expr_t),1);
op_expr->p_expr->expr_id=expr_id;
op_expr->p_expr->operation=operation;
@@ -1536,7 +1537,8 @@ int add_expr_rule(struct _Maat_table_info_t* table,struct db_str_rule_t* db_rule
,CHARSET_STRING[table->src_charset]
,CHARSET_STRING[dst_charset]);
free(region_string);
continue;
op_expr->convert_failed++;
break;
}
if(region_str_len==(int)strlen(sub_key_array[k])&&
0==memcmp(sub_key_array[k],region_string,region_str_len))
@@ -1561,7 +1563,9 @@ int add_expr_rule(struct _Maat_table_info_t* table,struct db_str_rule_t* db_rule
region_string=NULL;
}
//if each sub string's convert take no effect and src charset is one of the dst.
if(TRUE==table->src_charset_in_dst&&op_expr->no_effect_convert_cnt==sub_expr_cnt)
//if any sub expr convert failed
if((TRUE==table->src_charset_in_dst&&op_expr->no_effect_convert_cnt==sub_expr_cnt)||
op_expr->convert_failed>0)
{
destroy_op_expr(op_expr);
op_expr=NULL;