'Possibly open a database connection for the secondary thread.
If the connection is not open (for the calling thread, which is assumed
to be the unique secondary thread), then open it. We also open a couple
cursors for later use (and reuse).'

def _OpenSecondaryConnection(self):

    if self.secondary_conn:
        return
    assert (not _RunningInThread(self.primary_thread))
    self.secondary_thread = threading.currentThread()
    self.secondary_conn = sqlite3.connect(self.db_filename)
    self.insert_cursor = self.secondary_conn.cursor()
    self.update_cursor = self.secondary_conn.cursor()
