Home | History | Annotate | Download | only in tko
      1 import common
      2 import MySQLdb as driver
      3 import db
      4 from autotest_lib.client.common_lib.cros import retry
      5 
      6 class db_mysql(db.db_sql):
      7     @retry.retry(db._get_error_class("OperationalError"), timeout_min=10,
      8                  delay_sec=5)
      9     def connect(self, host, database, user, password, port):
     10         connection_args = {
     11             'host': host,
     12             'user': user,
     13             'db': database,
     14             'passwd': password,
     15             'connect_timeout': 20,
     16         }
     17         if port:
     18             connection_args['port'] = int(port)
     19         return driver.connect(**connection_args)
     20