From d603f29feb2bf22b0cb58a8fee013cc66a20b84b Mon Sep 17 00:00:00 2001 From: SJ Date: Sun, 8 Jan 2012 22:38:09 +0100 Subject: [PATCH] pilerexport fix --- src/pilerexport.c | 8 ++++++++ util/db-mysql.sql | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pilerexport.c b/src/pilerexport.c index c8267692..47a7b217 100644 --- a/src/pilerexport.c +++ b/src/pilerexport.c @@ -343,6 +343,8 @@ int main(int argc, char **argv){ if(where_condition) rc = append_string_to_buffer(&query, " AND "); snprintf(s, sizeof(s)-1, " `size` >= %d", minsize); rc += append_string_to_buffer(&query, s); + + where_condition++; } @@ -350,6 +352,8 @@ int main(int argc, char **argv){ if(where_condition) rc = append_string_to_buffer(&query, " AND "); snprintf(s, sizeof(s)-1, " `size` <= %d", maxsize); rc += append_string_to_buffer(&query, s); + + where_condition++; } @@ -357,6 +361,8 @@ int main(int argc, char **argv){ if(where_condition) rc = append_string_to_buffer(&query, " AND "); snprintf(s, sizeof(s)-1, " `sent` >= %ld", startdate); rc += append_string_to_buffer(&query, s); + + where_condition++; } @@ -364,6 +370,8 @@ int main(int argc, char **argv){ if(where_condition) rc = append_string_to_buffer(&query, " AND "); snprintf(s, sizeof(s)-1, " `sent` <= %ld", stopdate); rc += append_string_to_buffer(&query, s); + + where_condition++; } diff --git a/util/db-mysql.sql b/util/db-mysql.sql index b21e2cd9..63a650bb 100644 --- a/util/db-mysql.sql +++ b/util/db-mysql.sql @@ -64,7 +64,7 @@ create index `rcpt_idx2` on `rcpt`(`to`); drop view if exists `messages`; -create view `messages` AS select `metadata`.`id` AS `id`,`metadata`.`piler_id` AS `piler_id`,`metadata`.`from` AS `from`,`rcpt`.`to` AS `to`,`metadata`.`subject` AS `subject`, `metadata`.`size` AS `size`, `metadata`.`direction` AS `direction`, `metadata`.`arrived` AS `arrived`, `metadata`.`digest` AS `digest`, `metadata`.`bodydigest` AS `bodydigest` from (`metadata` join `rcpt`) where (`metadata`.`id` = `rcpt`.`id`); +create view `messages` AS select `metadata`.`id` AS `id`,`metadata`.`piler_id` AS `piler_id`,`metadata`.`from` AS `from`,`rcpt`.`to` AS `to`,`metadata`.`subject` AS `subject`, `metadata`.`size` AS `size`, `metadata`.`direction` AS `direction`, `metadata`.`sent` AS `sent`, `metadata`.`digest` AS `digest`, `metadata`.`bodydigest` AS `bodydigest` from (`metadata` join `rcpt`) where (`metadata`.`id` = `rcpt`.`id`); drop table if exists `attachment`;