'Saves the entire messagelist to the database.'

def saveall(self):

    with self._databaseFileLock.getLock():
        data = []
        for (uid, msg) in self.messagelist.items():
            mtime = msg['mtime']
            flags = ''.join(sorted(msg['flags']))
            labels = ',    '.join(sorted(msg['labels']))
            data.append((uid, flags, mtime, labels))
        self.__sql_write('INSERT    OR    REPLACE    INTO    status    (id,flags,mtime,labels)    VALUES    (?,?,?,?)', data, executemany=True)
