Work around issue with ON CONFLICT IGNORE and cursor.lastrowid being inconsistent.