diff --git a/src/config.h b/src/config.h index 6cf00634..e306c398 100644 --- a/src/config.h +++ b/src/config.h @@ -13,7 +13,7 @@ #define VERSION "0.1.23-master-branch" -#define BUILD 774 +#define BUILD 775 #define HOSTID "mailarchiver" diff --git a/src/pilerexport.c b/src/pilerexport.c index 09302a93..b318da06 100644 --- a/src/pilerexport.c +++ b/src/pilerexport.c @@ -319,15 +319,16 @@ int main(int argc, char **argv){ (void) openlog("pilerexport", LOG_PID, LOG_MAIL); + if(exportall == 1){ + rc = append_string_to_buffer(&query, "SELECT `id`, `piler_id`, `digest`, `bodydigest` FROM "); + rc += append_string_to_buffer(&query, SQL_METADATA_TABLE); + goto GO; + } + snprintf(s, sizeof(s)-1, "SELECT DISTINCT `id`, `piler_id`, `digest`, `bodydigest` FROM %s WHERE ", SQL_MESSAGES_VIEW); rc = append_string_to_buffer(&query, s); - if(exportall == 1){ - rc += append_string_to_buffer(&query, "1=1"); - } - - if(from){ rc += append_string_to_buffer(&query, "`from` IN ("); rc += append_string_to_buffer(&query, from); @@ -390,11 +391,11 @@ int main(int argc, char **argv){ rc += append_string_to_buffer(&query, " ORDER BY id ASC"); + +GO: if(rc) p_clean_exit("malloc problem building query", 1); - - cfg = read_config(configfile);