folder reindex fix

This commit is contained in:
SJ 2016-01-24 15:23:47 +01:00
parent ff3673d635
commit fe3d5f9744
3 changed files with 11 additions and 2 deletions

View File

@ -13,7 +13,7 @@
#define VERSION "1.2.0-master" #define VERSION "1.2.0-master"
#define BUILD 935 #define BUILD 936
#define HOSTID "mailarchiver" #define HOSTID "mailarchiver"

View File

@ -82,7 +82,11 @@ uint64 retrieve_email_by_metadata_id(struct session_data *sdata, struct __data *
delta = to_id - from_id; delta = to_id - from_id;
snprintf(s, sizeof(s)-1, "SELECT `id`, `piler_id`, `arrived`, `sent` FROM %s WHERE (id BETWEEN %llu AND %llu) AND `deleted`=0", SQL_METADATA_TABLE, from_id, to_id); if(cfg->enable_folders == 1)
snprintf(s, sizeof(s)-1, "SELECT m.`id`, `piler_id`, `arrived`, `sent`, f.folder_id FROM %s m, %s f WHERE m.id=f.id AND (m.id BETWEEN %llu AND %llu) AND `deleted`=0", SQL_METADATA_TABLE, SQL_FOLDER_MESSAGE_TABLE, from_id, to_id);
else
snprintf(s, sizeof(s)-1, "SELECT `id`, `piler_id`, `arrived`, `sent` FROM %s WHERE (id BETWEEN %llu AND %llu) AND `deleted`=0", SQL_METADATA_TABLE, from_id, to_id);
if(prepare_sql_statement(sdata, &(data->stmt_generic), s, cfg) == ERR) return reindexed; if(prepare_sql_statement(sdata, &(data->stmt_generic), s, cfg) == ERR) return reindexed;
@ -96,6 +100,9 @@ uint64 retrieve_email_by_metadata_id(struct session_data *sdata, struct __data *
data->sql[data->pos] = sdata->ttmpfile; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = RND_STR_LEN+2; data->pos++; data->sql[data->pos] = sdata->ttmpfile; data->type[data->pos] = TYPE_STRING; data->len[data->pos] = RND_STR_LEN+2; data->pos++;
data->sql[data->pos] = (char *)&(sdata->now); data->type[data->pos] = TYPE_LONG; data->len[data->pos] = sizeof(unsigned long); data->pos++; data->sql[data->pos] = (char *)&(sdata->now); data->type[data->pos] = TYPE_LONG; data->len[data->pos] = sizeof(unsigned long); data->pos++;
data->sql[data->pos] = (char *)&(sdata->sent); data->type[data->pos] = TYPE_LONG; data->len[data->pos] = sizeof(unsigned long); data->pos++; data->sql[data->pos] = (char *)&(sdata->sent); data->type[data->pos] = TYPE_LONG; data->len[data->pos] = sizeof(unsigned long); data->pos++;
if(cfg->enable_folders == 1){
data->sql[data->pos] = (char *)&(data->folder); data->type[data->pos] = TYPE_LONG; data->len[data->pos] = sizeof(unsigned long); data->pos++;
}
p_store_results(sdata, data->stmt_generic, data); p_store_results(sdata, data->stmt_generic, data);

View File

@ -322,6 +322,8 @@ int get_folder_id_by_rule(struct __data *data, struct parser_state *state, int s
struct node *q; struct node *q;
int ismatch; int ismatch;
if(cfg->enable_folders == 0) return 0;
q = data->folder_rules[0]; q = data->folder_rules[0];
while(q != NULL){ while(q != NULL){