Copies rows from the given db into the output file then deletes them.

def _FlushAllRows(self, db_connection, table_name):
    """Copies rows from the given db into the output file then deletes them."""
    for sql in db_connection.iterdump():
      if (sql.startswith("CREATE TABLE") or
          sql.startswith("BEGIN TRANSACTION") or sql.startswith("COMMIT")):
        # These statements only need to be written once.
        continue
      # The archive generator expects strings (not Unicode objects returned by
      # the pysqlite library).
      yield self.archive_generator.WriteFileChunk((sql + "\n").encode("utf-8"))
    with db_connection:
      db_connection.cursor().execute("DELETE FROM \"%s\";" % table_name)