statsthread' l c =
    do res <- quickQuery c "SELECT state, COUNT(*) from files group by state order by state" []
       let counts = map (\[thiss, thisc] -> (fromSql thiss, 
                                             (fromSql thisc)::Integer)) res
       let total = sum (map snd counts)
       let totaltext = "Total " ++ show total
       let statetxts = map (\(h, c) -> h ++ " " ++ show c) counts
       let disp = concat . intersperse ", " $ totaltext : statetxts
       msg disp
       threadDelay (120 * 1000000)
       statsthread' l c
statsthread' l c =
    do res <- quickQuery c "SELECT state, COUNT(*) from files group by state order by state" []
       let counts = map (\[thiss, thisc] -> (fromSql thiss, 
                                             (fromSql thisc)::Integer)) res
       let total = sum (map snd counts)
       let totaltext = "Total " ++ show total
       let statetxts = map (\(h, c) -> h ++ " " ++ show c) counts
       let disp = concat . intersperse ", " $ totaltext : statetxts
       msg disp
       threadDelay (120 * 1000000)
       statsthread' l c
statsthread' l c =
    do res <- quickQuery c "SELECT state, COUNT(*) from files group by state order by state" []
       let counts = map (\[thiss, thisc] -> (fromSql thiss, 
                                             (fromSql thisc)::Integer)) res
       let total = sum (map snd counts)
       let totaltext = "Total " ++ show total
       let statetxts = map (\(h, c) -> h ++ " " ++ show c) counts
       let disp = concat . intersperse ", " $ totaltext : statetxts
       msg disp
       threadDelay (120 * 1000000)
       statsthread' l c