a00ea9be88393565c2cdf2e8b8904c493354ba54,mindsdb/integrations/mysql/mysql.py,MySQLConnectionChecker,check_connection,#MySQLConnectionChecker#,159

Before Change



    def check_connection(self):
        try:
            con = mysql.connector.connect(
                host=self.host,
                port=self.port,
                user=self.user,
                password=self.password
            )
            connected = con.is_connected()
            con.close()
        except Exception:
            connected = False
        return connected

After Change



    def check_connection(self):
        try:
            con = self._get_connnection()
            with closing(con) as con:
                connected = con.is_connected()
        except Exception:
            connected = False
        return connected
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: mindsdb/mindsdb
Commit Name: a00ea9be88393565c2cdf2e8b8904c493354ba54
Time: 2021-02-17
Author: ilya@mindsdb.com
File Name: mindsdb/integrations/mysql/mysql.py
Class Name: MySQLConnectionChecker
Method Name: check_connection


Project Name: mindsdb/mindsdb
Commit Name: a00ea9be88393565c2cdf2e8b8904c493354ba54
Time: 2021-02-17
Author: ilya@mindsdb.com
File Name: mindsdb/integrations/postgres/postgres.py
Class Name: PostgreSQL
Method Name: _query


Project Name: mindsdb/mindsdb
Commit Name: a00ea9be88393565c2cdf2e8b8904c493354ba54
Time: 2021-02-17
Author: ilya@mindsdb.com
File Name: mindsdb/integrations/mysql/mysql.py
Class Name: MySQL
Method Name: _query