@ -18,6 +18,7 @@ import java.sql.Timestamp;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.HashMap ;
import java.util.HashMap ;
import java.util.Map ;
import java.util.Map ;
import java.util.TreeMap ;
import static de.srsoftware.widerhall.Constants.* ;
import static de.srsoftware.widerhall.Constants.* ;
import static de.srsoftware.widerhall.Constants.VARCHAR ;
import static de.srsoftware.widerhall.Constants.VARCHAR ;
@ -173,9 +174,9 @@ public class Post {
return this ;
return this ;
}
}
public static Hash Map< String , Object > summarize ( MailingList list ) throws SQLException {
public static Map < String , Object > summarize ( MailingList list ) throws SQLException {
var sql = new StringBuilder ( "SELECT count(*) as count,strftime('%Y-%m',date/1000,'unixepoch') as month FROM Posts WHERE list = ? GROUP BY month ORDER BY month;" ) ;
var sql = new StringBuilder ( "SELECT count(*) as count,strftime('%Y-%m',date/1000,'unixepoch') as month FROM Posts WHERE list = ? GROUP BY month ORDER BY month;" ) ;
var map = new Hash Map< String , Object > ( ) ;
var map = new Tree Map< String , Object > ( ) ;
var rs = Database . open ( ) . query ( sql ) . compile ( list . email ( ) ) . exec ( ) ;
var rs = Database . open ( ) . query ( sql ) . compile ( list . email ( ) ) . exec ( ) ;
while ( rs . next ( ) ) map . put ( rs . getString ( "month" ) , rs . getInt ( "count" ) ) ;
while ( rs . next ( ) ) map . put ( rs . getString ( "month" ) , rs . getInt ( "count" ) ) ;
rs . close ( ) ;
rs . close ( ) ;