(self)
return exists, context
Check for existence of a database, but take into consideration whether the db is case-sensitive or not.

        If not case-sensitive, then we normalize the database name to lowercase on both sides and check.
        If case-sensitive, then we only accept exact-name matches.

        If the check fails, then we won't do any checks if `ignore_missing_database` is enabled, or we will fail
        with a ConfigurationError otherwise.
Check for existence of a database, but take into consideration whether the db is case-sensitive or not.
Check for existence of a database but take into consideration whether the db is case - sensitive or not .
def _check_db_exists(self):
        """
        Check for existence of a database, but take into consideration whether the db is case-sensitive or not.

        If not case-sensitive, then we normalize the database name to lowercase on both sides and check.
        If case-sensitive, then we only accept exact-name matches.

        If the check fails, then we won't do any checks if `ignore_missing_database` is enabled, or we will fail
        with a ConfigurationError otherwise.
        """

        _, host, _, _, database, _ = self._get_access_info(self.DEFAULT_DB_KEY)
        context = "{} - {}".format(host, database)
        if self.existing_databases is None:
            cursor = self.get_cursor(None, self.DEFAULT_DATABASE)

            try:
                self.existing_databases = {}
                cursor.execute(DATABASE_EXISTS_QUERY)
                for row in cursor:
                    # collation_name can be NULL if db offline, in that case assume its case_insensitive
                    case_insensitive = not row.collation_name or 'CI' in row.collation_name
                    self.existing_databases[row.name.lower()] = case_insensitive, row.name

            except Exception as e:
                self.log.error("Failed to check if database %s exists: %s", database, e)
                return False, context
            finally:
                self.close_cursor(cursor)

        exists = False
        if database.lower() in self.existing_databases:
            case_insensitive, cased_name = self.existing_databases[database.lower()]
            if case_insensitive or database == cased_name:
                exists = True

        return exists, context
def _check_db_exists ( self ) : _ , host , _ , _ , database , _ = self . _get_access_info ( self . DEFAULT_DB_KEY ) context = "{} - {}" . format ( host , database ) if self . existing_databases is None : cursor = self . get_cursor ( None , self . DEFAULT_DATABASE ) try : self . existing_databases = { } cursor . execute ( DATABASE_EXISTS_QUERY ) for row in cursor : # collation_name can be NULL if db offline, in that case assume its case_insensitive case_insensitive = not row . collation_name or 'CI' in row . collation_name self . existing_databases [ row . name . lower ( ) ] = case_insensitive , row . name except Exception as e : self . log . error ( "Failed to check if database %s exists: %s" , database , e ) return False , context finally : self . close_cursor ( cursor ) exists = False if database . lower ( ) in self . existing_databases : case_insensitive , cased_name = self . existing_databases [ database . lower ( ) ] if case_insensitive or database == cased_name : exists = True return exists , context