improved pilerexport

This commit is contained in:
SJ 2013-03-18 12:06:49 +01:00
parent 15f18eb939
commit a87b62264a
2 changed files with 9 additions and 8 deletions

View File

@ -13,7 +13,7 @@
#define VERSION "0.1.23-master-branch"
#define BUILD 774
#define BUILD 775
#define HOSTID "mailarchiver"

View File

@ -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);