nsertProcessState :: DBInfo -> IO DBInfo
insertProcessState dbi = do
    let conn = db_connection dbi
        inlist = map (\(mid,pid,start,duration,state) ->
            ((db_processes dbi) M.! (mid,pid), start, duration, stateToInt state))
                $ db_processbuffer dbi
    executeMany conn insertProcessStateQuery inlist
    return dbi {db_processbuffer = []}

insertProcessState :: DBInfo -> IO DBInfo
insertProcessState dbi = do
    let conn = db_connection dbi
        inlist = map (\(mid,pid,start,duration,state) ->
            ((db_processes dbi) M.! (mid,pid), start, duration, stateToInt state))
                $ db_processbuffer dbi
    executeMany conn insertProcessStateQuery inlist
    return dbi {db_processbuffer = []}
insertProcessState dbi = do
    let conn = db_connection dbi
        inlist = map (\(mid,pid,start,duration,state) ->
            ((db_processes dbi) M.! (mid,pid), start, duration, stateToInt state))
                $ db_processbuffer dbi
    executeMany conn insertProcessStateQuery inlist
    return dbi {db_processbuffer = []}